PROGRAMMABLE REMOTE-CONTROL With TOUCH SCREEN DISPLAY

by 2020Trebor in Circuits > Electronics

11732 Views, 218 Favorites, 0 Comments

PROGRAMMABLE REMOTE-CONTROL With TOUCH SCREEN DISPLAY

IMG_2748_Lead-in.jpg

This instructable provides the information needed for you to build a compact, touch screen, Infrared, remote-control unit that can be easily programmed with control codes cloned from your existing remotes.

Notice- C2 was shown with incorrect polarity. Drawings have been updated to show correct polarity.(30Mar22)

Features

  • Compact
  • Programmable
  • Touch screen display
  • 21 “On-Screen” buttons
  • Built-in rechargeable battery
  • Battery charge indicator
  • Auto-OFF

Why ?

I started this project for several reasons, the most significant being that the remote-control unit for my multimedia receiver is beginning to fail. Several of the heavily used buttons are intermittent and many of the receiver’s functions are only accessible by using the remote. Reason number two is that it takes three (3) remote-control units just to watch TV! The TV remote, cable box and sound system remotes are each required. Oh, not to overlook the DVD remote-controller so that would make four (4) remote units. Finally, I thought this would be an excellent project to learn a bit about Arduino micro controllers, writing a “Sketch” (the operational program) and how IR (InfraRed) remote-control units work, all new to me.

 

Fortunately, I found some excellent information that allowed successful completion of this project. The authors of the Arduino libraries used to compile the remote-control Sketch provide good background information that helped greatly in getting things to work correctly. My build has now been in constant use for several months.

I would like to mention at this time, this is my first attempt at preparing an instructable. One can only read so many instructables on how to prepare/write an instructable then you have to just jump in. So, here I am, getting my feet wet.


Please read this caution before getting started

The success of this project depends on remote-control protocols being supported by the Arduino IR2Lib library used to compile the sketch. The current version of the IR2Lib library seems to have support for a large number of equipment manufacturers but there is always the possibility that an IR remote-control device you have is not supported. The authors of the library do have a technique for handling “raw” control data if there is no standard protocol support available but using this “raw” data technique is not within the scope of this Instructable.

 

The best advice I can offer to avoid disappointment is-

  1.  Install the Arduino IDE software and the libraries as described in Step-1.
  2.  Build the simple IR Receiver breadboard as described beginning at Step-3.
  3. Test the remote-control units you wish to clone by following the procedure described.

The example “Dump” sketch provided with the IR2lib library should give a quick answer about support for YOUR remotes. You may have to try 2 or 3 button presses to get a successful result. I suspect the IR (infrared) receiver is sensitive to electrical noise and, perhaps, ambient light.

Note-when pressing the button on your remote, do it firmly but quickly! It seems that some remotes send a special “repeat” code after the desired function code if the button is pressed for too long of a duration. This may cause “Unknown” protocol results.

Once you know the protocols used by your remotes are supported, you can continue with confidence that you will have a successful project. If you only get a protocol type as “unknown”, well, it will take an adventurous individual to try and work with the “raw” data and is, perhaps, the topic for a new Instructable but not within the scope of this project. The IR2lib library does provide examples and instructional information about using "raw" IR codes.

Summary

I have tried to provide thorough documentation with many diagrams, photos and lots of comments within the Sketch (program code) but this project might be quite a challenge for a beginner. I recommend reviewing the steps that follow and read through the Sketch (bp_remote.ino) since the comments in the Sketch provide a lot of information.

Reasonably good soldering skill will be required primarily because of the small size of components and the compact nature of the project.

 

In this instructable you will:

  • Download and install the Arduino IDE (Integrated Development Environment)
  • Download and install libraries for use by the IDE
  • Obtain control codes from your existing remotes using a breadboarded IR receiver
  • Edit/change the sketch provided to use YOUR control codes
  • Program an Arduino Pro-Mini MCU (Micro Controller Unit) using a USB to TTL serial adapter
  • Slightly modify and use an inexpensive LCD display with touch screen
  • Build a simple circuit that provides auto power OFF and drives the IR LED transmitter
  • Interconnect all of the components and modules
  • Print an enclosure using a 3D printer using the STL files provided

 

Several pre-assembled modules are used to simplify construction and wiring. However, there is one custom circuit module that you must assemble. This can be done using a perf-board or by making your own PCB (Printed Circuit Board). Detailed drawings are provided for both of these methods.

 An assembly drawing for this circuit shows where to place the components on a typical perf-board. Also provided is the artwork to make your own PCB (printed circuit board) if you choose. There are several sources for information about making a PCB at home. Several “Instructables” (do a search for “PCB” within the “Circuits” group) as well as many on-line videos such as this video and others offer techniques for getting the job done. Do an on-line search for “how to make a PCB at home”. Of course, the PCB approach is optional. Point to point wiring on a perf-board will work nicely if the provided layout is used. Remember, it must fit into the remote-controller’s case. During the development of this project, I first used a perf board with point to point wiring but decided to add PCB fabrication to my learning challenge. My final assembly did make use of a home-made PCB.

The STL files needed to make the enclosure (case) using a 3D printer are provided. It should be reasonably straight forward to get good results with a reasonably well tuned printer. Because of the overall small size of the enclosure and the need to accommodate several pre-assembled modules, dimensional accuracy is important. I have included the 3D design files for the enclosure. This should allow the adventurous builder to further customize the enclosure and perhaps improve upon the styling. The design was done using SketchUp Make 2017 (free) and the objects were drawn at a scale factor of X10. The SketchUp files could be edited using the web-based editor provided by Trimble.com or imported into some other 3D design tool such as Tinkercad and others

Supplies

Bill of Materials

All of the component parts used to build and program the remote-control unit are readily available from multiple sources such as Amazon.com, AliExpress.com, Banggood.com, DigiKey.com and various sellers at ebay.com. I have provided links that may be helpful in obtaining these parts. Some of the suppliers only offer the parts in quantities much greater than needed for this project, I suspect it is an effort to be cost-effective. DigiKey.com does permit ordering items as single quantities but pay attention to the shipping cost. If choosing this supplier, I would suggest placing a single order for the items they offer.


