Maker Pro
Maker Pro

reverse engineering help

Hi,
I have a circuit meant to control AC solenoids, and using TRIACS to do so, and I'm trying to externally control it.
Its seemed fairly simple so I started measure voltage and make sens of the board, and as soon as i connected a scope the whole thing blew up :p, So...I got a replacement board and made a full schematics of it.

It uses an atmega8, I might be able to reprogram it to my purpose or replace it with an arduino chip, either way the impotent part is to understand how the triacs control the coils, and how not to blow the board agian.

the board takes a 220V input, and controls 4 coils, the board allows intensity and rhythm control, my guess so far is that an pulse at the base of the 2222a somehow determines the amplitude of the ac voltage and 0 is off... not sure..
but before i try to poke the board again id appreciate any advice, and some DO's And DONT's for the board.

here is a LINK to the eagle schematic all the values and part numbers are accurate. U3 is just a low voltage detector, TH1 looks lke a cap but behaves like a short, not sure what it is.., R999 is a fix to the board that looks like it was done manually after manfuactering, feel free to ak any question, verfy anything, request tests or mesures...

attached some pics
45ju.png

873s.jpg

pvi8.jpg





thanks! atntias
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Its seemed fairly simple so I started measure voltage and make sens of the board, and as soon as i connected a scope the whole thing blew up :p

See (1) and (2) below.

It uses an atmega8, I might be able to reprogram it to my purpose or replace it with an arduino chip

Do you understand the diffrence between an ATMega8 and an "arduino chip"?

either way the impotent part is to understand how the triacs control the coils, and how not to blow the board agian.

Your reverse engineering of the schematic is a good idea, but telling us what the board is intended for might also help us.

the board takes a 220V input, and controls 4 coils, the board allows intensity and rhythm control, my guess so far is that an pulse at the base of the 2222a somehow determines the amplitude of the ac voltage and 0 is off... not sure..

What I mean is, what *exactly* is the board for? as in "It comes out of a Brand XXX Fubaricator. A Fubaricator controls electrically operated drum-sticks via solenoids."

but before i try to poke the board again id appreciate any advice, and some DO's And DONT's for the board.

1) DO... learn how to use your oscilloscope.

2) DONT... connect the ground lead of the scope to anything that is neither floating (and can be grounded), nor at mains ground potential (and is already at ground potential).

3) DONT... work on mains powered equipment while it is live.

4) DO... show us the other side of the board.

TH1 looks lke a cap but behaves like a short, not sure what it is..

Probably a thermistor. Are you sure it is a short? Unsolder one end and measure it again.
 
hi and thanks for your replay,

1. ok, so iv'e learn the hard way how to use the scope, btw this is a good video about it.

2. yes i understand the diffrance between atmega8 to a atmega328 and the meainging of bootloader all i way saying is that they are pin to pin comptible, so later on for simplicity sake i can use the arduino chip instead so i can program with the arduino ide, and simplfy my work.

3. the board's purpose is to control a massager, there are 4 ac soliendois that tap on your back, you have a small remote with 3 button and 3 leds, on/off, low, high buttons... my goal is to synchronize the massager to music. by patterns i mean what signals are sent to the traic to produce diffrent intensity, and diffrent freqency taps.

4. attached a pic of the other side, you can see R999 there

5. as for TH1 will try to do so later today and report back, you can see him in the 3rd picture of the last post, right under the big green electrolytic cap (its black). the symbol underneather it is of a resistor, il try and tak a picture of it.

6. was thinkning about disconecting from main and running a 5v supply to the output f the 7805, that sould power on the atmega and aloow of some safe testing, wht will happen the the rest of the circuit thou?
maby i can use a pregrammer to read the hex file and run in a simuator if not..

7. thanks agian :)
 

Attachments

  • 20131021_155108.jpg
    20131021_155108.jpg
    140.5 KB · Views: 105
Last edited:

KrisBlueNZ

Sadly passed away in 2015
If it all went bang when you connected your oscilloscope's ground lead to the ground rail of the circuit, your mains supply is probably reversed, and ideally this should be fixed. You should have continuity from the GND rail of the board to the Neutral pin of the mains plug. If you have continuity to the Phase pin on the plug, you should swap the wires at some point.

This doesn't mean that you should ever connect your scope to the board when it's live, even after you have continuity from the GND rail to Neutral.

If you already have continuity from the GND rail to the Neutral pin on the plug, and the plug is not reversible in the mains socket, your household mains wiring may be reversed. Measure the AC voltage between each combination of pins on the socket. You should get voltage from Phase to Neutral and from Phase to Earth, and no voltage from Neutral to Earth. If you don't, get an electrician in!

The board design is pretty straightforward. There are a few definite errors in your reverse-engineering, but that diagram is enough to work from.

Port C bits 0~3 control the four triacs. When the pin is high, the corresponding triac is enabled, and this will activate the corresponding external relay. There is no synchronisation to the mains frequency and there will be a variable delay from when the MCU output changes state until the relay contact closes or opens, so the timing of the relay contact closures and openings will be a bit inexact.

