Want to control a color message display from anywhere with your smart phone?
This simple project lets you update a 16x2 LCD with a color backlight from the NetIO smart phone app. The message can be changed, the backlight can be set to any RGB color, and the display can be turned on and off - all remotely. It's made with an Esquilo development board, a Newhaven serial LCD, and the NetIO control app.
Wiring it up is easy. I used a breadboard, but the circuit is trivial so putting it in other projects should be no problem.
The connections are listed below. Make sure you use current-limiting resistors between the Esquilo and LCD backlight pins!
Esquilo Pin LCD Pin Resistor
1 (UART0 TX) J1:1 (RS-232 RX)
GND J1:2 (RS-232 VSS)
5V J1:3 (RS-232 VDD)
2 (PWM0:CH0) J3:2 (Backlight Red) ~33 Ohm
3 (PWM0:CH1) J3:3 (Backlight Green) ~120 Ohmode>
4 (PWM0:CH2) J3:4 (Backlight Blue) ~120 Ohm
The embedded code running on the Esquilo is pretty straight-forward. The Newhaven serial LCD protocol to control what message is displayed is simple and runs over a UART, while the backlight RGB pins are controlled with pulse-width modulation. The Esquilo has libraries for both, so I just created a UART instance, a PWM instance, and defined a handful of functions that the remote app needs:
Because Esquilo's embedded web server automatically exposes these functions as RESTful HTTP endpoints, I didn't need to do anything else to make them callable from the NetIO application. See the code section below for the full program listing.
While the protocol to control the serial LCD is very straight-forward, I still ran into a few minor issues coding it up. In one case, I screwed up the logic wrapping the message at the first line boundary. But I was able to track down and fix it quickly by setting a couple of breakpoints and stepping through the code.
NetIO is a smart phone application that makes creating remote control apps really easy. You develop your interface using their online graphical UI-Designer tool and download them to the NetIO app installed on your phone. Here's a screenshot of the tool while building the Remote LCD interface.
NetIO lets you hook HTTP calls up to change handlers on each of these widgets. When a button is pressed (e.g. 'send') or the backlight color selector is changed, they generate a call to the Esquilo. This fits right into the HTTP end-points that Esquilo dynamically generates from the functions defined on the embedded side.
Here's an example setting for the backlight selector:
And for display message updates and clear:
And for the power switch:
When you're done designing the interface and hooking up the remote change calls, you save the project in UI Designer, and sync it to your mobile app. You can also export and import interface projects in JSON format, so you can put it in source control and share it with others. See the Github repository in the code section below for directions on importing and using the Remote LCD interface.
I plan to add a standard web app control client in the future. This should be easy and require no embedded code changes, as the API is all HTTP.