Arduino Pro-Mini (ATMEGA328P, 5 V, 16mHz, with Bootloader*) (Quantity = 1 pc)

or this one.

*Caution-For convenience it is important to buy the Pro-Mini WITH the bootloader installed. The ebay vendor linked here did provide a Pro-Mini with the bootloader. A vendor selling on Amazon provided a Pro-Mini that did NOT have the bootloader installed even though they advertised it did.

 FTDI USB to TTL Serial adapter (Used to program the Pro-Mini) (Quantity = 1 pc)

or this one.

Note-It is possible to use an Arduino Uno to serve as a USB to TTL serial adapter. This Instructable was prepared using the device linked above but here is a link to an instructable that describes a method for using an Arduino Uno and here is another link.

TP4056 (Battery charging & protection module)  (Quantity = 1 pc)

MT3608 (DC/DC Boost Converter) (Quantity = 1 pc)

2.4” TFT LCD Display Screen with Touch Panel for Arduino UNO (MEGA2560) (Quantity = 1 pc)

Wire, 26AWG, silicone insulation, stranded/multi-core (Quantity = 1 kit)

LiPo Battery, 3.7V, 1100mAh, 30x49x7mm (Quantity = 1 pc) (Note)

or this, or this.

Note-This is the link to the battery I purchased however it appears to no longer be in stock at this time.The battery from the alternate link should fit into the enclosure as designed. The battery compartment is 32mmX49.8mmx16mm. The battery must fit within this space.

Battery Connector (Quantity = 1 pc)

SOT23-3 Adapter board (used for AO34xx transistors) (Quantity= Note)

Note-The link provided is for a sheet of 50 adapters. Only 4 are needed.

Diode, switching, 1N4148 (Quantity=1pc, Note)

Diode, Schottky, 1N5817 (Quantity=1pc, Note)

Note-This link is for an assortment of diodes, the 1N4148 & 1N5817 are included.

AO3415, P-Channel, logic-level, MOSFET (Quantity=1pc)

or this link only need 1pc

AO3400, N-Channel, logic-level, MOSFET (Quantity=3pcs, Note)

Note-The link provided is for 100 pcs. Only 3 are needed.

Resistor, 22 Ohms, 1/4 W, 1%, metal film type (Quantity = 2 pcs **Note)

Resistor, 4700 Ohms, 1/4 W, 1%, metal film type (Quantity = 2 **Note)

Resistor, 100K Ohms, 1/4 W, 1%, metal film type (Quantity = 2 **Note)

Resistor, 330K Ohms, 1/4 W, 1%, metal film type (Quantity = 1 **Note)

Resistor, 10K Ohms, 1/4 W, 1%, metal film type (Quantity = 1 **Note)

**Note-This link is for an assortment of resistors. It includes the values listed here.

Infrared LED Emitter, 940nm, 5mm diameter (Quantity = 2 pcs, Note)

Infrared receiver, VS1838B, 38kHz (Quantity = 1 pc, Note)

Note- this link is for a “kit” that contains both of the infrared items listed above.

Tactile Push-button Switch (Quantity = 1pc)

Perf Board, ~50mm x 70mm, 2.54mm hole pitch (quantity = 1pc)

Capacitor, electrolytic, 1uf @ 16V or greater (Quantity = 1pc)

Capacitor, electrolytic, 3.3uf @ 16V or greater (Quantity = 1pc)

Capacitor, electrolytic, 100uf @ 35V or 50V (Quantity = 1pc)

Capacitor, ceramic, 0.1uf @ 25V (Quantity = 1pc)

Note- The capacitor size is important, it must fit the breadboard layout. The links provided here will get capacitors that fit the breadboard but there are many other sources such as Amazon.com, ebay.com and others. Digi-Key.com provides the datasheet for sizes if you want to be certain of a proper fit.


Tools and Supplies


  • Computer with USB port
  • Arduino IDE software (free download available at here)
  • USB type-B to USB type-A cable (available here)
  • Mini USB type-B to USB type-A cable (available here)
  • 6 pcs. female-to-female, Dupont style jumper cable
  • Needle nose pliers
  • Craft knife
  • Hot melt glue or equivalent to hold parts in place
  • Masking tape or equivalent
  • 3D printer or access to one to make the enclosure components
  • Multi-meter/Voltmeter (A very basic unit can be purchased here)
  • -Soldering iron with small conical tip
  • -Solder
  • -Solder wick
  • or
  • -Solder sucker
  • -Wire strippers
  • -Shrink sleeve
  • -Tweezers

The 7 -items listed above are available as a kit that can be purchased here for about 11 USD.

I have not personally used this kit and cannot comment on its quality.

Now might be a good time to download the sketch that will be used and edited.


Install the Arduino IDE and Some Libraries

The Arduino IDE (Integrated Development Environment) and several Arduino libraries must be installed before we can continue. I have provided some links to tutorials that could help if you are unfamiliar with the Arduino IDE and installing libraries.

The Arduino IDE software is free and can be downloaded from here-

Instructions for installing the IDE on a Windows computer can be found here-

Instructions for installing the IDE on a Macintosh computer can be found here-

Additional details on using the Arduino IDE can be found here-

For help with installing libraries please refer to this tutorial-


The following libraries are needed for our project-

Adafruit-GFX-Library- https://github.com/adafruit/Adafruit-GFX-Library

Adafruit_TFTLCD_Library- https://github.com/adafruit/TFTLCD-Library

Adafruit_TouchScreen- https://github.com/adafruit/Adafruit_TouchScreen

IRlib2- https://github.com/cyborg5/IRLib2 **

** I suggest installing the IRLib2 manually just to be certain all of the individual library folders are placed correctly within the file system.

Proceed as follows-

