[SOLVED] Arduino Starter Kit Project 15: Hacking Buttons

Hi everyone!

I've been trying to get the last project in the official Projects Book working, to no avail. I dismantled an old pocket calculator and made sure I know how to trigger a button press on the membrane underlying the buttons but the circuit wasn't working. My suspicion landed on the optocoupler being faulty, so I built a circuit with two LEDs to keep it simple and test the component - still nothing.

Please see the video: https://www.youtube.com/shorts/k31_U7Y1-H8
The LED before the optocoupler is obstructing a 220Ohm resistor hooked up to digital pin 2 via the red wire. The LED past the optocoupler has the anode connected to pin 5 and the cathode to pin 4 of the optocoupler. The component should be switched on roughly every 4 seconds, as the pre-optocoupler LED indicates. I tried with multiple LEDs and both optocouplers that came with my Kit.

Is it possible that the optocoupler is dead? Or have I misunderstood something completely and the circuit is built wrong?

For completion, the code is as follows:

const int optoPin = 2;

void setup() {
  pinMode(optoPin, OUTPUT);
}

void loop() {
  digitalWrite(optoPin, HIGH);
  delay(500);
  digitalWrite(optoPin, LOW);
  delay(4000);
}

Any tips much appreciated - thanks!

Actually, I've just realised I indeed built the circuit wrong. the second LED was closing it, completely bypassing the optocoupler! And I do need power on the other side, obviously :slight_smile:

Hi there!
If you solved your issue, please edit the title of your post to include "Solved" or "Closed".

Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.