So the "rhythm" and "intensity" are presumably controlled by varying the time between, and the duration of, the pulses that the MCU generates on port C bits 0~3. You can probably understand the design better if you investigate what the relays control, and how those things interact on a mechanical level.
 
Last edited:
thanks for the help, i manged to read the data of the pulses with the use of a usb logic analyzer to a floating laptop, from here il just replace the chip with the an arduino uno chip and add an xbee to remotely porgram and feed data... this way i get compete electrical isolation with no need to edit the board on the electrical side, and be able to upload firmware as well as control in real time, just need to add a transistor for the arduino to be able to reset itself upon given string..
 

Attachments

  • data.png
    data.png
    9.4 KB · Views: 198
wierd behaior

so i replaced the chip, set it up with remote xbee to feed data and do remote firmware updates, wrote my own firmware to send some pulses remotely, and all works well under 5V, this means i power it with 5V see all the timing and pulses are correct and simulate what i measured with the original chip.

but, when connect to ac (no not exploding again), the arduino chip is resetting constantly. and the 5V line is not stable.
this seems to be related to an unexplained behavior of the original chip and an i/o pin on the arduino. and il explain.

when i connect the original chip with 5V, the controller(3 button, 3 leds) respond, but no output is being generated on the coils pins. only when connected to AC, these output something. on the original chip the 5V line is stable!

iv'e found some errors like you said on my schematics, and also an unmarked line going from PD3 to C5.

when measuring DC voltage on this line i get 2.5V only when on AC! , on 5V i get 0, if turning on AC with no chip inside, i get 0 there, so this 2.5 seems to be some output but the chip (pwm?).

i have no clue on what going on there any idea?
i attached the updated schematics.
 

Attachments

  • pcb.png
    pcb.png
    43.1 KB · Views: 165

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
It sounds like you need to figure out what's going on with the power supply.

If the 5V line is not 5V, then see if the input to the regulator is > 6.5V.

Also see if the regulator is getting hot.

Where does the voltage marked as V+ come from? Is it clean DC?
 
you are right...
the v+ is DC dont know how clean but mesures 7.5V, (done by the zender diode i guss)...
im trying to run a simulation of the AC circuit using this http://www.falstad.com/circuit/ but not sure how to represent the voltage absorber and thermistor...
also the 5V is stable if no chip present or the original chip..
 
progress

ok more progress!
so the voltage problem seems to be related to the 3.3v reg on the xbee adaptor, so when disconnection it, i get clean 5V and the board works! so i able to activate the coils with my genreted patterns!

so thats 90% of the work done, now for the last problem- remote controlling it.
so xbee and 3.3v reg faild i tried a bluetooth modlue that runs on 5V, that seems to work well and it powers on, im able to connect to it but the serial line give me no response, when connecting under 5V everything seems to be in order, so im guessing that becouse the 5V is very noisey i cant get serial communication to work... any idea's on that?

im having thought on removeing the power circuits from the board and putting in a 5v transofrmer... keeping the ac only for the triacs input.. will the triacs trigger from 5V not 7.5?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
will the triacs trigger from 5V not 7.5?

Probably, but I'm concerned that your entire circuit will now be live.

You need to look at the specs for the triacs and see what voltages and currents are required to trigger them in all 4 quadrants. Can you trigger it on the worst?
 

KrisBlueNZ

Sadly passed away in 2015
The transformer is probably a good idea.

The whole circuit is already connected to the Neutral mains wire so it's all potentially live. Adding a transformer won't affect this; it will just increase the current capability of the low-voltage supply for the MCU and any other parts that the OP adds.

The trigger voltage to the triacs is currently only about 4.3V anyway; they're triggered from emitter followers that are driven from the MCU, which runs at 5V. At present the collectors of the emitter followers are powered from "+V" which is higher than 5V but this shouldn't make any difference.

I don't see any problem with using a transformer to provide the low-voltage rail instead of taking current from the mains using the capacitor-diode arrangement.
 

KrisBlueNZ

Sadly passed away in 2015
To clarify. I'm not sure what you (the OP) mean by a "5V transformer". If you mean a simple transformer, rather than a complete power supply, then the transformer secondary should be specified at around 7V AC. You feed that through a bridge rectifier and to a smoothing capacitor of around 1000 µF, and that becomes the positive unregulated rail, which you then feed into the 7805 that provides the 5V rail.

If you want to connect the collectors of the triac driver transistors to a voltage higher than 5V, as they were before, you can connect them to the positive unregulated rail. In practice it won't make any difference compared to connecting them to the +5V rail.

The whole circuit is connected to the Neutral wire of the mains connection. This means that it COULD become live; in fact you've already discovered this when you connected your scope earth to the circuit common rail. You (the OP) have not been forthcoming on the subject of safety, what you did wrong, and what changes you have made since, and I consider this a very bad sign.

Based on your responses (or lack of responses) so far regarding mains connection and safety, I recommend that you stop all of your work on this non-isolated, potentially dangerous circuit.

If you insist on continuing with it, you may be breaking the law, and you are certainly putting your safety (and possibly the safety of others) at risk.