Assuming you have downloaded the IRLib2-master.zip file using the link provided and it is located in your “Downloads” folder, navigate to this folder and extract all of the files (Windows users right-click on file and choose Extract All…) A new folder will be created with a name “IRLib2-master”. Open this folder and you will find yet another folder named “IRLib2-master”. Now, open THIS folder to reveal 5 folders and 6 additional files. These 5 folders are the actual IRLib2 libraries. Copy these 5 folders and place each of them individually into the Arduino libraries folder. The result should be as follows-

 Arduino / libraries / IRLib2

Arduino / libraries / IRLibFreq

Arduino / libraries / IRLibProtocols

Arduino / libraries / IRLibRecv

Arduino / libraries / IRLibRecvPCI

When installing the IDE on my computer I used the default “Windows” settings. The Arduino libraries folder was located as shown here --->     C:\Users\BobP\Documents\Arduino\libraries


Build the IR Receiver

IR_Receiver_Wiring_Diagram_r1.jpg
IR_Receiver_Breadboard.jpg

Use the VS1838B IR receiver, 3pcs.Dupont style, male-to-male jumper wire, an Arduino Uno, USB cable and computer with USB port to build the IR receiver breadboard. Use the diagram and refer to the photo as a guide. This receiver will allow you to record the “codes” from the remote-control units you are going to clone.

In the next step we'll go through the details on how to use the IR receiver and the IDE software to record the remote control signals of the remote control units you want to "clone".

NOTE- IF YOU DO NOT HAVE AN ARDUINO UNO, GO TO STEP-34 FOR DETAILS ABOUT USING THE ARDUINO PRO-MINI TO BUILD THE IR RECEIVER BREADBOARD.

 

Set Up the IDE Software for IR Receiver

In this step we are going to setup the IDE software to work with the Arduino Uno. Using a Serial Monitor, built into the IDE, we will be able to record the IR codes being transmitted by your existing remotes. This data will be used to edit the bp_remote sketch so the new remote does what you want it to do.

First, Connect the USB cable from the Uno to a USB port on your computer. This is a good time to know (or find out) the port number that has been assigned by your computer to the attached Uno. On a Windows PC it will be referred to as COMx where the "x" is the port number.

Next, start the Arduino IDE program that we installed in Step-1.

Set Board Type to Be "Uno"

IDE_Select_UNO.jpg

Now, configure the IDE by setting the Board being used to be “Uno”

Select Tools / Board: / Arduino AVR Boards / Arduino Uno

Set the COM Port

IDE_Select_Port.jpg

Set the IDE Port to be the same number as that used by the Uno-USB connection. In my example the Port is showing as COM5. Your port number will most likely be a different number.

                Select Tools / Port / COM?   (The ? will be your port number)

Load the "DUMP" Example File

IDE_Select_Dump.jpg

From the example files provided with the IRLib2 library, select the “Dump” sketch. This is the sketch that will display the special control codes of the units you want to clone.

                Select File / Examples / IRLib2 / Dump

Your list of Examples will look different on your install of the IDE. Take note of the items highlighted with blue, these are the items to select.

Start the "Serial Monitor"

IDE_Select Serial-Monitor.jpg

Start the IDE Serial Monitor.

                Select Tools / Serial Monitor

A new window will pop up on the screen, this is the Serial Monitor.

Set Baud Rate

IDE_Select_baud.jpg

In the lower right corner of the Serial Monitor window there is a drop-down menu where you will select the baud rate being used by the Sketch. The “Dump” sketch is using a baud rate of 9600 so select this.

We now have something to look at so it is time to get some data and record it.

Get IR Code Data

Dump_Data.JPG

With the IR receiver setup as described, click on the Clear output button located to the lower right corner of the Serial Monitor window. It is important to have a clear monitor window to avoid confusion when recording the unique IR codes.

Using the remote that you want to clone, point it at the IR receiver and press the button for the function you want to program into your new remote. A lot of information will be displayed on the Serial Monitor screen. There are 3 data values sown on this screen that must be recorded. Refer to the screen shot above and take note of the items boxed in red. These are the data that will be used in YOUR new remote-control sketch. I suggest using the copy (Ctrl+c) and paste (Ctrl+v) function of the computer to copy the values from the Serial Monitor screen and paste them into a text file using any basic text editor. this technique should eliminate the possibility of errors.

Sample Data Sheet

Clone_Data-Chart.jpg

The picture above is a suggestion of how you could organize the recorded data from your remotes.

When we get to the part of the build where we edit/change the sketch to make it do what YOU want it to do, this list will provide all of the data needed. Step-9 provided the Information for the last three columns of the chart. The Button Name text is up to you to assign based upon the remote control function. In order for it to fit within the space allowed on the touch screen it must not exceed 10 characters. This data will be copied and pasted directly into the bp_remote sketch when it is time to edit it. Notice that the button numbering starts with “0” (zero). This is the way things are numbered when using arrays in an Arduino Sketch. We really don’t have to be concerned other than to remember to start at zero.


In the next steps you will start to build the components that go into the remote with the last step being editing the sketch with your unique data. I think you will find the task of editing the sketch to be pretty easy. There are a lot of comments and instructions written into the sketch to help you get the job done.

Let's warm up the soldering iron and start putting things together.

Modify the LCD Display Module

LCD_Mod-1.jpg
LCD_Mod-2.jpg

The LCD display will be modified by removing all the connector pins as shown in the pictures.

First, pry the plastic spacers completely off of the pins. Save these spacers. They will be used to help build the transistor assemblies in a future step.

Heat the pin with soldering iron and remove from circuit board using needle nose plies.

You may choose to use a solder sucker to clear the connection holes but this is optional. When it is time to connect the display, the solder in the connection hole can be heated and a tinned wire lead inserted.

Prepare the Arduino Pro-Mini

IMG_2786_Pro-Mini_Prep.jpg

In this step you will solder the right-angle connector to the Pro-Mini as shown in the picture.

