DCC 2 Board Controller: Add a Display, Keypad and Jogwheel

by Computski in Circuits > Arduino

66 Views, 1 Favorites, 0 Comments

DCC 2 Board Controller: Add a Display, Keypad and Jogwheel

20240824_163029.jpg

Follow up project to DCC Controller, 2 boards, 1 PSU, no soldering!

In this project we add an LCD display, keypad and jogwheel. This allows direct control of locos and turnouts on the hardware unit, rather than using the Wifi-and-mobile phone option. You will need to solder these components.

Components List

You will need

  1. 1602 LCD display with an I2C back pack
  2. 4x4 matrix keypad
  3. I2C GPIO expander PCF8574 to fit the keypad
  4. HW-040 jogwheel
  5. Several dupont 5 way connector cables
  6. Purple board (available on ebay)
  7. Header pins, 47uF 16v capacitor, 1k resistor and 1n4148 diode for the purple board.

The purple board is available on www.ebay.com.au as item number ID-116301963744

I have a limited number of these as of 2024-08.


Solder Up the Purple Board

20240824_163029.jpg
2D_PCB1_2024-08-24.png

The purple board is a daughter board that sits on top of the stack. Bottom board is the WeMos D1R1, middle is the L298 motor driver and the purple board sits on the top and connects to the LCD display, 4x4 keypad and jogwheel.

First, solder up the purple board. If you are using the HW-040 jogwheel, you need to fit D1, C1 and R1. (note C1 is actually 47uF and not 220uF as stated in the schematic). C1 and R1 create a delay at boot, so that the jogwheel does not interfere with the arduino boot sequence. D1 ensures the hardware reset button on the motor board or the D1R1 board will work correctly.

If you use right-angle headers for the HW-040 take-off and the I2C bus take-off then this helps with height of the stacked boards if you want to fit them into a box. You could also lie C1 on its side.

R2,3 and 4 are also 1k, and are not required unless you use the other type of jogwheel found on ebay (it's a free component, not soldered to a PCB. You also need to change global.h to reflect it is a non HW-040 type).

Solder Up the Keypad and Backpack

20240823_230104.jpg
PCF8574.jpg

The 4x4 matrix keypad is available on eBay and Aliexpress. Be careful when soldering it, because the edge connector is a single sided PCB and very fragile. It is easy to lift a track by overheating it. It also does not seem to take solder well so use plenty of flux. As you can see in the picture, the soldering on it is horrendous.

I2C GPIO expander PCF8574 is also available on eBay/Ali. It has 9 pins which conveniently align with the 10 in the keypad. The hole nearest the D-key is left clear (see picture). Note in the picture how it is mounted with the pin tips only just coming through the keypad board. This will allow the keypad to be mounted through a hole in a box without the PCF8574 fouling on the case.

The I2C address of the PCF8574 can be set using the jumpers on the board. Set the jumpers as shown in the picture. Remember the LCD backpack, this PCF8574 device and the INA current monitor (if used) all must operate on different addresses, and these must match those set in the software. When the unit boots, if you have it connected to a serial port monitor, you will see it searching for and reporting the I2C addresses that it finds.

Solder Up Display and Backpack

1602 display with backpack.png

The 1062 display board is available on the internet, it often comes with an I2C backpack but usually you need to solder this on yourself. The pins of the backpack should not protrude too far through the display-board else they will foul the case when you mount the display.

Some backpacks can have their I2C address set with solder blobs or with jumpers. You may be fortunate and the I2C address matches that in the software, else you will need to change the address in global.h or modify the hardware jumpers. As mentioned the arduino board will report all the I2C addresses it finds when it boots.

Plug All Modules Together and Boot

20240824_162851.jpg

The I2C link to the display board needs a 4 way dupont cable. The jogwheel needs a 5 way dupont cable. Take care when plugging the purple pcb into the stack because it does not make use of the two lowest pin positions. i.e. it does not cover D1 and D0 positions.

Boot the system; you should see the display light up, you should be able to press buttons on the keypad and also turn the jogwheel and see things happening.

If not, then check connections, check polarity of connections, check solder joints and lastly check the serial output from the arduino when it boots. how many different I2C addresses did it find, and do these correspond with the addresses set in software?

Emergency Stop and MODE Buttons

keypad-estop.png
keypad-mode.png

The software has been updated to recognise certain dual-key presses. Pressing 1-2 together will activate EMERGENCY STOP. Pressing 3-A together will activate MODE. Together these allow you navigate the various menu screens in the software.

The hardware based alternative is to wire a pushbutton between P6 on the backpack and ground for ESTOP, and between P7 on the backpack and ground for the MODE button.


See build.pdf document under the ESP8266 DCC controller main project for more details.