OVERVIEW
Have you ever wanted to connect your Arduino to another device and simulate pushing the buttons on it?
By itself the Arduino can’t really achieve that, since the buttons are on another device that uses it’s own voltage and ground.
You could use a relay to connect the pins on the button together, simulating pressing the switch (button) but you would need one relay for every switch you want to press.
In this tutorial we will look at the 4066 IC bilateral switch which enable you to control up to 4 switches. If you want more you can just use more 4066 IC’s.
Simple to use and inexpensive, this little IC is great when you want to control another device using it’s own buttons.
PARTS USED
4066 IC Bilateral Switch
Arduino UNO
Arcade Button with LED
These are Amazon affiliate links...
They don't cost you anything and it helps me keep the lights on
if you buy something on Amazon. Thank you!
CONNECTIONS
Pin 7 of the UNO is connected to Pin 13 of the 4066 IC which controls Pin 1 and 2 on the 4066 IC.
5V and Ground from the UNO goes to Pin 14 (VDD) and Pin 7 (GND) of the 4066 IC.
Pin 1 and 2 of the 4066 IC are connected to each leg of the arcade button.
One leg of the arcade button is connected to the external 5V and the other goes to the Vpin of the LED.
The external ground is connected to the ground pin of the LED.
THE CODE
Using the 4066 IC with an Arduino is very easy.
All we have to do is make the digital pin of the Arduino that is connected to one of the 4066 input “HIGH” and it will trigger the corresponding output.
In this simple sketch, we are just making the pin go from “HIGH” to “LOW” with a small delay between the two to make our LED flash.
As always you can have a look at the tutorial video for more information.
/* Arduino Button Press 4066 IC
Created by Yvan / https://Brainy-Bits.com
This code is in the public domain...
You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!
*/
#define buttonclick 7 // Pin 7 connected to Pin 13 of 4066 IC
int clickspeed = 25; // Controls speed of button click
void setup() {
pinMode(buttonclick, OUTPUT);
digitalWrite(buttonclick, LOW);
}
void loop() {
digitalWrite(buttonclick, HIGH);
delay(clickspeed);
digitalWrite(buttonclick, LOW);
delay(clickspeed);
}
TUTORIAL VIDEO
DOWNLOAD
Copy the above Sketch code in your Arduino IDE software to program your Arduino.
You can download the Datasheet (PDF) of the 4066 IC here: Download 4066 IC Datasheet
Comments