This connector will be supplied with the Pro-Mini and is the ONLY supplied connector to be used. The connector will be inserted from the component side of the Pro-Mini PCB. This connector is used to program the MCU. It can remain in place and still fit into the enclosure. If you want to modify the remote codes at some future time, the connector will be available as soon as you pop the enclosure open.

Pro-Mini Wiring, Non-Component Side

Pro_Mini_Non-Component_Side.jpg

There are a large number of wires that connect the Pro-Mini to the LCD display. Also, several wires will connect the Pro-Mini to other modules. To aid in assembly and keep the wiring compact, the Pro-Mini will be pre-wired with “flying leads”.

Using the wiring chart below, connect 70mm long wires to the NON-COMPONENT side of the Pro-Mini circuit board. You will need 14 wires 70mm long and one wire 90mm long. Use the 26 AWG, silicone insulated, stranded (multi-core) wire.

In this step all wires will be inserted into the contact holes of the PCB from the non-component side. Connect wires only to the contacts listed.

Note-Connect 2 wires into contact hole 3*

Pro-Mini

  • GND  ------ (Make this connection at the GND point next to the RAW contact
  • 2
  • 3*   -------   ( 2 wires here )
  • 4
  • 5
  • 6
  • 7                             
  • 8                             
  • 9
  • GND   -------- (Use a 90mm wire, connect next to the Pro-Mini’s reset switch)
  • A0
  • A1
  • A2
  • A3
  • A4

In a future step these leads will be cut to a proper length.

Pro-Mini Wiring, Component Side

Pro_Mini_Component_Side.jpg

Using the wiring chart below, connect wires that are 70mm long to the COMPONENT side of the Pro-Mini.

Note- Connect 2 wires into the contact hole at VCC*

Pro-Mini

  • A5
  • 11
  • VCC* --- (2 wires here)

Prepare the 4 Transistors

SOT23_Adapter_PCB_Blank.jpg
IMG_2812_Crop_X2_APE.jpg

In this step, the MOSFET transistors are going to be mounted on the adapter PCB that is designed to allow SOT-23 case transistors to be used with a perf-board. Start by separating a row of adapters as shown in the diagram above. Keep two adapters together as shown.

Two “pairs” of adapter PCB will be needed. This will make assembly a bit easier.

Note that the adapter PCB is double sided with a different pattern on each side. Use the side that has the “longer” pads for mounting the transistor. The “other” side will have square pads.

 

Mount Q1 and Q2 to the Adapter

SOT23_Adapter_PCB_w-AO3415_photo.jpg
SOT23_Adapter_PCB_w-AO3415.jpg

 Next, carefully remove the AO3415 transistor from its packaging. Use tweezers to handle the device. Caution-It is small, and almost weightless.

Position it on the LEFT adapter PCB as shown here. Hold it in position so all transistor leads are centered on the adapter’s pads. Use the small, conical tip of the soldering iron to lightly heat one lead to hold the device in place. If the alignment is good, solder all leads to the adapter pads. If the alignment needs to be adjusted, having only a single lead tacked in place will permit easy re-alignment. 

Using a pencil or marker, label this adapter PCB “Q1”.

Next, mount an AO3400 on the RIGHT adapter of this pair. Mark this adapter PCB with “Q2”

Note-“Q2” is not shown in the diagram above.

Mount Q3 and Q4

SOT23_Adapter_PCB_w-AO3400x2.jpg

Using the second pair of adapter PCBs, mount an AO3400 to each one as described in the previous step.

Label the LEFT PCB as “Q3” and the RIGHT as “Q4”.

Next, wire “leads” will be attached to these two transistor assemblies.

Add Wire Leads to the Transistors

IMG_2851_Wires-in-spacer.jpg
IMG_2855_Adapter_W_Leads.jpg

The plastic spacers that were removed from the LCD display in a previous step will be used to help with this step. Two of the spacers have 6 holes, we will use these.

Using a length of AWG 22 solid, copper wire, cut 12 pieces each about 13mm (1/2”) long.

Insert a wire lead into each of the 6 holes of the plastic spacer (see photo). Push the wire into the holes until they are flush with the opposite side. Now, place the first transistor assembly onto the protruding wire. Solder the wires to the adapter PCB and trim off the excess wire. Remove the plastic spacer.

Repeat this for the second transistor assembly. Be sure to remove the plastic spacer

Note-The photo does not show the transistor or the solder. It is for illustration of procedure.

 This completes the preparation of the MOSFET transistors. They will be used in a future step when we assemble the Power Control breadboard/PCB.

Prepare the IR LED

IR-LED_Assy-2_flying-leads.jpg

In this step we are going to pre-wire the two IR LED that will be mounted into the end of the remote controller’s enclosure. The IR LED must be pre-assembled with flying leads since soldering close to the plastic enclosure could cause damage. In an effort to provide a compact enclosure there is not much extra space for wires and components so care must be exercised when preparing the IR LED assembly.

The diagram shows how the two LED will be mounted in the enclosure. The leads must be bent close to the body of the LED. Use the AWG 26 stranded wire and connect a 100mm length to each of the anodes and cathodes . The leads will be trimmed to a proper length when installed. Place a short length of shrink sleeving over the exposed conductors.

The IR LED will get connected to the Power Control breadboard/PCB in a future step.

TP4056 Connector

IMG_2861_TP4056-Connector.jpg
IMG_2863_Battery_Connector.jpg
IMG_2862_TP4056_Top-View.jpg

The LiPo battery connector will now be connected to the TP4056.

Trim the leads on the battery connector to be 40mm. Strip, tin and solder the leads of this connector to the NON-Component side of the TP4056 (see photo). Make certain that the red wire is connected to the B+ terminal of the TP4056 module and the black wire connected to B- .

Now is a good time to check that the polarity of the connector attached to the LiPo battery matches the polarity of the connector you just installed. The connectors are “keyed” and will only connect one way. Do not mate the connectors but align the “key”. Are the two red leads aligned? If not, the contact pins of the connector attached to the TP4056 will have to be removed and reversed.

 

Connection to the “OUT+” and “OUT-“ contacts will be done in a future step. These contacts should be empty at this point.

MT3608 Modification

IMG_2857_MT3608_w_Cap.jpg

A 100 uf capacitor will be added to the MT3608 DC/DC module.

The MT3608 is used to boost the LiPo battery voltage up to 5.1 volts needed to operate the Arduino Pro-Mini and the LCD display. This supply also feeds the InfraRed LEDs. These LED are pulsed at a fairly high current to provide increased range. The 100 uf capacitor is added to help supply this pulsed current to the LED. A 50 volt rated capacitor is used here because during setup of the MT3608 an output of up to 30 volts can be reached.

 The 100uf capacitor is mounted to the MT3608 as shown in the picture. Hot melt glue is used to hold the capacitor in place but any suitable glue can be used.

Place insulating sleeve over each of the capacitor leads as needed. I used the silicone insulation stripped from some of the AWG 26 wire.

Route the " - " (negative) lead of the capacitor to the VOUT- contact hole.

Route the " + " (posative) lead of the capacitor to the VOUT+ contact hole.

Note- Do NOT solder the capacitor leads at this time, just route the leads as shown.

Mount the Pro-Mini to LCD Display

Pro-Mini_Mount.jpg
IMG_2794_Pro-Mini_Mount-LCD.jpg

With the Pro-Mini pre-wired with flying leads, it is time to make connections to the LCD display.

Start by taping the Pro-Mini_Mount (from the collection of 3D printed parts) to the display module as shown in the photo. The Pro-Mini_Mount straddles the SD socket and is taped to it. This holds it in the proper position.

Attach a temporary label to each of the flying leads and then place the Pro-Mini into its mount as shown in the photo for Step-23.

Note- The direction of the right-angle connector on the Pro-Mini must be positioned as shown in the photo.

Spread the leads out so the Pro-Mini PCB sits on the support rail of the 3D printed mount. If needed, use a piece of tape to help hold the Pro-Min in place.

Wire the Pro-Mini to LCD Display

IMG_2789Pro-Mini_LCD_Wired.jpg
LCD_to_Pro-Mini_Wiring.jpg

Refer to the Pro-Mini to LCD Display wiring chart and connect the flying leads from the Pro-Mini to the assigned contacts of the LCD display. Refer to photo for an idea of how to route the wires (I am sure you can do a neater job than I did). Trim the wires to a convenient length allowing a slight amount of excess to provide strain relief. The fit into the case will be TIGHT.

Wiring Chart Pro-Mini to LCD Display

Pro-Mini --------------- LCD

  • 9             -->        LCD_D1
  • 8             -->        LCD_D0
  •                               
  • 7             -->        LCD_D7
  • 6             -->        LCD_D6
  • 5             -->        LCD_D5
  • 4             -->        LCD_D4
  • 3*          -->        LCD_D3
  • 2             -->        LCD_D2

 

  • VCC*    -->        5V
  • GND     -->        GND (70mm wire)
  • A0          -->        LCD_RD
  • A1          -->        LCD_WR
  • A2          -->        LCD_RS
  • A3          -->        LCD_CS
  • A4          -->        LCD_RST

 

*Note-Use one of the two wires connected to this Pro-Mini contact.

At this point your assembly should look like the photo above (hopefully neater).

Set it aside. The remaining 4 wires will be connected later.

Assemble the Power Control Breadboard/PCB

Controller_Schematic_R1.jpg
PWR-Ctrl_Ckt_PCB-Traces_R9.jpg
PWR-Ctrl_Assy_Component-ID_R9a_X10.jpg

Diagrams and photos show the placement of the various components that go into making the Power Control breadboard module. This is going to be a pretty big step but I trust you will find the diagrams and parts list helpful. Component placement when using a perf-board to build this module is the same as the PCB assembly. Use the PCB circuit traces diagram along with the schematic diagram to add the needed point-to-point connections on the perf-board. The components are positioned so that they match the 2.54mm hole spacing of the perf-board. If you choose to make your own PCB, I have included the artwork for the circuit traces I used in my build of the progrmmable remote. I used the "iron on" approach to transfer the laser printed traces on to the copper clad board. The pdf file has multiple images on a single page and should be dimensionaly correct.

Note- For convenience, the three capacitors and the four transistors, Q1 – Q4, should be mounted last.

First assembly step is to install the 8 resistors, 2 diodes and the jumper. (Jumper is next to Q1)

  • R1                          10K
  • R2, R3                   100K
  • R4                          330k
  • R5, R6                   22 ohm
  • R7, R8                   4.7K
  • D1                          1N4148
  • D2                          1N5817

 Next, install the three capacitors and four transistors (see the notes below).

  • C1                          0.1 uf
  • C2                          1 uf
  • C3                          3.3 uf
  • Q1-Q2                  AO3415-AO3400
  • Q3-Q4                AO3400-AO3400

 

Note- The two electrolytic capacitors, C2 and C3, are mounted to the breadboard/PCB with their leads bent at 90 degrees to maintain a low profile. Depending on the size of C1 that you use, it may also need to be mounted in a horizontal manner laying across the top of R2.

Note- The position of Q1 is next to R1 and the jumper. It is the AO3415 P-Channel MOSFET.

Note-If the perf-board you are using happens to be double-sided, put some tape between the perf-board and the backside if the transistor assembly to insulate the circuit traces of the adapter PCB.

The transistor assemblies should drop into the 6 holes of the perf-board/PCB. The adapter PCB should sit flat against the perf-board/PCB surface. Solder the 6 leads of each transistor assembly to the perf-board/PCB.

Pre-wire the Power Control Breadboard/PCB

PWR-Ctrl_Assy_Component-ID_R9a_X10.jpg

With all of the components mounted to the Power Control breadboard, we will add some flying leads to be used during the final assembly. Refer to the Power Control Breadboard assembly diagram and attach AWG 26 stranded copper leads using the approximate lengths indicated. They will be trimmed later.

 

Connection Point ------------  Length   

  • PB1 & PB2                         50mm each
  • +Vin                                    130mm
  • Gnd                                    100mm (use pad next to Q2)
  • +Vout                                100mm
  • GND                                  100mm (use pad that is close to the 5.1V pads)
  • 5.1V                                   100mm

Note- The Pwr On/Off control circuit design (slightly modified) is courtesy of Mosaic-Industries.com

MT3608 Voltage Setup

IMG_2867_MT3608_Setup-1.jpg
IMG_2868_MT3608_Setup-2.jpg

The MT3608 DC/DC voltage boost module is capable of a maximum output of 28 volts. If this voltage was applied to the circuitry of the remote-control unit it would be damaged.

In this step, the MT3608 is going to be adjusted for an output voltage of 5.1 to 5.2 volts. This MUST be completed before connecting to any other circuitry.

  1. Rotate the voltage adjustment potentiometer 15 turns COUNTER-CLOCKWISE (yes, a full 15 turns, it is a multiturn potentiometer. There is no “hard stop” at the end.
  2. Connect the “OUT+” of the TP4056 module to the “VIN+” (plus) of the MT3608.
  3. Connect the “OUT-“ of the TP4056 to the “VIN-“ (minus) of the MT3608.
  4. Connect a multimeter/voltmeter to measure the output voltage of the MT3608. Select a voltage range suitable for a voltage level of 30 Volts.
  5. Connect a 5 Volt source to the micro-USB connector of the TP4056 module. (Note)
  6. The voltmeter should now read about 28 Volts DC. Rotate the voltage adjustment potentiometer on the MT3608 module in a CLOCKWISE direction to reduce the voltage output. Continue adjustment until the output voltage reading is 5.1 to 5.2 Volts.

Note- This power source for this setup could be a cell phone charger or use a “micro-USB to USB” cable and connect to the USB port of a computer.

Note- Make changes slowly. When you think the voltage is set correctly, remove the 5 Volt power source and wait for the voltmeter to read 4 volts or less. Once again, connect the 5 Volt source to the TP4056 and check the output voltage of the MT3608. Readjust if necessary. This must be set correctly to avoid damaging the Arduino Pro-Mini and the display.

Apply a small dab of hot melt glue to the potentiometer adjustment screw to prevent it from being changed. (Nail lacquer works nicely as well…my preference)

Some Comments About Final Assembly

Here are a some comments about the enclosure, installing the modules in the enclosure and possible post-processing needed by the 3D printed parts.

  1. The holes in the end of the enclosure for the IR LEDs may need to be enlarged slightly. The intended size is 5mm. If the fit is too loose, use a VERY small amount of hot melt glue. It is a tight fit in that area because of the LCD display.
  2. The compartment that houses the pushbutton is intentionally a tight fit. However, you may have to use a file or sandpaper to remove any printing artifacts and slightly enlarge the space. Do not force the pushbutton. The post between the switch leads may break.
  3. Check that the 3D printed “Pushbutton Extender” (shown in red in the diagram) slides easily. Clean up this 3D printed part if necessary.
  4. Notice the two holes through the bottom of the enclosure where the TP4056 module is located. These holes are aligned with the charge indicators on the TP4056 module. It is intended to have a short length of 1.75mm, clear filament inserted into these holes to make the indicator LED visible. Red=battery is charging, Blue=battery charge is complete. It is likely that these holes will need to be enlarged slightly. Adding the clear filament to these holes is optional.
  5. The TP4056 module will slide into position. Use the 3D printed part “TP4056_Retainer” to hold the module in place. The retainer will slide into the slots behind the module. This is the only module that is “locked” in place as it will receive force when the charging cable is attached.
  6. The MT3608 module simply drops into place. It should be a “friction fit” but it is a good idea to use a small amount of hot melt glue to hold it firmly. Addition of the hotmelt glue should be the very last thing done.
  7. The “Pwr Control” breadboard/PCB will likely be the last module anchored in place with some hot melt glue. One side of the breadboard will slide under the small tabs on one edge. The other edge should be held in place with the hot melt glue.
  8. The LCD display requires special consideration before you secure it in place with some hot melt glue. It is best to have the firmware installed and the LCD display illuminated before the it is secured. You will want to align the illuminated part of the display with the opening in the case. Unfortunately, I found a bit of variation within the several LCD display modules I have. Sometimes the manufacturer of the display has not taken enough care to position the active LCD display unit on the modules PCB. A bit of positional tweaking may be required.

Wire It Up

Power & Inter-Module Wiring-4.jpg
Remote_Assy_R20a_Top-Bot_side-by-side.jpg

As much preparation work that could be done has been completed, it is time to put it all together.

In a previous step you made use of the 3D printed “Pro-Mini Mount”. Now is the time to get the remaining parts printed if you have not already done this. The final wiring will be done by placing the various assemblies into position within the enclosure to determine the proper length of the interconnecting wires. Several of the interconnecting wires are now flying leads that will be routed, cut to length, stripped, tinned then soldered to the proper module contact point.

The diagram shows details of the connections between the various modules and components such as the push button and the IR LEDs..

Note- The connections between the Arduino Pro-Mini and the LCD display have already been completed. These details are not shown in this diagram.

Complete the wiring between the TP4056, MT3608, push button, IR LED and the breadboard before moving on to the wires that go to the Pro-Mini. When routing the wires keep in mind that both the top and bottom have wired components and the enclosure will be closed like a book. 

The last wiring step will be to connect the flying leads from the Pro-Mini to the other modules in the enclosure. Position enclosure's top and the bottom side-by-side as shown in the diagram. This will help route the wires keeping them as short as is practical.

The technique used, as previously noted, is to have everything positioned as shown, pick a route for the wires and then cut them to a suitable length, strip, tin and then solder to the module. Lift the module out of the enclosure when soldering to prevent damage to the enclosure.

At this point you should have a completely wired remote control unit with all components in place except the LCD display has not been secured. I suggest holding the display and the Pro-Mini in place with some tape or a few elastic bands around the enclosure’s top. It will be convenient to leave the enclosure’s top and bottom in a side-by-side arrangement while the next step is completed.

Set Up the “Serial to TTL USB” Adapter

IMG_2875_FTDI-MCU.jpg

Set up the “Serial to TTL USB” adapter as shown on the diagram.

1) Connect the 6 leads of the adapter to the 6 leads of the right-angle connector on the Arduino Pro-Mini. It should be a “straight-thru” connection when using the items listed in the bill of materials.

Pro-Mini ---------- Adapter

DTR -------------------- DTR

TXO --------------------- RX

RXI --------------------- TX

VCC --------------------- VCC

GND --------------------- CTS

GND --------------------- GND


Note- the Tx of the adapter will connect to the Rx of the Pro-Mini, likewise, the Rx of the adapter will connect to the Tx of the Pro-Mini.

2) Set the voltage selector on the adapter to the 5V position.

