This is the third part of my ongoing series outlining the work done on this project before the creation of this blog, the first part can he found here, and the second part can be found here.
In the last post I left off when I was about to move from the Arduino Uno R3 to the 3.3V Arduino pro mini. This went springing smoothly. I soldered pins onto a pro mini, then plugged it into the breadboard and rerouted the wires from the Uno to the pro mini. I then uploaded test code for each individual component to the pro mini to make sure everything was wired correctly and working independently, and it all worked. I then tried code that used everything other than the RTC together and that worked as well.
The next step was to add a new RTC into the system. As I said in the previous post the RTC I was using previously would not work with the pro mini, because it needs 5v and the pro mini is a 3.3v device. Instead of fixing this problem when I noticed it I decided to kick the can down the road, and this is when I caught up with it. Previously I was using an I2C RTC, but unfortunately 3.3V I2C RTCs are hard to come by, so I replaced it with a SPI RTC.
This introduced a lot of problems into the system. First it was difficult to find good libraries for this new RTC, and once I did it still did not work in the system. After a while I was able to identify that the RTC and SD card reader were not able to work together, and after a while longer I figured out that I was running into SPI mode problems. If you have been reading the weekly updates then this probably sounds very similar to a problem that I recently dealt with at time of writing, and it is. The SD card and RTC need to have use different SPI modes to function, and this necessitates switching between SPI modes in the body of the code and tracking that the device is set to the right mode at the right time. I developed a way to do this at this point in the project, but later it stopped working and I had to change it in a subtle and annoying way.
After this was sorted I was now at the point I was at before moving to the 3.3V pro mini, that is the accelerometer, temperature sensor, pressure sensor, and RTC would all read data and write it to the SD card. The next step I began was to start to develop ways to decrease the power consumption of the device. I started by making a physical alteration to the Arduino, the Arduino had two LED indicator lights on it, on for power and one connected to pin 13 for general debugging purposes. I decided that when the device would be deployed and underwater that there would be no one to see the LEDs, so they did not need to be turned on. Unfortunately there is no way to turn off the power indicator LED from software so I disabled it on a hardware level. To do this I started by doing research into how other people solved this problem and found that you can just cut the lead wires on the board leading to the LED. This sounds easy enough but the Arduino is a small, printed PCB board so the wires in it are difficult to get to. I ended up just spending a lot of time under a magnifying glass carefully cutting into the board with an exacto knife until the connections were severed. Luckily I was able to do this without accidentally cutting any other wires and the Arduino still functioned after these modifications.
Next I began to try to minimize power usage on the software side by trying to the put the Arduino in an extreme low power state. In this state it would draw micro amps of power, as opposed to the milliamps in normally pulls. Before I began this though I connected a Lipo battery and ammeter to device so that I could get accurate current measurements of current. I also broke out the FTDI chip so that I could control what pins it was using when. With this hardware setup I then began development of the low power version of the code.
My notes on the exact process I went through to develop this code is vague at best but, in the end I had working code that would shut down every conceivable part of the Arduino, and then wake it up every minute with an alarm from the RTC. When the device was woken up it would read form all the sensors, write to the SD card, and then reenter the extreme low power mode. This was a very effective system form a battery life perspective, I never left the device running long enough to drain the whole 400maH battery. The longest it ran for was about 8 days and was going strong when I removed the SD card to look at the data.
This about sums up the work I did over the summer. There will be probably only one more post to sum up the work I did over last semester and winter break.