Burb Catcher

Avatar

sdg.etienne24
2020-11-17 15:47
Last Edited 2022-08-21 20:27

Burb Catcher

Introduction

Overarching Mission: In general, Smart Meters are expensive. And this cost is often doubled by the cost of the modem the meter uses to connect to the Head End system. At time of writing in South Africa (2019), you can easily pay one to three thousand Rands for a GPRS/3G modem to connect the meter to the Head End. This places a constraint on the market size of Smart Metering in general.

In this forum, we want to explore various ways to leverage cheap and reliable off the shelf components, like single board computers (e.g. the Raspberry PI or Orange Pi Zero), GPRS/3G USB dongles, and relatively inexpensive electronic components, to bring down the communication cost of smart metering, and in the process increase the size of the smart metering market in general.

Opportunity: Elster (Honeywell) has inexpensive meters that communicates via IrDA every second, sending the reading and the meter serial number. A100C and A1100. This solution is superior to Pulse Counting, because the calibrated reading and meter serial number is not in doubt, and is guaranteed to correspond exactly to the numbers a human can physically read on the physical meter.

Problem: The meters cannot be multi-dropped, since they just all keep on talking continuously. And to connect them each with its own modem is too expensive, both in the cost of the data, and also in the capital cost of the modem

Solution: We created a device called 'Burb Catcher' through which you can connect multiple meters to one modem. This drastically reduces the cost of implementation.

Basic device description: The 'Burb Catcher' is a device that can connect up to 64 meters on a single internet connection. This means every meter does not need to have its own modem to make online billing possible. This will drastically reduce the cost of implementing remote metering when the meters are physically close to each other, e.g. in the same box or room.

 


Device Composition

SN74151AN Multiplexer

We use an 8-to-1 data selector chip, called a multiplexer to select between the incoming transmissions from all the meters. Therefore, it is clear that each chip can only 'read' 8 meters. So, you might ask 'How do we read 64 meters off this device?'. The answer is simple, we cascade 8 multiplexers to a 9th multiplexer chip. Take a look at the schematic:

We know this might seem like a lot, but let's take it step by step.

Essentially each chip can connect up to 8 meters, as seen in the schematic on the M1-M8 inputs. Since this is an 8-to-1 chip, every chip has 1 output. 

*A very important thing to note is that ON EVERY M-PIN (M1-M8) OF THE 'INPUT' CHIPS WE NEED A 10KOhm RESISTOR that needs to be pulled high in order to transmit the packets. 

What we can see from the schematic is an example of 3 chips that is connected to one end chip with a method called cascading. To do some basic math first, every chip can take 8 meters and have 1 output. Therefore 8 chips mean 8 x 8 = 64 meters and 8 outputs. We use 1 final cascading chip (Chip 4 on schematic) which then selects between the 8 incoming signals from the other 8 chips (in the schematic it is used to select between only 3 chips for the sake of simplicity). To clarify, there is no meters connected to the 'Final' chip.

Be advised that the configuration of the 'input' chips and the cascading chip is not the same. The input chips need 10K Ohm resistors in front of each meter input whereas the cascading chip MUST NOT have resistors on its M1-M8 pins.


Next, we need to talk about the data selection process. Let's take a look at the truth table for the 8-to-1 multiplexer:


We firstly need to understand how the chip selects between the incoming data streams from all 8 meters. Remember, all the meters 'talk' at once. Therefore, we are not turning the meters' communication on or off, we are simply able to choose when we want to listen to each meter and for how long.

On each chip you will notice A, B and C pins. These pins are used to select between the 8 M-pins. To explain it in simple terms, there are 8 combinations in the truth table that can decide the output. Look at the first one for example. If A, B and C are low (L) (0V) the output that we will receive is the input from meter 1 (M1). In simple terms 0 0 0 selects the first meter. If both B and C is low but A is high, like in the second row, we have 0 0 1, which will select the incoming channel from meter 2 (M2) and so on.

We use the Y-pin for output from the chip.

The W-pin is used for inverted output, which we do not use.

The chip has 2 ground pins namely G and GND. These are ground pins for the 2 respective outputs. We bridge these 2 pins and connect them to ground.

Each chip also has a 5V power pin (VCC).

We join all the A, B and C selector pins of all none-cascaded chips respectively which then populates 3 GPIO pins on the Orange Pi Zero (More info on GPIO pins later).

The final cascaded chip's selectors are connected to 3 other GPIO pins on the Orange Pi Zero. Having A, B, and C on 0 0 0 effectively this causes all the Meter 1 (M1) pins for example to be sent through to the M1 - M8 inputs of the cascaded chip. The Selector of the cascaded chip then separately decides which incoming signal to pass through as output.