3) The LiPo battery should not be connected and do not have anything connected to the TP4056 micro-USB connector.

4) Use a Mini USB type -B cable and connect the adapter to a USB port on the computer.

Next, we will setup the IDE to work the Arduino Pro-Mini.

Setup IDE for Pro-Mini

Select_Pro-Mini.jpg
Select_5V_16Mhz.jpg
Select_AVRISPmkII.jpg
Select_Port.jpg

This time we will set up the IDE to work with the Pro-Mini CPU. The procedure is similar to that used when setting up the IR receiver. Refer to these screen shots and follow the steps listed below.

Using the IDE menu-

1) Select- Tools / Board: / Arduino AVR Boards / Arduino Pro or Pro Mini

2) Select- Tools / Processor: / ATmega328P(5V, 16MHz)

3) Select- Tools / Programmer:"AVRISP mkII"

4) Select- Tools / Port: / COM?

For the COM Port, replace the ? with the port number your computer is using to communicate with the Serial to TTL USB adapter.


Editing and Uploading the Firmware

General Comments


This is the part of the project that requires you to be creative because I cannot say exactly what to do but I have provided guidance. The specific remote control codes that will be used in the final sketch are totally dependent on the remote control units YOU own and want to clone. The sketch that is provided, “bp_remote.ino”, contains the core of what is needed to create a 21 button display, drive the infrared transmitter LEDs with the control pulses and turn the power off after a period of inactivity. The sketch, as provided, is fully operational and I use it every day in my programmable remote control unit. However, the button label text that will be displayed, the specific protocols needed and the controlling codes are unique to my Sony sound system, my Vizio TV and my Samsung cable box. Your job is to replace these items with values that are proper for YOUR systems. I think you will find the sketch has enough comments to allow you to make the changes with confidence (you can’t break anything). Most values that must be changed are in easy-to-read tables (arrays) or in descriptive lists.

 Note-I have included in the comments of the sketch the phrase ***CHANGE*** wherever you need to do some editing. The comments included will assist with the edits.

