OpenEnergyMonitor Community

Initial build: connecting screen backlight and buttons

I don’t yet have an Energy Monitor - The emonPi Shield has arrived and other component parts will be here shortly.
I’ve found posts which mention the Hardware Diagram, but I cannot find the diagram myself. The best I’ve seen is this diagram on the Wiki

followed by a connection diagram for the GPIO

I’m looking to install an LCD screen, back-light and button(s) as per the usual emonPi in order to see system messages at start-up etc. All other use will be from a remote login.

I understand that the EA Dog 128x64 LCD screen connects to the I2C pins on the GPIO.

The button connects to GPIO-23 (pin 16) I think. But I guess requires a pull-down resistor?

However this other diagram has two buttons connected differently

Is that because he’s modified the code?

And finally, there’s the screen backlight. I’m happy to simply built a constant-current driver to light it.
But is there a “standard” way in which it should be connected such that the backlight can be turned on/off or dimmed under software command?

Many thanks

Do you mean the emonPi circuit diagram and PCB layout? You needed to go nearly to the bottom of the Resources (Wiki) page where you found the other diagram, to “Open-Hardware Design Files” then if you want something readable, follow the link to Github. You need Autodesk Eagle CAD (free, but you need to register) to view the files.

There is no interconnections diagram for the emonPi, I took it up with Glyn a long time ago and he refused to provide one.

The emonPi switches (not dims) the backlight under a software controlled timer.

Thanks @Robert.Wall - yes it was the interconnections diagram I was looking for.
I can stop now that I know it doesn’t exist!

There do seem to be two switches implemented in the emonPi. They are referred to in this post, with one of them being called ‘recessed’:

But alas, the GPIO diagram only refers to the one button (pin 16).

The backlight is also a mystery to me still.
If there is a software command/time-out to turn it on/off, then there must be a pin assigned to that function somewhere on the Pi-board itself.

This post references some changes being made to the code for the LCD backlight time-out

but alas there is no comment to state where is the pin that gets toggled.

I feeling a bit daunted broaching such a mundane hardware question here. The Forum seems to be well populated by coders - which I’m not. :open_mouth:

Update. I’ve followed your suggestion of the link to GitHub @Robert.Wall and found references to an LCD button on the schematic.

To my (pleasant) surprise, the I²C pins for the LCD panel and the ‘LCD-button’ have been brought out to a 6-pin header on the emonPi pcb. So I can now stop looking for them on the Pi board itself!

And there in the lower-right corner of the emonPi board is the second (recessed) button I was looking for. So this is all good news.

If I keep reading, I might even surprise myself and find a reference to a backlight! :bulb:

The best you can do is look at the PCB circuit diagram. The pushbutton on the front panel of the emonPi goes via the 6-pin header (Pins 5 & 6, JP2 - I²C, square A5-B5). The remaining connections there are to the LCD. The LCD backlight is software controlled and part of the LCD assembly itself - there are only 4 connections, GND, 3.3 V, SDA & SCL (Pins 1 - 4 respectively).

The recessed pushbutton is on the PCB (squares D3 - E4), and is the reset for the Pi, it goes via the '328P - in on D8 and comes out again on D5 to GPIO 17.

[Written while you were posting.]

Thanks again @Robert.Wall - Yes, I’m happy with connecting push-button and LCD screen to JP2 header.

I’ve got the documentation on the EA DOGM lcd screens used in the pre-built emonPi. But that makes no mention of the backlight being controlled in any way from the same I²C connections as the panel itself.

In fact the backlight LEDs are brought out on independent pins, and the EA document states:

That strongly suggests that the backlight needs its own supply to drive it. Page-8 even has a wiring diagram for the multi-colour (rgb) backlight option, showing the current limiting resistors which must be added.

I’ll order up a DOGM screen and a couple of backlights so I can have a better look at the physical layout.

In that case, the LCD you’re looking at is not the same as the one on my emonPi. The only BOM I have is for V1.2 (we’re now on V1.6) and that gives the type as HD44780LCD-1602.

The 1602 screens are well known to me. I have a whole drawer of them for Arduino work. But they’re a text-only LCD with 2-lines.

I found several references here in the Forum to the EA DOG graphical screens, including this discussion in the archive from 2013.

If all the system messages I need to see on start-up, and the ability to configure IP-address etc are accessible from a 1602, then I’m happy to start with one of those.

Normally, and if you are using the SD card image, there’s no need to see any start-up messages, and you actually configure the IP address via your web browser once emonCMS has started.

If you need any more than that, surely you are looking at adding a full-size screen and keyboard?

1 Like

If you want to explore the I2C comms with the display, the details are in the code at

Specifically which is called by

But the best way to see system messages is to connect by ssh from a proper computer.

That’s what I was looking for. Thanks @Steve
That circuit schematic matches the 1602_I²C driver boards which I already have here.

Yes, I’ll connect with a ‘proper computer’… I have a few here running Ubuntu. That makes them ‘proper’ doesn’t it? :wink:
But with a 1602-LCD attached I might at least see if the emonPi build is working first before I try to connect to it.

Are you specifically mentioning because it’s not already part of the standard build on the SD card I’ve just received?

For the benefit of others reading this later, here’s a source for those LCD_I²C driver boards from World Chips on AliExpress. £3 for 5 incl shipping.

And the 1602 LCD screen itself is here at £2.40 each

These low prices obviously come with the proviso that you’ll be waiting a couple of weeks for delivery from China.

Only mentioned to help you find your way. Yes it’s part of the standard build, in /home/pi/emonpi/lcd.

1 Like