PLEASE HELP!! -- Remote Madness

First of all, this is my first Arduino. Second, I am very adept at programming but very weak in electronics. In short, I have a small alarm clock with the buzzer leads connected to my Arduino. I have a keyfob remote that turns on/off a wall outlet connected to a big, bright light. The idea was to use an analogue read to detect the voltage on A0 when the clock alarms. That part works fine. I connected leads to the contact for the remotes ON button. I connected the negative to GROUND and connected the other to pin 4. This is where I'm having trouble. The moment you connect the leads from the remote the circuit completes and the remote sends ON to the outlet, continuously, even though pin 4 is LOW. However, when A0 senses the change from the alarm clock (> 1 V) and sets pin 4 HIGH it randomly flashes the light on and off as intended. When I disable the clock (snooze) it again continuously sends ON. I AM GOING MAD.... Please help Arduino crew I beg of you.

Have you connected the grounds between the clock and the Arduino? If not, you likely have a floating input.

I would tend to think that instead of reading the clock's alarms directly, you would want to have an electrical isolation between the clock and the Arduino. Otherwise the potential exists for one system to fry another. A typical way to do this would be to use an opto-isolator, though in this case, you would want to reverse it, so the clock drives the opto-isolator, and the Arduino reads from it. Here is a link I found via google:

Other than that, the usual advice is to post your actual code and a wiring diagram of your setup.

No replies yet… well, to get a response you should include:

  1. a schematic, even hand-drawn on paper and photographed, as long as it is neat & legible or
  2. a photograph of the circuit, close-up and well lit and focussed and
  3. your sketch so far (with code tags).

Otherwise everyone will think you’re just letting off steam and leave you to it!

Here’s something to try: when you don’t want the remote to send a signal to the lamp, try “pinMode(4, INPUT)”. Don’t forget to put “pinMode(4, OUTPUT)” again before you do “digitalWrite(4, HIGH)”.


Oh, Michael beat me to it…

By jove!!! I think you got it....

I'll let you know, and this time I will include code etc.