Setting up a Grid Insight Ledbetter Board with a Raspberry Pi and Node-RED

In my last post I documented the process of getting Node-RED up and running on a Raspberry Pi. In this post I’m going to provide complete instructions for getting a Grid Insight Ledbetter Board, which can read electricity and water meters, set up and running with a Raspberry Pi and Node-RED, uploading meter readings to a remote server.

1. Get a Raspberry Pi

There are all sort of places to get a Raspberry Pi, and any Raspberry Pi will do. But a good kit to buy, which includes everything you need, is the Cana Kit Ultimate, which, at this writing, sells for $89.00 CDN and includes the Pi, a power supply, a wifi dongle, HDMI cable, a breadboard, ribbon cable and T-connector for wiring up the Ledbetter board, and a nice plastic case.

2. Set up the Raspberry Pi

It’s easiest to get up and running if you have an HDMI-capable display, USB keyboard and mouse to connect to the Pi, as well as a wired Ethernet connection to the Internet, at least until you get it set up for wifi.

Plug the ribbon cable into the GPIO slot so that you’re ready to install the Ledbetter Board on the breadboard in a later step.

Insert the SD card into the Pi, connect the HDMI cable, the Ethernet cable, the keyboard and the mouse, and then connect the power supply.

When prompted, install the “Wheezy” distribution from the NOOBS installer.

Once this is installed, and the Pi has rebooted after installation, you’ll end up at the Linux command line, where you can then install a curses-based wifi configuration tool:

sudo apt-get install wicd-curses

You can also set the password for the “pi” user, the time zone and the hostname by running:

sudo raspi-config

Once you’ve done all that, and rebooted the Pi, you can set up wifi with:


You’ll see a list of wifi SSIDs: find yours and cursor down to it and then cursor-right to set up the wifi password and any other options; be sure to check “Automatically connect to this network” so that this network is connected to automatically every time the Pi reboots. Press F10 to save your settings, then ENTER to connect to the wireless network. The result should look something like this, with your new IP address displayed at the button of the screen:


Take note of the IP address your Pi was assigned (mine was, and then, from another terminal on the same network (i.e. your laptop or desktop connected to the same wireless network):

ssh -l pi

(where you substitute the IP address you were assigned for the You’ll be prompted for the password for the “pi” user: enter the value you selected earlier.

I found the wifi to be more reliable when I modified the power-saving settings:

sudo nano /etc/modprobe.d/8192cu.conf

and paste in:

# Disable power saving
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

I also found that I needed to disable the ability to login to the Pi via the serial port to get the GPIO connection to the Ledbetter Board working:

sudo nano /etc/inittab

and then comment out the line:

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

3. Install Node-RED

From the command line of your Pi, once you’ve done all of the above and are logged in, you’re ready to install Node-RED:

sudo dpkg -i node_latest_armhf.deb
mv node-red-0.9.1 node-red
cd node-red/
npm install --production

The last step will take a while to complete; be patient.

Next install the serial port node for Node-RED:

npm install serialport

And then configure Node-RED to automatically start on bootup:

wget -O /etc/init.d/node-red
sudo chmod +x /etc/init.d/node-red
sudo update-rc.d node-red defaults

Finally, reboot the Pi so that all of the settings take effect:

sudo reboot

4. Install the Node-RED Workflow

Once the Pi has rebooted, you should be able to visit this address in a web browser on a device connected to the same wireless network (substitute the IP address of your Pi for the

Click on the “hamburger” icon in the top-right of the display, select Import and then Clipboard and paste in the following, substituting the path to a remote REST interface URL for PATH-TO-WEBSERVER-SCRIPT. Place the workflow on the Node-RED canvas with a click, and click DEPLOY to save the workflow.

      "name":"parse scm messages",
      "name":"make url for posting to database",
      "func":"msg.url = "https://PATH-TO-WEBSERVER-SCRIPT";\nmsg.url += "?serialnumber=" + msg.payload.serialnumber;\nmsg.url += "&metertype=" + msg.payload.metertype;\nmsg.url += "&reading=" + msg.payload.reading;\nreturn msg;\n",
      "name":"route on message type",

      "type":"http request",
      "name":"post to remote mysql database",

      "type":"serial in",
      "name":"Ledbetter Board",


Here’s a little PHP script that you can use as an starting point for your own archiving of data to a MySQL database:


if ($_GET) {

    $db = new mysqli("HOST", "USER", "PASSWORD", "DATABASE");

    /* check connection */
    if ($db->connect_errno) {
        printf("Connect failed: %s\n", $db->connect_error);

	$query = sprintf("INSERT into readings (serialnumber,datestamp,metertype,reading) values ('%s','%s','%s','%s')",
				strftime("%Y-%m-%d %H:%M:%S"),
	if (mysqli_query($db, $query) === TRUE) {
		header("HTTP/1.1 201 OK");
	else {
		printf("INSERT failed: %s\n", $db->connect_error);

5. Set up the Ledbetter Board

Plug your GPIO ribbon cable adapter into your breadboard as in the photo below.

Snap the pigtail connector for the antenna into the Ledbetter Board, and the slide the board into the breadboard, noting which side is “up” (you can tell by reading the label screen-printed onto the board)

The Ledbetter Board has 4 pins, only 3 of which are used: you need to wired up:

  • Pin 1 on the Ledbetter connects to the 3V3 power pin on the Pi
  • Pin 2 on the Ledbetter connects to GND (ground) on the Pi
  • Pin 4 on the Ledbetter connects to RXD on the Pi

Here’s what my setup looks like when it’s wired up:

Ledbetter Board Setup

6. Watch it Work

Power off the Pi from the terminal:

sudo shutdown now

Then plug the ribbon cable from the Pi into the breadboard connector, and power the Pi back on.

Visit Node-RED in your web browser as above, and click on the Debug tab in your workflow, and you should start to see SCM messages flowing in:

Node-RED working with Ledbetter Board

You should also see your database back end filling up with reports.


There are many moving parts in this setup, so many opportunities for things that could go slightly wrong. Things that went wrong for me in my various setups that you might want to check:

  1. Are the proper Ledbetter Board pins wired to the proper GPIO pins? Make sure you’ve got “top” and “bottom” on the board properly oriented: the “top” is the side that has “Ledbetter Board” stencilled on it.
  2. Are you lined up with the proper GPIO pins on the breadboard?
  3. Check the “Debug” window in Node-RED: errors in the workflow nodes might be causing problems. Especially check your server-side script to see if it’s receiving messages properly and without generating errors.