Finally, we could identify 3 different types of this 8-to-1 multiplexer, namely 74151, 74LS151 and 74HC151. They all work exactly the same and any one of them can be used. The prices of these chips are subject to change, but as of March 2019 the 74151 chip retails for only R1.59, which is the cheapest of the lot. http://www.communica.co.za/Catalog/Details/P4220782674.

 

For any further information on the SN74151AN chip, please have a look at the following link:

http://www.ti.com/lit/ds/scls701b/scls701b.pdf


          

In this photo you can see the basic layout of the design of  one 'input' chip (left) and one cascading chip (right).

PLEASE NOTE:

  1. THE RESISTORS ON EACH METER INPUT PIN SHOULD BE 10K Ohm
  2. THE RESISTORS SHOULD BE CONNECTED FROM LIVE (5V) TO THE INPUTS
  3. THE A, B AND C SELECTORS ARE MANUALLY CONNECTED TO GROUND TO SIMULATE 000.

Troubleshooting LED's:

If you want to troubleshoot if the chip is sending output to the Orange Pi Zero, it is preferred to put an LED on the W-Output (Inverted output we are not using) to see if the chip is sending the packets out of the Tx (Y-output) as an LED on the inverted output will have no affect on the signal from the Y-Output. This is shown on the right hand side (green LED)

If you want to troubleshoot if the Meters on input (M1-M8) are working, we can advise installing High-Bright LED's in series with the 10K Ohm resistors as they will not affect the signal of the meters. This is shown on the left hand side (Red High-Bright LED).



In this video you can see the red LED flickering. This indicates the pulses coming from the meter. As you can see, on the A, B and C switches, we connected them to ground. This indicates that all 3 switches are pulled 'low' and therefore according to the truth table we have 0 0 0. This is why we put the meter on pin M1 which is the pin that is live when the selectors are on 0 0 0. Pin G and GND are bridged. 

The green LED indicates that the cascading chip is transmitting outputting readings to the Orange Pi Zero's Rx-port. There is a connection between the Y-output of the right hand chip and the M1-input of the cascading chip.

It is important to pull the inputs from the meter high with 10k Ohm resistors, so that the High state is properly accepted by the multiplexer, otherwise it won't work right. When we had a 1k Ohm resistor connected to Low (As in this video), it looked as if the output would be fine but when we tried to decipher it, it was bad information.

It is important to realize, that the meter communication ports work like a transistor. It doesn't pull any line to High Level. That is why the + side on the A100C should be connected to 5V (the input pin of the multiplexer) , and the - side should be connected to ground. 

The selector lines do not have to be pulled down with a resistor, since the Orange Pi Zero will pull it High or Low with its GPIO pin.


 Elster A100C:


The Elster A100C meter we used for this project has been chosen because of cost considerations.

It is a single-phase meter. It has 6 terminals. The Main two terminals on the left is Live and Neutral, and the Main two terminals on the right is Neutral and Live (it is specified inside the meter cover).

The two little terminals above them, is + on the left, and - on the right. These two are the ones connected to the Burb Catcher.

Please note, that all A100C meters are not created equal. It should have '2400 baud' written on it - some meters have pulses instead of an IrDA packet, and those that does not have '2400 baud' written on them, is therefore not useful for this project.

If it is an IrDA capable meter, that sends the bytes every second, it actually sends it through an infra-red LED on the left of the meter, marked IrDA Tx (which is invisible to the human eye). IrDA is short for 'Infra-Red'. Usually, with these meters, there is also the open collector output through the two small terminals (+ and -) as described above, which we use with the Burb Catcher, but there has been an IrDA meter on my desk that does not export the same data capability to the same small terminals, in spite of having '2400 baud' displayed. We found that with that build, the + from the Burb Catcher must still be connected to the little terminal on the left on the meter, but the - from the Burb Catcher must be connected to the Neutral terminal (terminal 2, second from the left, same one where the Incomer Neutral is connected). It appears that for that build, the little terminal on the right of the meter is actually for pulses, and the little terminal on the left still does IrDA functionality. 

 

 The bytes sent from the meter approximately every second is as follows:



The format of the data packet is as follows:

NOTE: For multi-byte binary data items, the data is transmitted in little-endian format - the least significant byte first, the most significant byte last.

For BCD data items, the most significant byte is transmitted first, with the most significant decimal digit in the most significant nibble.

For ASCII data items, the left-most character of a text string is transmitted first.

The table below describes the format of the billing, security and status data.

Any data in fields marked Reserved can be ignored.




Byte Total: 104



Orange Pi Zero:

Next, we will discuss the role that the Orange Pi Zero plays in Burb Catcher.

 

Follow the following link to view the technical specs and description of the Orange Pi Zero:

http://www.orangepi.org/orangepizero/

 

You will need the following software to configure your Orange Pi Zero:

 

 

 

