John Shovic's Google Plus Switch: December 2013

Thursday, December 26, 2013

Where to find ProjectCuracao software

We have been asked where to find the most current software that has been released for ProjectCuracao.

This software is hosted at github.

http://github.com/projectcuracao

There will be a new release this weekend.

Wednesday, December 18, 2013

GPIO and I2C mappings for Project Curacao

We have been asked to put together tables showing the i2c and GPIO mappings for both the Raspberry Pi and the Arduino Battery Watchdog in Project Curacao.  While you can figure it out from the software and comments, it would be great to have the mappings in one place.  We are also putting this in Article 5, Project Curacao Software.  Updated with solar/wind GPIOs on 01/07/14.


RaspBerry Pi i2c Mappings

i2c addressDeviceFunction
0x29BM017 / TCS34725RGBC Color Sensor
0x39TSL2561Luminosity Sensor
0x40INA219Raspberry Pi Input Voltage/Current
0x41INA219Battery Input Voltage/Current
0x44INA219Solar Panel Output Voltage/Current
0x48ADS1915 A/D12 bit A/D converter
Channel 0Pi Battery Temperature
Channel 1Camera Servo Feedback Potentiometer
0x77BMP085Baro/Temp readings

RaspBerry Pi GPIO Mappings (GPIO.setmode(GPIO.board))

RPI.GPIORaspberry Pi NameBCM2835Pin NumberFunction
7GPIO7GPIO4P1_07Rising Edge Interrupt to Arduino
8TXDGPIO14P1_08TXD to Arduino
10RXDGPIO15P1_10RXD to Arduino
12GPIO1GPIO18P1_12Software PWM for Camera Servo
15GPIO3GPIO22P1_15Pulse to Turn Fan Off
16GPIO4GPIO23P1_16DHT22 Temp/Hum Interface
18GPIO5GPIO24P1_18Pulse to Turn Fan On
22GPIO6GPIO25P1_22Activity LED



Arduino Battery Watchdog i2c Mappings



i2c addressDeviceFunction
0x40INA219Arduino Input Voltage/Current
0x41INA219Arduino Solar Cell Voltage/Current
0x44INA219Arduino Battery Voltage/Current
0x5CAMS 2315Outside Temp/Humidity
0x68RTC1307Real Time Clock

Arduino Battery Watchdog GPIO Mappings

GPIOFunctionComments
22Interrupt PiLevel
27Pi Latched Relay ResetPulse
29Pi Latched Relay SetPulse
35LED Pi Interrupt OnArduino Battery Voltage/Current
41Select Wind SetWind Turbine
43Select Solar ResetSolar Panels


Arduino Battery Watchdog A/D Mappings


ChannelFunction
A3Pi Battery Voltage
A5Regulated Wind Voltage
A7Unregulated Wind Voltage
A9Pi Solar Voltage

Tuesday, December 17, 2013

Project Curacao Deployment Date Set

March 7th, 2014 has been set as the Project Curacao deployment date in Curacao.  The box will fly down with us in checked luggage with the batteries removed.  We will provide the TSA with a description of the box (it is bound to be inspected) and articles that we have written about the project.  A friend of ours has flown technical gear many times and always provides a list of materials and what are the devices in the luggage.  He has even gotten thank you notes from the TSA.

Here is a picture of the tower to which Project Curacao will be attached.  The camera will certainly have a good view.


We have to work out an attachment mechanism as the flat of the tower does not face directly south and we want to be facing south to maximize the solar power.

Software Status on Project Curacao (12/17/13)

As of today, the current state of the software in Project Curacao is as follows:

- Arduino Battery Watchdog:  The watchdog is reading and reporting data back to the main software in the Pi via a serial link through level shifters.  



  1. The read from Pi to Arduino fails occasionally (and is logged on the Pi) but not often enough to worry about at this point.  The next three things to be implemented
  2. Pi power control - Complete and now in system testing.  Implemented own alarm system (instead of using Time/TimeAlarms) using RTC because putting the Arduino to deep sleep also puts the internal software clock to sleep. 
  3. Watchdog logging - Partially implemented in SRAM.  Next is to put in logging in the Arduino for major events and implement sending the log to the Pi.  Then we will put together the software in RasPiConnect for showing the last 20 Arduino log entries.
  4. Watchdog function complete in Project Curacao main program and Arduino.  Tested pretty throughly.  Purposely crashed the main program every hour and and the Arduino rebooted the Pi after 15 minutes as expected.

- Project Curacao Pi main program:  The main program is generating all the graphs, camera pictures, environment sensing as required.  It is also regulating the Fan automatically now.    Not yet reading log files from the Arduino Watchdog.  Next three things to be implemented:

  1. Watchdog implementation complete
  2. Logging Arduino Watchdog Data - in progress
  3. Improving sensor error detection




- RasPiConnect:  We have a few more graphs and dials and buttons to implement on the RasPiConnect software, but it's pretty close to final.  We use this all the time now to monitor what is going on in the project remotely.   We are thinking it might be good to put in a process monitor graph and reboot function.  Both are easily done. 


  1. Added support for the new RasPiConnect alarms, but they really don't do anything yet.  
  2. Will add Arduino Battery Watchdog log print shortly. 
Here's the newest main screen (1 of 6 at this point):



Tuesday, December 10, 2013

Bootloader Issues with Arduino Mega 2560

Hit a significant roadblock on the Battery Watchdog last week.  During one development session, the Arduino Mega 2560 we are using for the Watchdog stopped taking programming, giving a series of errors:


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

After eliminating the possibility of a bad Arduino Mega, bad programming environment, bad cable, and others, we determined that we had run into the "!!!" bug.  The "!!!" bug can happen because you have "!!!" in an text string or, unfortunately, generated by the compiler as part of the code.  Eliminating the text string, we suspected that the code contained 0x212121.  We verified this by looking at the battery watchdog hex file and found a sequence of "212121" which in ascii, is "!!!".  It is generated by the code and not part of a text string in the program.

We used "hexdump" on the mac command line and then searched for the value.  We found the location of the compiled file by turning on the additional compilation output (on the Arduino preferences menu) and then looking through the compile information to find the .hex file.


The Bootloader that is shipped with some Megas (we bought ours early in 2013) detects the "!!!" sequence and goes into a monitor mode, hence timing out the loading process.

This is fixed in the latest boot loader (which also reenables the internal watchdog timer, Yes!).

We have now completed the process of flashing a new boot loader into the Arduino Mega by using a Arudino Uno as an ISP programmer as shown in these links.  Use the following boot loader:

hardware/arduino/bootloader/stk500v2/stk500boot_v2_mega2560.hex

The new boot loader image we used was in the Arduino directory.  If you are on a Mac, open up the app bundle in Finder.

This fixed our problem, but still with a verification error, but the boot loader is working and we can program the Mega again.  (note: We suspect the following will remove the verification error, but we haven't tested it yet:  disable the -D command to auto erase the chip and add the -e instead.)


We used the tutorial on:

http://arduino.cc/en/Tutorial/ArduinoISP 


for the IDE procedure.

Remember that the pins to be used changed from the Uno to the Mega, so use the following wiring diagram:



UNO to Mega pins

Arduino Uno      Target Mega2560

D10 (SS)            Reset
D11 (MOSI)          D51
D12 (MISO)          D50
D13 (SCK)           D52

Gnd                 Gnd
+5V                 +5V


Now the Arduino is working fine in the system.  Here is a picture from the RasPiConnect App (www.milocreek.com) of the functioning Arduino system.

Arduino Based Battery Watchdog


Picture of the location of Project Curacao