Wednesday, March 7, 2018

Getting Status Data from a Huawei E8372 USB Dongle

I am working on creating a remote solar-powered station that will report weather data from a location in Canada using a cellular connection. At the heart of it will be a Raspberry Pi Zero W running in headless mode. It connects to the weather station and then will send the data to the Weather Underground over the internet. The location is on a pretty remote island; it is just withing cell coverage, but with no commercial services at all, particularly no power. The location is occupied much of the time in summer, but during the winter - from about October until May there will be no one at the location at all.

This presents a number of problems for a system that has to function without any local interaction; there will be no one to power cycle the devices, look to see if any lights are lit, and there will be no one to push a reset button if that is needed. The entire system has to be setup so that it can do these things and act autonomously to recover from all sorts of situations that might arise. For instance, after the snow falls, the solar panel may get covered and stop producing power; weather may also cause it to lose connection to the cellular internet.

This means adding some smarts to the system to detect when these states might happen. To those ends, I have purchased a current and voltage monitor board, a solar charge controller, a real time clock module and a USB extension board for the Zero. For cellular connectivity, I will be using a link to the T-Mobile coverage in Canada - on the island it is limited to 3G, but since the data being transmitted is simple weather data, it should work fine.

Monday, March 20, 2017

Island Solar Power

This post is intended to provide some information for a family cabin in the wilds of Canada.

All, I have been investigating some stuff on the solar power system. I have spoken with a few places and I have come to several conclusions.

1. You need to have a capacity meter added to your system. 
There may be an easier path to this in your existing system. I only took a picture of your SolarBoost 50 MPPT (SB50) unit, so I was working from that. The company that makes your SB50 also sells a remote monitoring display that you could add to your system and mount inside the main cabin. It will interface to the charge controller itself (SB50) and also has a power shunt that you install inline with the battery pack to measure the amperage going into and out of the battery pack. This unit will show you the state of the charging unit (same information you get when look at the SB50 directly in the shed) AND the amount of power left in your batteries. It also monitors the batteries and over time will make better predictions on how much capacity you actually have left.

There are also stand-alone battery monitor units that you can add to your system. Stand alone units only monitor the Amps going into and out of your battery pack and do not interface to the charge controller. You program it with specifics about the batteries and the capacity and it will tell you the capacity left at any time and how fast the batteries are being charged and a bunch of other information about charge rate, full charge, etc. This is just like the unit above, but it does not interface to the Charge controller. This can be a plus, however, because if you ever replace the charge controller, you would not need to replace the battery monitor. It is also cheaper even when you buy the shunt (sold separately). 

2. You have to move the panels out of the shade in the morning.
For the same reason above (averaging), one panel in the shade kills the average power produced. They need to be moved down the roof and out of the shade of the birch. I would recommend turning them longways and moving them down to the other side of the skylight right next to each other. The additional distance will make no impact on the power delivered to the charge controller.

3. You need to move the solar panels together.
When you connect the panels the way you have, you are averaging the output of all the panels. The angle at which the sun hits the panels makes a huge difference in their output. So in the morning when the sun is hitting the 2 panels on the front of the cabin, it is barely hitting the 1 in the back. This means that instead of charging with 2 panels plus a little from the back panel, something like 2.25, you are actually charging with the average of the 3, which is (1+1+.25)/3 = .73. This is actually less than 1 panel! When the sun works it way around to mostly hitting the back, it is even worse - (1 +.25 + .25)/3= .46.

So, it would seem that just moving the one panel from the back to the front would allow pretty good charging all morning and into the afternoon, and since they all point in the same direction, the average would be the same for each.

4. You should probably replace your panels.
We know that you have added panels over the years, and this is pretty bad for your particular system. When you use panels of differing amp capacity and (slightly) differing voltages (they change with age) your MPPT controller cannot calculate the most effective voltage/current to use to get the most efficient charging. There are many choices for panels out there, and I think with the prices dropping so much, you can probably replace the 6 you have now with 4 that will work better and charge your batteries faster. I think your system is rigged using 2 12 Volt panels together for 24 volts, so you will need to buy 2 at a time for a similar setup. I think that your best bet is to just get 4 new high current panels, mount them on the other side of the skylight all together and remove the old ones to another use. (more on that later). 

5. Add new panels and 2 new MPPT charge controllers to your system.
If you want to keep your existing panels (after moving them out of the shade) you could create a system that has 2 strings of panels each controlled by their own MPPT charge controller. In order to do this, you would need to get 2 matching MPPT controllers (so that they charge the batteries the same way) and get rid of the one you have now (or use it elsewhere). This is preferred way to add new (and different) panels to an existing system. It is also the way that you would mount 2 sets of panels on two side of a roof. As the sun moves from one side to the other, the two MPPTs work together to give you the best charging and remove the canceling effect you now have.

