TURTLE IR - AUTOMATE EVERY IR CONTROLLED HOME ELECTRONICS AND APPLIANCES
by patrick panikulam in Circuits > Remote Control
11949 Views, 204 Favorites, 0 Comments
TURTLE IR - AUTOMATE EVERY IR CONTROLLED HOME ELECTRONICS AND APPLIANCES
Imagine the following situations:-
- You come back from a tiring day of work and just lie down on the couch, but then you're just too lazy to get up and grab the remotes to switch on your TV or the air conditioner even though the remotes are just a few feet away,
- Or even worse, you have pets or kids or both and the remotes are not even there.
- You wish you could control your TV, DVD player, Sound system, air conditioner, projector, heater, etc with your voice without having to upgrade to new expensive smart appliances that are wifi compatible.
- You reach your office or place of work but suddenly realizes you forgot to switch off the heater or air conditioner before leaving home, and you wish you could switch these off just by tapping a button on your phone or asking your phone's Alexa to switch them off for you.
- Imagine you have set up a home theater with a projector, a DVD player, and a 5.1 sound system, Each time you want to watch a movie on it, you have to find all 3 remotes, switch on each device one after the other, select the correct HDMI source ports and input channels, adjusting the volume, etc. Don't you wish all these could be done automatically in a few seconds with just a single voice command?
- You are the kind of person who falls asleep during a movie and the next thing you remember is waking up in the morning with the TV still on and you just wish there was some way to automatically switch off the TV maybe 3 or 4 hours after the movie starts.
- It's around 2 or 3 AM at night, you suddenly wake up because the room temperature is too low or too high. First, you have to find the air conditioner remote in total darkness with sleepy eyes and then make sure you press the right button. How easy it would be if you could just give out a voice command and control the AC temperature without moving a muscle or even opening your eyes!!
- You are a working parent and you don't want your kids spending too much time in front of the television when you are at work and you just wish there was a way to switch off the TV at home from your place of work!
- You are the kind of person who always misses the beginning of your favorite 8:30 pm TV show because you don't always check the time or remember about the show in time, and you wish someone or something would automatically switch on the TV and put on the required program for you at exactly 8:30 pm every day or on particular days so that you don't miss a minute of your favorite show.
TURTLE IR is the perfect solution to all the above situations and more. TURTLE IR is basically a tiny, 360 degrees IR transmitting device that lets you automate and voice control every single electronic appliance at your home or office that supports an IR remote. It is an Alexa-controlled infrared blaster which connects to your home or office wifi and can be controlled through any eco devices by voice or the Alexa app on your phone from anywhere in the world.
TURTLE IR comes with a 2500 mah rechargeable battery and 12 IR transmitters facing all directions. Once the basic Arduino code with the IR signal data is uploaded to the device, all the automation procedures and voice commands can be easily created and edited from the Alexa app at any time without having to reprogram the whole device. An ESP-01 is the main microcontroller used in this project. All the battery management and voltage regulating circuitry are included within the device.
You can voice command and automate home appliances, set procedures and combinations to automatically switch on/off, change appliance settings, and set up different interconnected home appliances like your DVD player-Sound system-projector combo, etc with a single voice command. You can control these devices from anywhere in the world through the Alexa app, as well as set timers and situations in which appliances have to be automatically switched on or off or change appliance settings for example switch on the AC and set it to a particular temperature automatically when the outside temperature is this much or switch on the home AC or heater automatically 30 min before you arrive back from work, etc.
DEMONSTRATION
SUPPLIES
The following are the electronic components you will need to build this project with the links attached:-
- ESP-01 X 1
- PCB line board X 1
- IR LEDs X 12
- TSOP38238 IR Reciever X 1
- Female jumper connector socket X 1
- Micro USB female socket X 1
- Latching Push Button X 1
- 10 K resistor X 6
- 18650 Battery X 1
- CP2102 TTL UART Module X 1
- BC547 Transistor X 6
- Node MCU X 1
- Mini 360 DC Buck Converter X 1
- TP4056 Lithium Battery Charger Module X 1
- Battery Spring Plate Set X 1
- M3 * 10 mm Allen bolts X 4
- Vinyl Sticker X 1
TOOLS AND EQUIPMENT REQUIRED:-
- Sandpaper
- Soldering iron
- Allen key set
- 3D printer
- Super Glue
- Scissors
- Wire cutters
- Razorblade.
3D PRINTED PARTS AND STICKERING
This project requires just two 3D printed parts - The base and the cap. The STL files for both parts are attached in this step. The parts were designed to be easily 3D printed without any supports. The parts were printed on a TEVO Tarantula 3D printer.
3D Print settings:-
- Material : PLA
- Nozzle diameter : 0.4mm
- Layer Height : 0.2 mm
- Infill : 100%
- Nozzle temperature : 204
- Wall thickness : 0.8mm
- Top/Bottom thickness : 2mm
Once the parts were printed, the flat surfaces were sanded down using fine sandpaper and then a vinyl sticker was applied on the surface to enhance the appearance.
- Cut out a rectangular piece of sticker that is bigger than the surface to be covered.
- Remove the back paper film and apply the sticker on the flat surface making sure no air bubbles get trapped in between the surface and the sticker.
- Press the sticker gently around the edged to get a crease.
- Use the crease as a reference to cut the excess sticker using scissors or a sharp razor blade.
BATTERY HOLDER PREP
The battery comes in the middle of the device. A slot is included within the design of the base to hold the 18650 battery in place.
The battery contact plate and the spring plate have to be attached. These plates are glued onto either side of the slot using super glue or any equivalent as shown in the picture. Make sure that the soldering terminals are pointing upwards.
Once the glue dries, insert the battery into the slot and check if it seats properly and has proper electrical contact with the plates.
ESP-01 SOCKET PREP
The ESP-01 does not have built-in micro USB sockets for programming purposes like the ones present in Nodemcu or Arduino nano. Therefore it has to be easily removable from the device in case changes to the program have to be made. So we made this socket into which the ESP-01 is plugged in after programming. The socket will stay permanently attached to the device whereas the ESP-01 can be easily removed from the device whenever necessary.
- Clean the copper strip of your PCB line board with sandpaper (Incase the line board has a layer of oxidation)
- Select 4 rows of copper lines and split the rows into 2 sections by scrapping the lines with a sharp blade as seen in the 2nd picture. Make sure there is no electrical contact between both sections.
- Take the female jumper connector sockets strip and cut it into 2 pieces of 4 slots each. Stick both the pieces together and bend the metal pins outside to 90 degrees as seen in the 3rd picture.
- Solder the sockets to the Line board across the scrapped line such that each metal pin on the socket gets its own copper line on the line board.
- Using a wire cutter or a strong pair of scissors cut out the rectangular section of the line board on which we soldered the socket.
- Make sure the ESP-01 can be easily inserted and removed.
ATTACHING THE ELECTRONIC MODULES , IR LEDS AND POWER BUTTON TO THE BASE
In this step, we will attach the electronic modules, power button, and 4 of the IR LEDs to the base. The base is divided into 2 sections by the battery. One section holds the battery management and charging modules whereas the second section holds the voltage regulating and the microcontroller boards.
- Apply a tiny drop of super glue or equivalent on the bottom of the female micro USB board and place it on the base such that the micro USB port perfectly aligns with the rectangular cutout provided for it on the 3D printed base.
- Similarly, apply glue on the battery management module (TP4056) and place it on the free area provided for it close to the Micro USB port board.
- Wait for a few minutes for the glue to dry.
- To attach the power button, first press the button to its ON position. This makes the button smaller which makes it easier to align the button properly on the 3D printed base.
- Carefully apply a drop of glue on one side of the button making sure glue does not seep into the button.
- Place the button on the 3D printed base such that the blue pushing pin of the power button comes out through the square cutout provided for it.
- Attach the buck converter (Mini 360) and the custom-made ESP-01 socket to the base using glue on the second section of the base.
- Attaching the IR LEDs is easy. There are 4 holes provided on the base for the LEDs. Insert the LEDs in these holes. It will be a tight fit but still, drop a tiny bit of glue at the contact ring of the LED and 3D printed base to make sure they won't come out loose.
We will be wiring these modules later once the remaining IR LEDs are attached to the cap.
IR LEDS ON THE CAP
The remaining 8 IR LEDs are attached to the 3D printed cap. These are the main IR transmitting LEDs that give out signals in all directions. The LEDs are inserted into the hole and a little bit of glue is applied at the point of contact. When inserting the IR LEDs, make sure that the -ve and +ve terminals of all the LEDs are aligned in the same direction to make the wiring less confusing in the upcoming steps.
MAIN CIRCUIT DIAGRAM
This is the circuit diagram of the device. On the left, we can see the battery and the battery management module. This module (TP4056) has 3 main purposes:-
- Makes sure the battery charges at 4.2 volts as any voltage above that could damage the battery.
- Automatically cuts off the charger when the battery is fully charged (at 4.2 V) and cuts off the load when the battery is fully discharged (at 3.3 V). This is for battery protection.
- Automatically cuts off the load during an overload or short circuit.
Next, we see the main power button. This is a latching push button that switches ON the device.
On the bottom middle, we see the 360 mini DC to DC buck converter. We are using this module to regulate the battery voltage of 3.5 - 4.2 volts to a lower voltage of 3.3 volts. This has to be done because the ESP-01 module cannot handle any voltage above 3.3 Volts.
IMPORTANT NOTICE : USE THE TINY POTENTIOMETER ON THE 360 MINI BUCK CONVERTER TO SET THE OUTPUT VOLTAGE TO 3.3 VOLTS BEFORE CONNECTING IT TO THE ESP-01. USE A SCREWDRIVER AND A MULTIMETER TO DO THIS . CLICK HERE TO KNOW MORE.
The RX pin of the ESP-01 is set to give out the digital signal for the IR LEDs. Since this signal pin is not capable of powering all 12 IR LEDs at once, we use six BC547 transistors along with the 10K resistors as high-frequency switches so that each transistor switches ON or OFF two IR LEDs according to the signal received from the digital pin. This makes sure all 12 IR LEDs give out the IR signal simultaneously with full power ensuring maximum range and coverage when it comes to signaling electronic appliances all around.
Refer to the attached circuit diagram for the following wiring steps.
WIRING THE BATTERY MANAGEMENT AND CHARGING SETUP
First, we will be wiring the battery charging and management system. Using the main circuit diagram in the previous step as a reference, follow these steps:-
- Solder the VBUS and GND ports on the female MicroUSB board to the IN+ and IN- ports of the TP4056 board respectively.
- Solder the B+ and B- ports on the TP4056 module to the battery +ve plate and the Spring plate respectively.
- Insert the battery in the slot such that the -ve terminal of the battery comes in contact with the spring plate and its +ve terminal on the flat plate.
- Plugin in the device to a MicroUSB charger and charge the batteries. The light on the TP4056 glows red when charging and turns blue once the battery is fully charged.
WIRING THE ESP-01, VOLTAGE REGULATOR AND IR LEDS VIA TRANSISTORS
Using the main circuit diagram as a reference, follow the steps below:-
- Connect the OUT+ of the TP4056 module to one of the power button terminals.
- Connect the other power button terminal to the IN+ of the 360 MINI DC to DC buck converter as well as to all the IR LEDs +ve terminals.
- Connect the OUT- of the TP4056 module to the IN- of the 360 MINI buck converter.
- Switch on the power button and measure the voltage at the OUT+ and OUT- terminals of the 360 MINI buck converter. If the voltage is not 3.3V, turn the potentiometer on the buck converter using a Philips screwdriver until the voltage becomes 3.3V
- Connect the OUT+ and OUT- terminals of the 360 MINI buck converter to the Vin and GND lines on the custom socket we made for the ESP-01.
- Take two BC547 transistors and two 10K resistors and wire them together with the -ve terminal of the IR LEDs on the base as seen in the circuit diagram.
- Connect the base of both transistors to the RX pin line of the ESP-01 on the custom-made socket through the 10K resistors.
WIRING THE IR LEDS ON THE CAP
- Connect in parallel all the +ve terminals of the IR LEDs on the cap using a wire and extend the wire out by about 10 cm. Solder the open end of this wire to any +ve connection point on the base that comes after the power button like the +ve terminals of the IR LEDs on the base or to the IN+ of the 360 MINI Buck converter.
- Take four BC547 transistors and four 10K resistors and wire them together with the -ve terminal of the IR LEDs on the cap as seen in the circuit diagram.
- Connect the base of all transistors to the RX (GPIO3) pin line of the ESP-01 on the custom-made socket through the 10K resistors.
There will be 3 wires connecting the base to the cap :-
- Wire 1 : +ve power connection to all the IR LEDs +ve terminal
- Wire 2 : -ve power connection to the emitters of all transistors on the cap.
- Wire 3 : Signal wire - from RX (GPIO3) of ESP-01 to the base of all transistors.
COLLECTING THE SIGNAL CODES FROM DIFFERENT IR REMOTES
In this step, we will be collecting the raw signal data from the remotes of all the devices we wish to automate. An IR remote transmits a signal by sending out pulses of infrared light that represent specific binary code. These codes represent different commands like power ON/OFF, volume +/- etc. Once we collect the raw signal data, we will be using this data to reproduce IR signals using our device on receiving voice commands and automation procedures.
- Connect the TSOP38238 IR receiver to the node mcu as seen in the above circuit diagram. Then connect the node mcu to your computer using a USB cable.
- Open the Arduino IDE. Install the "IRremoteESP8266" library from the Arduino library manager and then open and upload the "read_ir.ino" code attached in this step to the node mcu.
- Once the code is compiled and uploaded, open the serial monitor.
- Point each remote towards the IR receiver and start pressing the buttons you wish to add one by one like the power button, volume buttons, mute, etc.
- Each time you press a button, you will see a set of numbers appearing on the serial monitor.
- Copy the raw data line from the serial monitor and paste it somewhere safe like the notepad app. For each set of data, make sure you note down which remote button gave that particular data, for example, TV power, TV volume up, TV volume down, AC Power, Sound system INPUT, etc so that you won't be confused later on.
We will be using these signal data later on in the main Arduino code of Turtle IR to reproduce these signals.
Downloads
PROGRAMMING THE ESP-01
- Wire the ESP-01 to the TTL programming module as seen in the attached circuit diagram and plug it into your computer.
- Open Arduino IDE. Open the Arduino code file "turtle_ir.ino" attached to this step.
- Enter your wifi SSID and password in the code (where it's highlighted in yellow in the 8th picture ).
- From Line 14 in the Arduino code, you will see the raw IR signal data entered for different remote buttons. Replace these raw signal data with the ones you collected from your own remotes in the previous step. Make sure that you enter the correct data corresponding to the button names. You can give these buttons your own names or add new buttons, but make sure you change names, add buttons and make necessary changes throughout the whole code.
- This code has 20 buttons set as that was enough to automate my living room, but you can easily add more buttons if required. In case you need more than 20 buttons, add new devices in the code as you can see in the red circle (8th picture), and then create new buttons and assign them the raw signal data you collected.
- Once you are satisfied with the code, upload it to the ESP-01
- Remove the ESP-01 from the TTL module and insert it into the socket inside our device.
Downloads
CLOSING UP THE DEVICE
Once the coding is done and the ESP-01 is inserted into the socket, place the cap on the base making sure that all 3 wires connecting the base to the cap are carefully tucked inside.
There are 4 holes provided on the cap for screwing it to the base. Use the tip of the hot soldering iron to carefully burn off the vinyl sticker covering these holes so that the screws can be inserted easily.
Use four M3 10mm flat head screws to attach the cap to the base. Be careful not to tighten it too much as these are 3D printed parts.
Once it's done, press the power button to switch on the device and wait 10 seconds for the device to connect to your wifi.
SETTING UP THE APPLIANCES ON THE ALEXA APP
Once the device is connected to wifi, we can start setting up our device on the Amazon Alexa app. Follow these steps to do so:-
- Open the Alexa app and click on "Devices" on the bottom right.
- On the Device window, click on the "+" symbol.
- Select the "Add Devices" option.
- Then click on "Lights" and select "Others".
- Click on "DISCOVER DEVICES".
- After searching for a few seconds, you can see the devices appear. These devices will have the names you have assigned in the Arduino code as we saw in the previous step.
- Click on these devices one after the other to finish the configuration setup.
CREATING YOUR OWN AUTOMATION PROCEDURED ON THE ALEXA APP
Once the device is set up, we can straight away start giving basic voice commands like "Alexa, switch on TV", "Alexa, switch off projector" or "Alexa, switch on the Air conditioner every day at 8 PM" etc or directly use buttons on the Alexa app to control these appliances.
In order to automate and control multiple devices with a single command or situation, we have to create routines in the Alexa app which can be triggered based on a voice command, Time, or a condition.
For understanding setting up these routines better, we will take the example of automating the home theatre setup. Usually, for setting up a home theatre, we have 3 appliances to control - the Projector, DVD player, and the 5.1 sound system. (In the demonstration video I have not included the DVD player because I usually download movies on my laptop and plug in my laptop using an HDMI cable thus no need for the DVD player. But the steps below include the DVD player as there are many people who use DVD players to watch movies)
So here, when we say "Alexa, Movie time ", first we want Turtle IR to automatically switch on the projector, sound system, and DVD player, then set up the correct HDMI port on the projector's source menu, Adjust the sound system volume, etc. To do this follow the steps below:-
- Open the Alexa app and click on "Routines" from the "More" window
- You will see 3 steps to create a routine:-
- (A) Routine name : You can give any name to your routine
- (B) When this happens : What triggers the routine? For example- a particular voice command, a time, a signal from an external smart device or sensor, etc.
- (C) Add action : The procedures and actions to be followed when the above trigger is encountered.
- Click on the "+" symbols and add the necessary details for each of the 3 steps.
- First, we give a name for the routine. It can be any name you want.
- Second, select the kind of trigger you want. In this case, I have selected the Voice trigger which is activated when I say the phrase "Alexa, movie time"
- Finally, we set the actions in the correct order as seen in the 4th picture:-
- So when I say "Alexa, Movie time", first Alexa responds through the eco device by saying "Setting up cinema "
- Then the projector device power is set to "ON". This action commands the Turtle IR to reproduce the IR signal that switches on the projector.
- Similarly, the "DVD player" device power is set to "ON".
- The "sound system" device power is set to "ON".
- Then I added a waiting period of 15 seconds because the projector takes 15 seconds to power on and load after receiving the IR signal to switch on.
- Then the "source mute" device is set to "OFF". This is because the "source mute" device can do 2 separate actions:- Mute Projector speakers (When set to ON) and Select the projector HDMI Source (when set to OFF). These are all customizable in the code.
- When Turtle IR is commanded to change the projector source, it is programmed to automatically reproduce the source, OK, and navigation button's signals of the Projector's IR remote to select the required source. Thus it takes around 5 seconds to complete this process and hence we set a 5 second waiting period as the next action.
- Then the sound system volume (SS Volume) is set to "ON" which commands the Turtle IR to produce the IR signals to increase the volume. (When set to "OFF" volume is decreased).
- Volume adjustment takes around 5 seconds, so we add a 5-second wait as the next step.
- If the amount of volume increase is not enough, you can keep repeating the previous 2 steps as you can see in the picture.
- And finally, I have added a response from Alexa that tells me "It's ready, enjoy the show" which also serves as an indicator that the setup is over.
- Once all the above steps are done, save the routine. And from here on, all you have to say is "Alexa, movie time" and all the home theatre appliances will be automatically set up.
Similarly, you can set up any number of automation routines which can be anything from switching things ON or OFF in combinations based on a time or voice command to changing appliances settings like temperature or volume based on conditions or other smart home devices.
TESTING
Once everything is set up, It's time for testing.
NOTE: INFRARED LIGHT IS NOT VISIBLE TO NAKED EYES, BUT YOU CAN USE YOUR SMARTPHONE CAMERA OR ANY OTHER CAMERA TO SEE THE IR LIGHT EMITTED FROM THESE LEDs. THIS IS ALSO A GOOD METHOD TO CHECK IF YOUR TV REMOTE OR ANY OTHER REMOTES ARE WORKING OR NOT.
Once the device is powered on and connected to the Wi-Fi, view the device through a camera screen while giving out voice commands to Alexa. You will see all the IR LEDs on the device flickering on receiving different commands. Check the same for all different commands. All the IR LEDs send out the same signals simultaneously so that the appliance can receive the signal despite being located anywhere around our device.
After making sure all the signals are being produced, place Turtle IR somewhere in the middle of your room and start testing it with the appliances.
CONTROLLING APPLIANCES FROM ANYWHERE ON EARTH
One of the best features of the Alexa app is that it's not compulsory that the amazon echo device and the smartphone with the Alexa app have to be connected to the same wifi network. This means we can control the Amazon echo device along with the TURTLE IR and other smart appliances connected to this echo device from anywhere in the world with a smartphone having the Alexa app and connected to any other wifi or data network connection.
We can either speak to the smartphone Alexa or use the app buttons to control the home appliances or run automation procedures or routines. This comes in handy in situations like preheating or cooling your home before coming back from work or switching off appliances if you forgot to do it before leaving home, to switch off the home TV from your place of work to prevent your kids from spending too much time in front of it, or switching on the TV or Radio for your grandparents back home who are not familiar with the modern remotes, etc.
With the combination of Turtle IR and the Alexa app, there are numerous automation possibilities. You guys can easily modify the code and add more features as per your liking. As a future scope, various sensors can be built into the device to completely automate certain appliances without having to give voice commands.
In case you guys have any doubts or need help with something regarding this project, feel free to ask in the comments or dm me in the Instructables inbox. Thank you