The one area where editing the sketch could get tricky to understand is the “Protocol” portion (located immediately after the included libraries) so I will comment a bit more.

Manufactures of electronic equipment will create their own “IR codes” for controlling their equipment. It appears there is no universal standard to say, to turn “ON” a piece of equipment. So, the authors of the IR2lib library have invested considerable time and effort to understand and decipher the controlling codes used by many manufacturers (but not all).

Notice at the beginning of the sketch there is a list of “#include” statements. This is the area where you will specify the protocols needed for the IR controlling codes your remotes will be using.

Here are the 3 protocols I needed.

#include <IRLib_P01_NEC.h>

#include <IRLib_P02_Sony.h>

#include <IRLib_P05_Panasonic_Old.h>

 

The “NEC” protocol is used by my Vizio TV.

The “Sony” protocol is used by my Sony receiver.

The “Panasonic_Old” protocol is used by the Samsung cable box.

 

The protocols used by the remotes you are cloning might be different or you may need several more than the 3 protocols I needed.

So, here are some rules-

1.     The LOWEST numbered protocol MUST be FIRST in the list of protocols being included . The NEC protocol has a number of “P01” so it is, of course, the first in the list. The library authors say that the remaining protocols can be in any order…I like to keep them lowest to highest.

2.      When editing the “bp_remote.ino” sketch to meet your needs, comment out (add // at the beginning of the line ) the protocols I have entered, assuming that you do not need them. I have included them as active so that you can successfully compile the sketch “as is” and confirm the display is working before you begin editing.

3.      The protocols you will need were listed when you built the IR receiver and recorded the data values specific to your remotes.

4.      Be careful about spelling and capitalization when entering the protocol names and code values.

5.      Bailout, the IRLib2library authors have provided a catch-all entry that includes all of the supported protocols wrapped up into one "include". It is recommended to not use this I suspect for memory usage reasons. The catch-all is  #include <IRLibAll.h> . You will notice that it is present in the bp_remote.ino sketch but it is commented out. I'll mention that this catch-all WAS used in the DUMP sketch the we ran in order to read your remotes. It kind of makes sense that they had to use this.

 Some Additional Comments

There are comments within the sketch provided that give suggestions about dealing with the slight variations you might find between different LCD displays. The values dealing with the touch screen are most likely to need minor tweaking to make it perfect (or close enough). These comments should help if tweaking is really needed.

Now is the time to start the Arduino IDE program on your computer and open the “bp_remote.ino” sketch. Make certain that the following libraries have been previously installed-

  • Adafruit-GFX-Library
  • Adafruit_TFTLCD_Library
  • Adafruit_TouchScreen
  • IRlib2

Sources of information about programming the Pro-Mini using the IDE and the FTDI serial to TTL USB adapter can be found at this link as well as here.

Drivers for FTDI serial to TTL USB adapter, if needed can be found at this link.


 

Edit_and_Upload Sketch

Screen_Text_sm.jpg

Armed with the list of remote control codes you recorded in Step-9 and 10, let's get into the editing and uploading a program that is customized to your needs.

Let's get started.

In Step-30 we set up the IDE to work with the Pro-Mini that we connected to the computer in Step-29. Now we will upload the bp_remote.ino sketch to verify our remote is working as expected.

1) Start the IDE software.

