I hope to fly a Raspberry Pi in a high altitude balloon as a data acquisition and logging system. An intriguing capability the Pi could add to a balloon payload is to host a web server and web page for testing, configuring hardware before and during launch, and to download data after or even before landing. Data could be accessed before retrieving the payload from the tree :), This is a first look at some of the software and hardware to support this effort. This could be considered a first draft as I have learned some things the require different choices in hardware. The Pi offers a low cost computer system. I’m using version A (2011) hardware with the Raspbian “wheezy” 2013-05-25 software image (2013-05-25-wheezy-raspbian.zip ).
This first draft is intended to read and log:
- GPS (Time, location, altitude)
- [Near] board Temperature
- External Temperature
- battery voltage
The system should run for about 4 hour (a typical balloon flight lasts a little under 3 hrs)
This first draft system includes the following.
In this 1st draft the ADC, Pressure sensor, and high side of the logic level converter is powered from the 5V pins on the Raspberry Pi. This turned out to be a mistake. The Pressure sensor needs 4.75V to 5.25V and the 5V pin of the pi appears to be less than that, more on that later. But the main observation for now is that the 5V power should come directly from a regulator, which in turn could be used to power the Pi. I will try to fix this before the flight.
The pressure and temperature sensor use two of the ADC channels, leaving two available for external temperature and battery voltage.
The ADC is not, at least to my mind, a true 12-bit sensor since one of the bits is a sign bit, for differential measurements, leaving 11 bits for data, ie 0.5 ppt instead of 0.25ppt. However it makes up for this by including a programmable gain control so with lower voltage levels it can read with 0.2mV resolution.
The Logic level converter, BSS1384, has four channels. Two are used for the I2C lines converting the ADC’s 5V to 3.3V used by the Pi. The other two lines will be used for the RS232 communication with a GPS, to interface with the Pi.
I have not yet investigated the schematic for the Pi. Part of my problem is that the USB supplies I have are being overloaded and pulling the supply voltage down, and the “5V” supply is measured at closer to 4.25V. I was under the impression that the 5V power line is tied directly to the “5V” line, but this appear to not be the case. Using an adjustable power supply it looks as if, while drawing about 0.7A the voltage drops about 0.5V, and is noisy. To get up to 4.75V I had to apply 5.2V. The plan is to revise the board to accept higher battery voltages, regulated down to 5V. Power for the board’s circuits would come directly from the regulator, and also be used to power the Pi.
I have more experience writing in “C” than Python, so will use that for this work. Gordon Henderson has developed a “C” library to communicate with the General Purpose Input/Output,(GPIO) WiringPi, In addition to GPIO pin control, it also includes routines for I2C communication. Installation instruction are here,
I found the data sheet for the ADS1015 to be confusing. (Though once I got things working it made more sense.) The Arduino library and examples provide good guidance. With these, I was able to get communications with the ADS1015 to work. The code is here, ADTest_C.
Once I was able to get a response over the I2C bus, reading the default values showed the the byte of each transmitted word is exchanged or swapped. Some computers reverse the order that pairs of bytes are stored in. The Pi has a reverse sense from the ADS1015. For sending commands to the ADS this has to be taken into account when choosing which bits to set. The bytes have to be swapped for the Pi to translate the two-byte words correctly.
The code available here is an example program, rather than a library. And it may be eligible for the Noah Award for quality programing :). Your mileage may vary. No Warranty is promised or implied – use at your own risk.
I have succeeded in writing C-code to use communicate with the ADS1X15 Analog to digital converter. It communicates with the Raspberry Pi over the I2C bus with a Voltage level converter to match the required voltages.
Update: 2013-10-28, schematic added. note: the present configuration ties the 5V line into the Pi’s 5V line. Instead it should be tied to the output of a 5V regulator.
© David B Snyder 2013