6. (Optional) You can rack mount the panels together.
If they face directly South they will be more efficient. This would afford the most solar flux for the longest time per day. The angle of the panels should be set to be best Spring, Summer, Fall since in the winter there is no electricity usage.

7. (Future) May need to Expand Capacity
After you install a battery meter, it might start to be clear that you need to expand your reserve capacity (number of batteries).

8. (Possible) Use the Old Panels on Opa & Oma Cabin
If you replace the panels on the main cabin, you could take the 2 best panels from the old system and mount them on the Opa & Oma cabin roof with a separate battery and charge system intended to just power the devices in that cabin.

I hope this helps a little and arms you with some information if you talk to SOLARMAN!

The pictures below show the panels in shade and the current then when they are in bright sun and the current.

Panels in Shade (Morning)

Current when in Shade (2.2)

Panels in Light (mid day)

Back Panel in light (mid day)

Current when in light (11.2)


Monday, October 3, 2016

Canada and Flashlights

This past Summer we took a trip back up to the vacation home of my brother-in-law's family. It is not really a home but an entire island. Before they bought it many years ago it was a fishing camp. It is located up in the Georgian Bay close to the town of Killarney. They have spent every Summer going up and enjoying the utter beauty and tranquility as well as improving it as they went along. I have been up several times over the years and, in my opinion, it is one of the most beautiful places on the earth. I dearly love it there. The stunning beauty, incredible weather, pure water and star strewn night sky are hard to describe for anyone who has not been there.

A photo from the island from 2007

Part of the allure for me is that it is rustic. There is no commercial power to the island so when you are there you need to have a few critical tools with you. A pocket knife, a lighter and a flashlight are standard. You just always seem to need those with you. Since I am bit of an excessive when it comes to flashlights, this is just fine with me. I love little flashlights, and big flashlights, and ones that flash and one that do not, I love lanterns and spot lights, too. Which brings me to the point of this post.

A few years ago, I recommended to my neighbor, a US Navy SEAL, that he participate in a Kickstarter program for a custom made programmable flashlight called a HexBright. He put down his money and waited a pretty long time before the product became a reality. When he received his light, I was immediately jealous, it was a very cool; solidly built, rechargeable, very bright and long lasting.

But best of all, it is programmable! It is not a simple mode and level type programming; it is fully programmable, built around an Arduino board with an on-board accelerometer and high power LED drive circuit. I have been programming micro-controllers for a very long time, so this thing was perfect for me. I wanted one of these little guys very much, but the cost was nearly $100! That is lot of money for a flashlight, but I came into some found money, I think I won a gift card at a meeting and then I took all my loose change and cashed it out and it totaled just enough to get one. It is my absolute favorite tech tools. It is heavy duty, waterproof, self-contained and works perfectly. After I received it I began working on programming it right away. I was able to take an excellent existing program called "Up and Down" and improve it. With the program I made for it, it has capabilities far beyond the reach of any normal flashlight.

Tuesday, January 12, 2016

Printed PCB for RC Telemetry Bluetooth Interface

This is an extension of the previous post.

I have been toying with the idea of putting together a control system for my smokers. It involves sensing temperatures and controlling a fan and doing some display. Pretty simple stuff for a Teensy or Arduino, but when it comes to uploading that data to the internet, those platforms fall a little short. That is where a Rasperry Pi shines. So the idea is to make a board that mounts on a Pi and is able to communicate with it, as well as do the control stuff. This is very similar to DIY controller called the "Heater Meter" (link to the store). This is going to be a very complicated board, but I thought that using the technique of leveraging a Teensy, like I do with the RC Interface would make sense. While doing the research on the Heater Meter, I found that they have their boards fabricated by OSH Park. OSH Park grew out of a club that assembled small pcb boards into a single panel and then had that made by a fabrication house. That is another story told better on their website, and not mine to tell, But the best part of it all is that OSH Park can make 3 copies of your board for $5 per square inch. That is a fantastic price and you usually only have to wait 2-4 weeks to get your board back. For my board below that ended up being about $22 or about $7.33 each. So why does this matter for the RC Telemetry Interface? Well, I figured that I needed some practice using the software that is used to create the schematic and design the board and I also wanted to see how the whole process worked, so I thought I would use the RC Telemetry Interface to learn how it all worked.

The software I used is the free version of CAD Soft Eagle, so I set out to learn it and to create the schematic and board for the interface and here are the results.

The circuit is as described in the previous post, but I added two buttons, and LCD screen and an LED. Here is the schematic.
Schematic for the RC Telemetry Interface

Pretty simple really, but the fun part is when you switch to designing the board. Even with the simple schematic shown above, the board gets pretty complex. This is the version 1.2 of the schematic and board; the boards pictured below are from the first version and there are some differences.