2) Load the bp_remote.ino file. (It is linked in the SUPPLIES section located at the beginning of the instructable).

3) Upload the sketch by selecting Sketch / Upload or by pressing Ctrl+U.

When the upload has completed the display screen should look like the photo.

4) Tap any one of the "buttons" using your finger or the stylus that came with the display. The text associated with that button should briefly appear at the top of the screen as a confirmation the command was executed. This touch display is a "resistive" type and requires a bit of pressure to be activated (that's why the manufacturer supplies a stylus with the display). Most cell phones use a capacitive type touch screen that do not require any specific amount of pressure.

Note-When the remote is powered through the serial to TTL USB adapter the "auto power off" feature will not be operational. This is only applicable when operating from the battery.

With confirmation that the sketch was uploaded successfuly we can move on to editing the sketch to meet the needs of your specific remote control units.

Changing the text that appears within each button might be a good place to start, just to get a feel for editing. This section should begin at line 131. You will notice that it is an array that somewhat mimics what the actual screen looks like. Read the comments in the sketch and make some changes.

I suggest that you save your edited sketch with a new name, say, "my_remote" for example. Again, upload your edited sketch and admire your new display screen.

Now for the tricky part...including YOUR protocols (about line 24), entering the hex values that represent each new button code (around line 148) and changing the "send codes" (around line 408). I use the word "around" because as you add the protocols you need, the line numbers will increase a bit. When you think you have the sketch edited to meet your needs, save it and then do a final upload.

Final Steps

You have your edited sketch uploaded and now it is time to do the final assembly.

Remove the adapter cable from the Pro-Mini and re-seat it into the 3D printed mount. If needed, use some tape or a drop of hot melt glue to help hold it in place.

Check the wire routing to make sure it will not interfere with closing the case. The space between the Power Control breadboard and the display will be very tight when the case is closed. It is a good idea to put a some hot melt glue over the push button to hold it in position. Also, if the MT3608 module appears too loose in its compartment you can add a bit of tape to the "bump" in the end of the compartment to keep it locked in place. Finally, the Power Control breadboard will need to be held in place using some hot melt glue on the side closest to the battery compartment.

The wires leading to the LEDs must be held close to the sides of the enclosure. I used some hot melt glue in the corner of the case to keep these leads from interfering with the Pro_Mini's reset button (notice the hole in the enclosure's bottom that gives access to the reset). Now it is time to connect the battery. Place a small piece of some sort of foam or spongy material on top of the battery to keep it from rattling in the case.