Under no circumstances should you connect any part of that circuit to any external connector or other component that could make contact with anything conductive, especially a person. All live and potentially live components and connections must be contained entirely on the circuit board or thoroughly insulated and prevented from making contact with ANYTHING!

I, and the other contributors on this thread, WILL NOT be held responsible for anything bad that happens to you or anyone else as a result of our well-intentioned advice; this includes but is not limited to death, injury, fire, and any other damage to persons or property.
 
update

Ok, first thanks for your detailed help this is much appreciated, sorry for not responding to the safty note you mentioned before, I did check to see it wasnt reversed and it was not the case.

Non the less I took your advice and abandoned the original circuit in favor of new one I made from scratch, I used a 4 channel optoisolted relay board and an arduino plus an xbee.
From the old board I took the voltage absorbers and put them according to the original circuit I.e. across the coils and 220 input.

This works very well and got me exacly what I wanted. I packged everything nicely and it fits well inside the device, for 5v I stripped a usb phone charger for the task of powering the arduino. Dont worry everything is well isolated and double checked.

My last and hopefully final question for the project is this: although the relays are optoisolted, the supply of 5v for triggering them is set by a jumper to the same 5v of the arduino, and although there is a diode across the relay, still when triggering fast pulses (20ms on off) in series the arduino resets, and it appears the some noise from 220v is causing that , since when the ac is off but relays are triggered this does not happen. Adding a large capacitor across the 5v does not help nor does using the 5v before the arduino regulator (I.e. using vin for the triggers), and also used the fuse.
A solution to that might be to use a completely different power adaptor for the relays 5v supply.
Just to clarify this only happens with fast pulses in series.

Before I turn to that option do you have any advice?
Thanks for all the help!

Edit: when I come to think of it, simply a diode from the 5v to the relays power will help.. il try it tomorrow. .
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
I'm very glad to hear that you're using a system where the control circuitry is all isolated from the mains.

Sounds like back EMF from the inductive loads that you're switching with the relay contacts. For each output, add a resistor and capacitor in series across the contacts of your first relay (the one that is switching the AC-powered solenoid) to act as a snubber. Typical values are 47 nF and 150 ohms. Use an AC-rated capacitor such as http://www.digikey.com/product-detail/en/R46KI24700001K1/399-5459-ND/1930813. Alternatively you can connect the snubber across the coil of the relay being driven by that contact, instead of across the contact.
 
so just to be clear if i connect the snubber in series across the 5v coil of the relay(the trggering side) do i need AC rated caps or not?

another thing, if i understood correctly i leave the realy connection as is, then add in paralel accross the relay both the resistor and capacitor in series. and i can do so eaither on the AC side or the triggering side.

thanks
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
You don't connect the snubber across the 5V coil of the first relay. There should already be a diode across the 5V coil of the first relay, which suppresses the back EMF from that relay coil.

The resistor-capacitor snubber is needed when the energising voltage is AC instead of DC. The snubber consists of a resistor and a capacitor in series, and it can be connected across the contacts of the first relay, or across the coil of the second relay (that is being driven by the first relay). So in both cases, the snubber network is connected in the AC circuit that connects the contacts of the first relay to the coil of the second relay; the difference is in which part of the circuit they are connected.
 
im not sure what you mean by "coil of the second relay (that is being driven by the first relay)", what do you mean first and second coil?

the board im using is this as you can see optoisolated and with diode across the relay, yet, just sharing the GND of that board with the arduino is enought to trigger the resets, meaning - even if i used a completly diffrent 5V for the relay board but share the GND.

to be clear i added a quick schemtics of the ac side of the board (the back of the relay part you can see in the link)...

in orange is stuff i took from the old board just like it was connected there (i.e. the volratge absorbers across the coils and the ac input and a capcitor across the ac, and the fuse).

in black what i understood you are suggesting, is that right?
i got the capcitors and resistors, wasnt sure about the watt rating for the resistor so i got from 1/4 to 3w... which is it? :p

thanks
 

Attachments

  • circuit.png
    circuit.png
    11.6 KB · Views: 139
  • 20131105_202847.jpg
    20131105_202847.jpg
    138.6 KB · Views: 176
  • 20131105_203015.jpg
    20131105_203015.jpg
    142 KB · Views: 132
  • 20131106_172249.jpg
    20131106_172249.jpg
    136.5 KB · Views: 165

KrisBlueNZ

Sadly passed away in 2015
Yes, that schematic shows what I'm suggesting.

As I understand it, the relay shown on the schematic is the one that's on the isolated relay board, and it's driven by the Arduino, right? I call that the "first" relay. It takes the place of the triac in the original circuit. And the connector on the right, marked "COIL" and "LOAD", connects to the coil of the "second" relay, which uses an AC coil voltage.

Don't connect anything from that circuit to anything on the Arduino circuit. It should be a completely isolated circuit that consists of the mains supply, the contacts of the first relay, and the coil of the second relay, and the suppression components, including the snubber.

I'd use a 1 watt resistor.
 
Top