In the system below, when the 10 watt solenoid is activated, 115VAC is sent over
ID: 1921396 • Letter: I
Question
In the system below, when the 10 watt solenoid is activated, 115VAC is sent over the wire and the solenoid pulls approximately 100mA. The microcontroller can both output 5V DC and can input 5V DC. I need a device or configuration of some sort in the diagram where the "?" is so that when the solenoid turns on it can make a connection and switch on the 5V to the microcontroller. When the solenoid is off there should be no connection, so the 5V DC does not come back to the microcontroller. What sort of specific device or configuration can I use? I was thinking possibly another solenoid or a relay. The ? part does not have to be in parallel, it can be in series. I also do not want to affect the function of the 10W solenoid. Any help or ideas will be appreciated. Thanks.
Explanation / Answer
There are several ways to accomplish this. Each would work well and your choice depends only on the size of the component, cost, and how closely you want to stick with the given diagram. Two options: - Optoisolator IC such as MID400. It is a 5V 8-Pin IC. Uses two external resistors, one for output pull-up, one for input current limiting. 115VAC connects to one side (through the limiting resistor), and it will output an active low 5V signal when AC voltage is present. This would be a good input to the uC and would be small and cheap, BUT it wouldn't physically disconnect the two wires as shown in the diagram, it would give a logic Hi or Lo output (wouldn't need the second power wire). So it is a better solution than the next, but possibly not what they are asking for. - AC Relay. Lots of relays can be run directly from 115VAC, but they are typically large and start around $20. Can be purchased as normally open, normally closed, or DPST, so when it has 115VAC it energizes and closes the contacts. Otherwise they are open and physically disconnected. If you go with this option, be sure to use pull-up/down as necessary so you don't leave the uC input floating.