Please follow the following in-depth guide on how to setup your Orange Pi Zero:

https://lucsmall.com/2017/01/19/beginners-guide-to-the-orange-pi-zero/

 

Take note of the following important notes:

  • The Orange Pi Zero needs to be powered by a 5Vdc 3A power supply in order to function properly. 
  • Armbian Jessie operating system needs to be upgraded as soon as you are able to login! Upgrade the firmware before starting with any configurations. Using the following commands: apt update followed by apt upgrade.
  • A ground pin of the Orange Pi Zero MUST be connected to the same ground as the Burb Catcher
  • To make a serial connection to the Orange Pi Zero. you HAVE TO disable flow control in Putty

 

 The following images describes the layout of the Orange Pi Zero GPIO Pins:



We are using GPIO pins 1, 0, 3, 15, 16 and 14 to control the switching of the Burb Catcher. Please note that GPIO pin number and PA number is different. To connect the output from the Burb Catcher to the Orange Pi Zero, we use the UART 1 RX pin, which is GPIO pin 199 on the GPIO pin layout.


The following scripts are used to configure the Orange Pi Zero after the OS has been installed and updated:

Script on startup:


This script 'enables' the GPIO pins on the Orange Pi Zero that we want to be using.

 

Script to pull a specific GPIO pin low:



Script to pull a specific GPIO pin high:


Command to see the meter communication on the UART 1 Rx port (GPIO pin 199):

screen /dev/ttyS1 2400


Below is a link to our SD image for the Orange Pi Zero:

http://www.pnpscada.com/wiki/A100CBurbCatcher.dmg.gz


Orange Pi Zero - scripts, O/S, software

Flash our image to an SD card that works with Orange Pi Zero (e.g. Sandisk 8GB). Please note, that all SD cards will not necessarily work. The SD card must be of good quality. Search around on the internet and make sure the SD card you want to use will work:
        Work:
        Sandisk 8Gb microSDHC Class 4
        Lexar 8Gb Class 10
        Sandisk 16Gb Class 4
        Sandisk Ultra 16Gb Class 10
        PNY 8Gb Class 10
        Samsung EVO+ 32Gb HC I
        Not work:
        NoName 8Gb microSDHC Class 10
        ADATA 16Gb microSDHC UHS-I Class 10
        Transcend 32GB Class 10
        Kingston 8GB Class 4
        Sony 4Gb microSD Class 4
        Samsung EVO 16Gb microSDHC I

When it is flashed, put it in your Orange Pi Zero, and plug your Orange Pi Zero into your USB port of your PC, giving it power and an RS232 connection to a terminal on the Linux operating system on the Orange Pi Zero.

It might take 10 minutes for the virtual serial port through your USB to actually become available... Also make sure that the USB cable you are using is a good cable. We've had some cases with thin or damaged cables where the virtual serial port did not register properly on your PC. This problem went away when we used a nice, proper, thick and undamaged cable.

So, when you open the 'serial port' via e.g. putty to it, you can log in with user root and password 12345678

The startup scripts are referenced in /etc/rc.local

We have some more scripts configured in /root (do ls /root/*.sh), for example to pull GPIO pins high and low.

Another important thing on our image, is the crontab to run the sakis3g scripts every 10 minutes, to automatically connect the Huawei USB stick to the internet, so the program can connect to the Plug and Play Scada server on port 2244. The APN has to be set up in your USB stick beforehand (e.g. using AT commands via screen), sakis3g does not actually set it up.

The java virtual machine and compiler is also installed on our image, and the source code is also in the /root directory (do ls /root/*.java). As such, it is self documenting, feel free to look through the code.

Serial port access is actually handled via ser2net
That means you don't have to worry about JNI from the Java. You just connect to a local socket for accessing the serial port to the burb catcher. No need to open the actual serial port. The config file in /etc/ser2net.conf  is important for that, look at it.

Basically the program cycles through the GPIOs to select up to 64 different meters, reading A100C packets from each one, and then stores the values at the end of every half hour.
In the beginning, if the real time clock is not set up, it just stores every 3 minutes in memory, but if the time is set, it stores every half hour in a separate file on disk (up to 10000 files under subdirectory readings)
The program automatically tries to connect to the IP in server.txt, or by default sdg.pnpscada.com, via TCP/IP.
If you connect it to your server, you can send linux commands to it, if you put > in front
There are other commands, send HELP\
to see what. For instance, you can specify meters for which you want real time energy readings (forward and reverse) to be echoed back.

In future we want to do more around scripts to use Wi-Fi and the Ethernet port, automatically, to do mesh etc., but for now, we only use the Huawei stick for connectivity, in the current image.

Eagle design schematics:



Example of the final product in action!!




                                       




Tags: burb catcherirdasoftware download
Please log in to post a comment