## Lighting a lamp based on the condition of another lamp Moderators: adafruit_support_bill, adafruit

Lighting a lamp based on the condition of another lamp

I have a pinball game, on the playfield is a green lamp. This green lamp is in one of three states: off, flashing, or on. I want to light a white lamp elsewhere if the green lamp is on solid (not flashing, nor off). I do not have access to the logic of the green lamp, only the electrical connection to the green lamp (it's an LED). The white lamp would be powered from a different electrical source than the green lamp, and that electrical source for the white lamp is constant. Both are 6.3V AC (not DC).

Can anyone provide any advice on where to start with this one? I've kinda assumed an Arduino that's watching the voltage of the green lamp and if it's solid for a short time it'll turn the white lamp on (the flash is about 3 Hz) by closing a relay that'll allow the AC to flow to the white lamp. Does this sound like the best approach? Or any other ideas or advice?

Thanks!

Priam

Posts: 7
Joined: Sun Nov 12, 2017 12:44 am

Re: Lighting a lamp based on the condition of another lamp

Something like:
Code: Select all | TOGGLE FULL SIZE
`uint32_t lastOffTime;void loop(){   if (digitalRead(greenLampPin == LOW) // lamp NOT on   {      lastOffTime = millis();   }   else   {      if (millis() - lastOffTime > 500) // has it been on for > 500 ms?      {         digitalWrite(whiteLampPin, HIGH);  // White Lamp ON      }      else      {         digitalWrite(whiteLampPin, LOW); // White Lamp OFF      }   }      // Do other stuff if needed   }`

Posts: 76048
Joined: Sat Feb 07, 2009 10:11 am

Re: Lighting a lamp based on the condition of another lamp

Thanks for the example, that makes sense.

Also, any advice for getting that 6.3V AC into a Arduino consumable voltage?

Priam

Posts: 7
Joined: Sun Nov 12, 2017 12:44 am

Re: Lighting a lamp based on the condition of another lamp

You can use a simple resistive voltage divider: https://en.wikipedia.org/wiki/Voltage_divider

Posts: 76048
Joined: Sat Feb 07, 2009 10:11 am

Re: Lighting a lamp based on the condition of another lamp

I'm not entirely sure how to apply that to AC. I was poking around the net for some ideas and found thyristor and optocoupler. If I understand them right, the thyristor would "read" the green lamp's AC line and could set a DC line to high on the Arduino. Then to turn the white lamp on an optocoupler could be used to close the white lamp's AC circuit.

Priam

Posts: 7
Joined: Sun Nov 12, 2017 12:44 am

Re: Lighting a lamp based on the condition of another lamp

Sorry, I missed the "AC" part of that. On the input side, you can rectify the AC with one or more diodes: https://en.wikipedia.org/wiki/Diode_bridge
and use that to drive an opto-isolator.

Since the rectified voltage will be in pulses at the AC line frequency, you can either use a capacitor to smooth it out, or add some extra code to accommodate that.

For the AC lamp control, a relay module is the simplest solution: https://www.adafruit.com/product/2895

Posts: 76048
Joined: Sat Feb 07, 2009 10:11 am

Re: Lighting a lamp based on the condition of another lamp

Okay, that helped a lot, thank you. Knowing what to look for (the right search terms) got me some examples. I found this page:

https://electronicsclub.info/powersupplies.htm

Since I already have a transformer dropping 120AC to between 7.8AC and 6.3AC all I should need to create is the rectifier, smoother, and regulator.

I'm going to try using 1N4001 diodes to build the rectifier. A 470uF capacitor for the smoother. And a LM7805 regulator (with 2x 10nF caps).

That sounds far more sane than the thyristor or optocoupler. ;)

Priam

Posts: 7
Joined: Sun Nov 12, 2017 12:44 am