please help - brushed motor with speed and direction control

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everybody,

 

I'm not an experienced tech guy but I have some knowledge about electronics and I come to you trying to get some help on fixing a nail polish machine that my wife managed to fried it by plug in the DC adaptor (12v) into the pedal socket. I tried to get some help from the manufacturer (or seller) but without success so I have tried to do some "reverse-engineering" by drawing the schematic of the circuit (attached). In fact, the circuit is controlling the speed and direction of a brushed DC motor (with a speed of up to 30k rpm).

I have identified then most of the parts with the exception of the 14pins IC which I think is the controller. There is nothing written on it but based on pin connections it looks like a tinyavr.

 

Can anybody help me with a solution to fix this?

 

Thank you very much,

Florin

 

Attachment(s): 

Just started to learn!

Last Edited: Tue. Apr 7, 2020 - 09:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Presumably putting too many volts on the pedal socket has blown up the microcontroller.

 

Looks like it is, at least in principle, possible to replace with attiny1614 (power pins in the right place) but you may be on your own with the firmware. I would imagine it reads the adc input (for the pedal) and varies the PWM duty cycle accordingly - not a difficult firmware.

 

Are all the power lines good? Is the voltage regulator ok?

 

If the updi is unlocked, you might be able to read out the old firmware, but only if the device isn't completely blown up (e.g. only one gpio port is gone)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi @markxr,

 

Thank you very much for your fast reply (I was not expecting this since this is my first post here). This means that AVRFREAKS is really an active community :)

 

Everythings else is working fine, I mean the power line, voltage regulator etc. Thank you very much for your input, I shall try to get the firmware "out" of the burned IC.

 

Thank you,

Florin

 

p.s. any other ideas or solutions (eventually new schema+firmware) are very wellcome.

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dabijja wrote:
There is nothing written on it but based on pin connections it looks like a tinyavr.

Hmm, I think that's one giant leap for deductive reasoning!

 

I think you need to take it off the board to see if there's anything written underneath

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Even if you can identify the chip I forsee two very large stumbling blocks:

 

1) in almost every commercial project the lockbits on the AVR will have been set so no one can extract the code (prevents making copies)

 

2) even if the code were unlocked if the chip really has been "blown up" by the application of 12V then how on earth could you extract the current code anyway ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In my opinion, duplicating the firmware is not difficult. The hard part is maybe doing that without having a working unit to analyse. It's possible that there is some "magic" in the firmware that drives the PWM in a specific way which is related to the attached hardware.

 

It's also possible that if driven incorrectly by the firmware, the hardware (the nail polisher) will be damaged, so that's something to think about.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

That pinout could just as easily be a PIC.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

There is a code on the back side 1 85256C or 1 85356C. Tried to google but nothing found, as expected.

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Brian,

 

I have search and the only microcontroller with pin 1 VDD and 14 GND is Attiny. But, if you have any idea about a PIC with this setup, please let me know.

 

I'm willing to try to re-design the circuit in order to use a different chip, but unfortunately I have just entered into this "world".

 

Florin

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

markxr wrote:
In my opinion, duplicating the firmware is not difficult

But you're speaking as someone experienced in the art;

 

dabijja wrote:
I'm not an experienced tech guy

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let's say that I think I have the tools to do it. And, according to "if there is a will there's a way", I'll do my best to learn how to do it. 

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


dabijja wrote:

I have search and the only microcontroller with pin 1 VDD and 14 GND is Attiny. But, if you have any idea about a PIC with this setup, please let me know.

 

GND is also known as Vss. There are 45 different 8-bit PICs in a 14 pin package but most (all?) have the power pins arranged like this...

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dabijja wrote:

Hi everybody,

 

I'm not an experienced tech guy

 

Well, good job on reverse engineering it, even though it looks like the layout is very simple to reverse engineer and clear.

 

I'm sure there are multiple options for 14-pin soic which will fit in that space. Attiny1614 is one of them. At least where I live (UK) it is possible to buy attiny1614 in quantities of 10 for about $1 each.

 

Actually trying to implement this controller is more difficult of course, you will probably need build some kind of development board (order a devkit of some kind?) and check that the correct signal is coming from the correct pin, getting the adc right etc, before putting it in-circuit.

 

I'd probably try to put bodge wires across to a breakout-board or something, and wire some LEDs (on a prototype or breadboard) to check the output signals visually, with the pedal switch in-circuit.

 

It is rather a shame they didn't put a software-controllable LED on that board.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have just added more options :)

 

Thank you!

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

markxr wrote:

 

Well, good job on reverse engineering it, even though it looks like the layout is very simple to reverse engineer and clear.

 

 

it took some days :). Thx

 

I have recently bought an Mplab Snap and MSP-EXP430FR4133 (dev board) in order to play with them so I think they can help the scope.

 

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dabijja wrote:
 an Mplab Snap and MSP-EXP430FR4133 

That's an odd combination!

 

surprise

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Apr 1, 2020 - 12:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

 

 

dabijja wrote:
I come to you trying to get some help on fixing a nail polish machine

When I read that I was thinking of this:

 

