0

members

Easy Arduino Starter Kit: Project 15 HACKING BUTTONS

of Arduino in UNO

Arduino Starter Kit: Project 15

Project name: HACKING BUTTONS

Discover: optocoupler connecting with other components

Attachments: sketch

In this project, you need these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Jumper cables

3. Resistor 1 pc (220 Ohm)

4. Breadboard half size 

5. Arduino IDE ( you can download it from here  )

6. Optocoupler 4N35 1 pc

GENERAL

We recommend you use inexpensive items you do not mind damaging for your first few projects, until you develop experience and confidence. While the Arduino can control a lot of things, sometimes it’s easier to use tools that are created for specific purposes. Perhaps you want to control a television or a music player, or drive a remote control car. Most electronic devices have a control panel with buttons, and many of those buttons can be hacked so that you can “press” them with an Arduino. Controlling recorded sound is a good example. If you wanted to record and play back recorded sound, it would take a lot of effort to get the Arduino to do that. It’s much easier to get a small device that records and plays back sound, and replace its buttons with outputs controlled by your Arduino.

Optocouplers are integrated circuits that allow you to control one circuit from a different one without any electrical connection between the two. Inside an optocoupler is an LED and a light detector. When the LED in the optocoupler is turned on by your Arduino, the light detector closes a switch internally. The switch is connected to two of the output pins (4 and 5) of the optocoupler. When the internal switch is closed, the two output pins are connected. When the switch is open, they’re not connected. This way, it’s possible to close switches on other devices without connecting them to your Arduino.

See the datasheet of optocoupler 4N35 here.

THE CIRCUIT

In this project, the drawings are made for controlling a digital recording module that allows you to record and playback 20 seconds of sound, but the basics is the same for any device that has a switch you can access. 

Well, you are advanced user now if you are planing to do this project. Be carefull as you will open up an electronic device to modify it. Think about the device’s warranty, and if you will not be careful, you might damage the device.

Connect ground to your breadboard through the Arduino. Place the optocoupler on your breadboard so that it straddles the center of the board. Connect pin 1 on the optocoupler to Arduino pin 2 in series with a 220-ohm resistor (remember, you are powering an LED inside, you do not want to burn it out). Connect pin 2 of the optocoupler to ground. On the main board of the sound module there are a number of electrical components, including a playback button. To control the switch, you are going to have to remove the button. Flip the circuit board over and find the tabs that hold the button in place. Gently bend the tabs back and remove the button from the board. Under the button are two small metal plates. This pattern is typical of many electronic devices with pushbuttons. The two “forks” of this pattern are the two sides of the switch. A small metal disc inside the pushbutton connects these two forks when you press the button. When the forks are connected, the switch is closed on the circuit board. You will be closing the switch with the optocoupler. This method, closing a switch with an optocoupler, works only if one of the two sides of the pushbuton’s switch is connected to ground on your device. If you’re not sure, take a multimeter and measure the voltage between one of the forks and the ground on your device. You need to do this with the device turned on, so be careful not to touch anywhere else on the board. Once you know which fork is ground, disconnect the power to your device. Next, connect one wire to each of the small metal plates. If you are soldering these wires, be careful to not join the two sides of the switch together. If you are not soldering and using tape, make sure your connection is secure, or the switch won’t close.Make sure neither wire connects to the other fork, or your switch will be closed all the time. Attach the two wires to pins 4 and 5 of the optocoupler. Connect the side of the switch that is grounded to pin 4 of the optocoupler. Connect the other fork to pin 5 of the optocoupler.

THE CODE

You are going to play the sound once every 20 seconds by turning pin 2 HIGH. Create a constant for the optocoupler control pin. In setup(), set the optocoupler pin into an output. The loop() turns optoPin HIGH for a few milliseconds, long enough for the optocoupler to close the switch on the device. Then the optoPin becomes LOW. Wait for 21 seconds for the whole message to play back before starting the loop() again.

THE START

Attach the battery to the sound recorder. Press and hold the record button on the device. While you are holding the button, you can record audio into the microphone. Use your voice. Once you recorded a sound, power your Arduino with the USB cable. Your recording starts to play. If you recorded for the full 20 seconds, the sound should start again just a few moments after it ends. Try experimenting with different sounds and durations of toggling the playback with the delay() in your program. If you trigger the switch while a sound is playing, it will stop.

THE SUMMARY

Integrated circuits are in virtually every electronic device. The large 28 pin chip on your Arduino is an IC that houses the brains of the board. There are other ICs that support this one with communication and power. The optocoupler and main chip on the Arduino are Dual In-line Package (DIP) chips. These DIP chips are easily fit in a breadboard and do not have to be permanently soldered to be used.

Optocouplers can control devices that are on a different circuit. The two circuits are electrically separated from each other inside the component.

The project only played sound back at a regular interval. This technique of controlling an electronic device with an optocoupler by connecting to the two sides of a switch can be used in many other devices. 

See one of movies on Youtube about it - link here.



Other projects of Arduino

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 29-08-2017
Viewed: 1848 times