David
I dont think you can use that opto coupler, it has a triac output which means it wont turn off if your using DC. If im wrong, try connecting
Pin numbers below are on the opto coupler.
1 A 68ohm resistor from pin 1 to the 3.3v vcc (power) limmits current to 50mA
2 An NPN 2N3904 transister collector to pin 2, emmiter to ground.
3 A 100 ohm resister or greater to the transistor base. (limmits the mbed digital sink current to 33ma.
4 connect one end of relay coil to pin 6, OR A RESISTOR SEE WARNING BELOW.
WARNING I DONT KNOW WHAT CURRENT YOUR RELAY COIL NEEDS SO FIND OUT BECAUSE YOU MAY NEED TO INSERT A RESISTOR BETWEEN PIN 6 AND THE COIL TO LIMMIT THE CURRENT.
5 Connect the other end of the coil to ground.
6 connect whatever supply your relay coil needs to pin 4.
7 Connect your bulb across ground and to one of two of the normally open relay contact pairs, with the other relay contact going to your bulb supply (not the bulb).
If you dont understand the issues above get somebody who does to supervise what your doing, as you can easly damage the mbed and yourself. Do not connect AC to the opto coupler unless you do know what you are doing. Also make sure all the grounds (0v) are retuned to the mbed ground. You may also need to connect a diode across the relay coil.
If you do have to use AC you will not need the relay.
Good Luck,
Dave F.
Mbed community.
I would like to control pinball lamps with my mbed.
I have a MOC3021 opto coupler.
How do I wire the MOC3021 opto coupler to the mbed to control the lamp circuit?
The datasheet isn't very helpful.
The lamps are connected to 7.4 DC
Kind Regards David