Why  would someone want to polish these.....

 

Oh well, what ever floats your boat I guess smiley

 

Good luck with your project

 

Jim

 

 

 

 

 

 

Last Edited: Wed. Apr 1, 2020 - 01:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

laugh

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The two potentiometers don't appear to be connected to anything.

 

Can you get the motor spinning by putting +5V on R6 and/or R7?  (with the power on to the rest of the circuit?)

 

If the 14-pin IC is a microcontroller, it could be a tiny24/44/84.  In that case a replacement could be programmed with a common cheap ISP programmer such as the USB-ASP.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
The two potentiometers don't appear to be connected to anything.

 

You're correct. half of the potentiometer is not connected but the other half is connected to pin 3 with a resistor R4 (I have now corrected the diagram). Thank you very much for your input.

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dabijja wrote:
Can you get the motor spinning by putting +5V on R6 and/or R7?  (with the power on to the rest of the circuit?)

 

I shall test it and let you know.

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looks like you should have a do-able project to add in your own chip and  code---with your own features!

To make things smoother, now that you have some sense of how things are connected, redraw it nice and neat (it is somewhat horribly scrambled now).  Put the AVR in the dead center and everything will radiate out from it (it is the central control point of all)...all of the  twisting & turning wires will be nice, short and straight connections (such as from the AVR to the motor chip, from the pots to the adc pins, etc).  You will be amazed it how much it will clean up.  It will also make any other missing or oddball things easier to spot.

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Apr 2, 2020 - 06:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:

Can you get the motor spinning by putting +5V on R6 and/or R7?  (with the power on to the rest of the circuit?)

 

Yes, the motor is spinning on both directions by putting +5V on R6 and then on R7.

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll do that (this might be easiest thing for now laugh). Thank you

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll do that (this might be easiest thing for now laugh). Thank you

Generally speaking inputs on the left, output on the right...signals & schematic flows from left to right, just like reading a book...except you are reading wires connecting things together.

You can also move (reorder) the pin #'s  on your chip symbol, that gives it the ultimate clarity (ex: pins on left side numbered as: 1 2 6 8 3 12 10 5... I made these up).   

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

as per your input, I have managed to redraw the circuit.

 

Now, I need to find a solution. cool

Attachment(s): 

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plus goes to the top, ground goes to the bottom. Half of your circuit is upside down - makes it difficult to understand.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I hope is better now.

Attachment(s): 

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With the MPlab SNAP you should be able to program a 14-pin AVR microcontroller with Vcc and Gnd on the correct pins.  An example is the Tiny24. Seems like one ADC channel needs to be read[speed], a direction switch, and a motor/on/off push switch.   Then output logic is sent to the motor controller IC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:
Seems like one ADC channel needs to be read[speed], a direction switch, and a motor/on/off push switch.   Then output logic is sent to the motor controller IC.

I would just use one pot, with the center position as motor stop (have a small dead band there), less then middle position would be reverse, greater then middle position forward (joy stick pot)

The further from center, the faster the motor would run.....

 

 

Jim

 

 

 

 

 

Last Edited: Thu. Apr 2, 2020 - 06:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
(joy stick pot)

My bad, I see you already have forward/backward switch, and pot sets a desired nail polishing speed, I was thinking about a robot motor control.....

 

Jim

 

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your input is really valuable but could you please provide me with an example of such code? In the meantime I'll look for few Attiny to order. Thank you

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You just need a chip that has power pins on the correct pins (1,14)....adc on pins 3,  ????

 

For your schematic (it is beginning to get a lot better):

pin 7 is not the best direction, it should be more like pin 6  ...inputs go from left to right.

Why are the wires rising so high from pins 4 & 3, but then at c1  & r5, the distance is crushed to nothing? ,very unbalanced.

Just like a GND symbol is used, do the same for +5V   symbol...will be a LOT cleaner looking

U3 pin 1 gnd...crosses bunch of other wires unnecessarily

C4 missing dot to gnd

Where is connector pin1 , pin2 on the schematic?

Q2...the base should be on the left...the entire circuit block is mirrored....r10, r8, c6, etc should be on the left, r11, c8 on the right

R17 should be centered between pins 12 & 14. 

Connection dots go to wires, not components..BOTH/ALL leads of components should only go to wires

For things like pedal 2 there is a slight preference for the signal to be on the left and the gnd on the right

  

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Apr 2, 2020 - 10:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much for your help, so far. While I'm trying to find some time in order to get the diagram in the best possible shape (thx to @avrcandies), I have just received several Attiny in order to play with them.

Now, based on the current scheme, can anybody provide me with some links from where I can get some instructions, best practices that can match my project?

 

One option, based on my research, might be to get the project done for Arduino and than to import it in Atmel Studio and  compile it for Attiny24 (for example). Of course, if somebody can help me with creating the code directly in Atmel, that will be much appreciated.

 

Thank you

Just started to learn!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everybody,

 

Unfortunately, no progress on this project. Is anybody willing to help? A beer or two or three can be "granted".

 

Thank you,

Florin 

Just started to learn!