The picture below is the layout of the board, and what might not be apparent is that the blue lines are on the back side and the red lines are on the front. Also, all the parts are actually mounted on the front, this means that the LCD panel will mount on top of the Bluetooth module and the Teensy. I did this to protect the Teensy's program button, In the first version, I put the Teensy on the back, but the "program" button kept getting pressed when it is set on a table. This solves this problem and makes for a compact package. In addition, having the Bluetooth module on the front under the LCD allows me to see the blinking light that indicates the state of the module. You can not see it directly, but the flashing light is pretty easy to see around the LCD.

You can see that I have the two buttons positioned below the LCD and an indicator LED as well since it might be hard to see the Teensy's LED. I also placed the SPECTRA interface on the top, so it is easy to see if it is plugged in or not. Last, I have added a plug and an on/off switch that allows the unit to be powered from a LiPo battery. The plug fits the batteries available from Adafruit.

Board layout for  RC Telemetry Interface

Here are pictures (front and back) of the board that I had made from OSH Park:

And here are some pictures of the first version with the parts attached. Note, I placed the Teensy and the LCD using headers so that I could remove them for testing and debugging. Also, I made a mistake in the schematic for the Bluetooth module, getting the Rx and Tx lines not connected properly, so you can see that I had to use wires to connect it, this is fixed in the new version.

If there is interest I can post the Eagle files or point you at the projects on OSH Park's website.


Wednesday, May 20, 2015

Spectra Module to Bluetooth Link for RC Telemetry

The Android App I created, "RC Telemetry", will display the telemetry received from a Hitec Spectra Radio system. Unfortunately, to receive that data directly from the aircraft you would need Hitec's proprietary radio receiver and creating something like that is just too hard. Fortunately, there is another way to receive the telemetry data, and that is by receiving it from the Hitec Spectra module in your transmitter itself. The telemetry data is sent back to the Spectra module from the aircraft and if you are using a Hitec Aurora radio system, the data is then sent on in to the radio and is displayed on the control panel. If you are using just the module inside a different radio, then you can still get at the telemetry data, but you have to access it by connecting to the Spectra module. The Aurora radio receives the telemetry data over a low level protocol called I2C and we can use it to to get access to the data.  In that protocol, there are "Slaves" and "Masters" and they refer to the roles that the devices play when communicating. In the Hitec system the Spectra module is the "Master" and sends data out to all "Slaves" on the bus. In order to start receiving the data, we have to connect a device and have it become a "Slave" to the Spectra module.

Once you have connected to the I2C bus and set about becoming a "Slave" you will start receiving data like any other "Slave" on the bus. So in order to get the Android App the telemetry data, we need to create a little hardware device that will connect to the Spectra module receive the data and transmit it on to the Android App. The easiest way to transmit the data to the Android App is to send it over a Bluetooth Serial link, and that is just how the App is coded.

Here is how the data flows through the system:
Spectra <- (I2C) ->Teensy (Serial Data)->Bluetooth Module (2,4GHz radio) -> RC Telemetry App

The following is my description of how I assembled a device that does what is described above. I experimented on a breadboard, but I will be soldering this together to make a little unit to connect to my radio all the time. I will include picture of that in a different post.

I have recreated this device using three different micro controller boards: Adafruit Trinket, Teensy 2.0 and the Teensy LC. Of these three boards, I really prefer the Teensy LC because it is so much fast than the other boards, so you can do much more with it. In fact, I have added a little Nokia LCD display to the device so I can display real time telemetry right on the LCD screen without the need to even have the app running.


  1. Microcontroller board:
       Teensy 2.0, running at 3V3 - $16 for board and $1 for the 3V3 regulator
       Teensy LC running at 3V3 -  $11.65
       Adafruit Trinket 3.3V - $6.95
  2. Bluetooth Serial Module - $6.27 from
  3. Standard Servo Cable (3 conductor, keyed)
  4. 2 1.5K Resistors to use as pull ups



The pins of the TeensyLC and Bluetooth modules have names and are marked on the devices. We will be using the TeensyLC's hardware serial port, so we must use the specified pins. Here is the connection matrix:

Teensy to Bluetooth
TeensyLC pictured

 Teensy 2.0  TeensyLC  Bluetooth 


The Spectra module has a port in it where a standard Servo connector can be connected. It might be covered by a small plastic cover, We will number the port from the top to the bottom. The top is the connection closest to the keyed port. In the photo the yellow line is connected at the top:

Spectra to Teensy
Spectra Module with Servo Cable

 Teensy 2.0 
1 (yellow) 
2 (red)
3 (black)

In order to connect the servo connector to the Teensy, I used 3 pins plugged into the servo cable and that plugged into breadboard. The 1.5k resistors can be seen plugged from the pins to the 3.3V bus. These must be present to in order to pull up the I2C bus:
TeensyLC pictured with Pull ups