Close the case by first engaging the tabs on the end with the LEDs and then, gently sqeeze the top and engage the remaining tabs. When you get down to the end where the battery is located, it might take a bit more "push" on the very end of the top to engage the final tabs.

Hook up your charger and charge the battery.

Notes About Operation

When the battery charger is connected the red indicator light on the TP4056 module will glow. It can be seen through the hole in the bottom of the enclosure.

When the battery is fully charged a blue indicator will glow, again seen on the bottom.

To turn the remote ON, simply push and release the button on the side of the unit.

The remote will automatically power OFF after 25 seconds of inactivity (can be changed in firmware).

To force the unit OFF, press and hold the power button for 4 seconds then release.

In the rare case the unit experiences a "glitch", you can reset the MCU through the access hole in the bottom of the case.

There is also an access hole in the side of the case that will allow the MT3068 voltage to be adjusted. Do not adjust this unless you have a voltmeter connected to monitor the voltage. Also, keep in mind that the voltage measured here is subject to the 25 second auto-OFF feature.



Using the Pro-Mini As IR Receiver

Pro-Mini_IR_Receiver_breadboard.jpg
IMG_2877_Pro-Mini_IR-Rcvr.jpg

In Step-2 an Arduino Uno was used to breadboard the IR receiver. However, if you don't happen to have spare Uno about, the Arduino Pro-Mini purchased to build this project can be temporarily used to build the IR receiver. The pins used on the Pro-Mini are exactly the same as used with the Uno, VCC for +5 Volt power, GND, and pin 2 for the signal. In the photo you will see that I used mini-clips to connect the leads of the VS1838 IR receiver to the Pro-Mini contacts. You could also tack solder a short length of wire to the leads of the VS1838 and then tack solder to the Pro-Mini.

Notice also that the "right-angle" connector has been added to the Pro-Mini and that the Serial to TTL USB adapter is being used. The setup of the IDE must reference the Pro-Mini MCU and not an Uno.

All of these items are fully documented in these steps.

Complete Step-1 as written then,

goto to step-12 and add the right-angle connector to the Pro-Mini. We have to do this anyway so doing it now is OK.

Connect the Serial to TTL USB adapter to the Pro-Mini.

Connect the VS1838 IR receiver to the Pro-Mini.

Use the mini USB cable and connect the adapter to the cumputer's USB port.

Now, complete the procedure outlined in Step-29 and Step-30 (this sets up the IDE for the Pro-Mini).

Now that the IDE is setup and the IR receiver is connected-

Go back to Step-6 and continue with collecting the data needed.

Not quite as neat as using the Uno with the solderless breadboard but it will work just as nicely.

Closing Remarks

For my first instructable this is quite lengthy but I wanted to provide enough details so someone who is a relative novice can achieve success. I think the enclosure could use some asthetic improvements by someone skilled in 3D modeling. I intentionally used simple surfaces (they're flat) so it would be easier to modify. Trying to keep cost reasonably low led to the use of the 2.4" display. I see design improvements being the use of a larger display and having a multi-page selection for the buttons. My prototype had circuitry and code for a variable display brightness but I found that the display backlights are not wired the same from module to module and I could not get the needed information to make this work...it would have been nice.

I hope you have success and find this project useful.

If you would like to modify the enclosure to improve its styling, I have included the 3D design files for you to use. They are drawn at a scale of X10 and were done using SketchUp.