Plug in your Teensy at this time, it should power up and the Bluetooth module should power up as well. On the both the Teensy and the Bluetooth module there are LEDs that light up, if you do not see any lights, unplug it and check your connections.
When the Bluetooth module gets power, you will be able to bind it to your computer or your phone. It will not get any data yet, of course, but you should see it out there. After you bind to it and connect, the blinking light will change to steady on.


Install Arduino and Teensyduino in order to program the module using the Arduino interface. The program for the TeensyLC version of the program depends on the i2c_t3 library, so make sure that you install that library when given the choice while installing Teensyduino.

Note, For the Teensy 2.0, I am running it at 3V3 and at that voltage, it is supposed to only run at 8MHz; I run it at 16MHz and there do not appear to be any ill effects. On the TeensyLC, this is no issue, it is a 32 bit processor running at 48MHz at 3V3!

I have written a simple program that will configure the micro-controller to be a slave on the I2C bus so that it will receive data from the Spectra module. As soon as it receives a packet of data, it immediately transmits that data out to the Bluetooth module. This program is dumb, it does not even look to see if there is a valid Bluetooth connection or anything, it just sends the data. It does have some code in there to blink the LED on the board when it is receiving data and to glow steady if no data is being received.


The TeensyLC version of the program does not take any special modification to the library it uses, so just download the program and load it up in the Arduino environment and program the Teensy LC with it.


Teensy 2.0

The program for the Teensy 2.0 depends on a modified version of the Wire library called WSWire. This modification has a set of loops that will reset the I2C hardware on the Teensy if the bus gets locked up. Be sure that you install the WSWire library, I provide a link here, but I think you can find it elsewhere too. To install the library, follow the directions on the Arduino website, there are instructions on how to install a library there.

WSWire Library

Download the Arduino program below and program it onto your Teensy, it should start running immediately



Thursday, November 20, 2014

Connecting a Raspberry Pi to the Anova Precision Cooker

I backed a Kickstarter campaign to bring a new version of a cooker that allows a home cook to use the "sous vide" method of cooking just like fancy restaurants. The device is priced far below commercial units available, but performs exceptionally well. This new device is the Anova Precision Cooker and can be ordered here. This device sports a Bluetooth interface so that you could program and monitor the unit from a Bluetooth enabled device. Being a geek and software developer, I opted to support at the "Hacker" level which gave me early access to a prototype unit so I could work on developing an app or other software for the device.

I also recently purchased a Raspberry Pi B+ from and had been tinkering with all sorts of things on it. As a side note, I also purchased a cool Plexiglas enclosure from Adafruit industries, I highly recommend it, she makes them on site and it is a perfect fit and looks cool. The Pi is a great little platform and can do all kinds of things big computers can do at a fraction of the price. Currently I have it interfacing to my weather station and posting the weather data from my backyard up to the Weather Underground, I thought it might make a good platform to interface to the Anova as well; this brings me to the point of this post. 

Once I got the idea of interfacing to the Anova unit from my Raspberry Pi, I did a little research and found I needed to purchase a Bluetooth dongle that would be compatible with the Anova. Since the Anova uses Bluetooth LE, the dongle must also support that and I needed one that had already been successfully interfaced with the Raspberry Pi (no need to re-invent the wheel here). The one I chose is based on the Cambridge Silicon Radio and I got it from from their USA warehouse: ultra-mini-bluetooth-csr-4-0-usb-dongle-adapter.

So with the Pi, dongle and the Anova unit in place, it was time to see if I could interface them. My research found an awesome resource on on how to get Bluetooth LE working on a Raspberry Pi and I followed this almost exactly to get my Pi to talk to the Anova. Here is the blog post: The following pictures correspond to particular steps in the posting and I have tried to reference each of them for the pictures.

I followed all the steps up to the "First Test" header in the posting to get the proper software installed, configured and working on my Pi.Next I followed the instructions and the picture below are my results when following them.

Results of "lsusb" with the CSR BT Dongle plugged in
Doing a detailed "lsusb" on the CSR BT Dongle

Results of the detailed "lsusb"
Results of the "hciconfig"
Bringing the CSR BT Dongle "up"
Results of the "hcitool lescan" command
Results of the "hcitool lecc" command
Now the posting deals with accessing the Bluetooth device from using Python. I followed the instructions to build "bluepy" on my machine and then issued the command as described in the posting. My results follow and show that the software was able to connect to and identify the Service and Characteristic that is used to send commands to the Anova.

Results of running ""
That's it for now, the next step is to take the Python code and update it to send a command to the Anova. This is simply done by writing to the Characteristic with its value set to a recognized command (status, read temp nn, write temp nn, etc.).