Data Logger | Energy

Data Logger | Energy

I collaborated with Natalia Cabrera and Iza Paez for the solar powered data logger. Our goal was to make a really efficient data logger so it doesn’t consume that much energy. The steps that we took to make it more efficient consists of breadboarding an Arduino and Eeprom chip so that they don’t need a high voltage.

First step was to breadboard the ATmega328 microcontroller. We got rid of Arduino UNO’s functions that we didn’t need. That way data logger would consume less energy.

Breadboarding Arduino

To breadboard an Arduino we needed an ATmega328p chip.

ATmega328_mapping

Pins 7 and 20 should be connected to power and pins 8 and 22 should be connected to the ground. The next step is to connect Arduino to the chip so we can upload bootloader to it. Arduino pin 13 should be connected to chip’s pin 19, Arduino pin 12 should be connected to chip’s pin 18, Arduino pin 11 should be connected to chip’s pin 17, Arduino pin 10 should be connected to chip’s pin 1, Arduino 5v should be connected to power bus of the breadboard and Arduino GND should be connected to GND bus of the breadboard. After connecting Arduino to computer; Atmega328 on breadboard board and Arduino as ISP should be chosen, ArduinoISP firmware from example sketches should be uploaded and bootloader should be uploaded by clicking Burn Bootloader.

Now that chip is an Arduino chip and it can be programmed with an FTDI adapter. For that Arduino should be removed and FTDI adapter should be connected to the chip as following: GND pin of FTDI should be connected to GND bus of the breadboard, VCC pin of FTDI should be connected to power bus of the breadboard, Tx pin of FTDI should be connected to Rx pin (pin 2) of the chip, Rx pin of FTDI should be connected to Tx pin (pin 3) of the chip and DTR GRN pin of FTDI should be connected to the reset pin (pin 1) of the chip with a 0.1 uF capacitor. To upload a code; Arduino Pro Mini (3.3v 8mhz) should be selected as the board and FTDI should be connected to computer.

20150323_222120

 

After breadboarding Arduino, we connected 24LC256 EEPROM I2C External Memory as you can see in the following image. Also we wanted to collect the amount of light data so we connected a photocell and a 10k resistor to pin 23 (analog input 0).

20150510_144303

Next step was to write a code to log the data into the Eeprom chip. In order to be more efficient with energy we decided to put arduino to sleep in between the readings. We used jeelib library for that and for testing we put an interval of 10 seconds. You can see the code below:

#include <JeeLib.h>
#include <Ports.h>
#include <Wire.h>

#define disk1 0x50

int input;
int eepromIndex = 0;
ISR(WDT_vect) { Sleepy::watchdogEvent(); }

void setup() {

// initialize the digital pin as an output.
Serial.begin(9600);
pinMode(A0, INPUT);
//pinMode(13, INPUT);
// writeEEPROM(disk1, 0, 5);
Serial.println(“setup done”);
}
void loop() {
delay(100);
Serial.println(“start”);
for(int i=0; i<256; i++){

Serial.println(readEEPROM(disk1,i));

delay(10);
}
Serial.println(“end”);
// Serial.println(readEEPROM(disk1,0));
// Serial.println(“loop”);
// delay(1000);
input = analogRead(A0);
input /= 4;
if(eepromIndex>255){
eepromIndex=0;
}
writeEEPROM(disk1, eepromIndex, input);
eepromIndex++;

delay(100);
Serial.println(readEEPROM(disk1,eepromIndex-1));
delay(100);
delay(100);
for(int i = 0; i < 1;i++){
Sleepy::loseSomeTime(10000);
}
delay(100);

}

void writeEEPROM(int deviceaddress, unsigned int eeaddress, byte data )
{
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(data);
Wire.endTransmission();

delay(5);
}

byte readEEPROM(int deviceaddress, unsigned int eeaddress )
{
byte rdata = 0xFF;

Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();

Wire.requestFrom(deviceaddress,1);

if (Wire.available()) rdata = Wire.read();

return rdata;
}

After making the datalogger we needed to connect the solar panel that we got from Voltaic Systems and the batteries that would be charged by the solar panel and discharged by the datalogger when there is no sun. We used 4 nickelmetal hydride batteries; 1.2 V 1700mAh (milliamp-hours) each. We connected the batteries and the solar panel to the data logger with diodes using this solar charging method.

After putting everything together we tested the datalogger by putting it under a lamp light for half an hour and then connected it to computer to get the data through the serial monitor.

20150405_180634PhotoGrid_1428273998188

Next steps for improvement will be to add a battery charging circuit that I made for Circuit Design final, a LiPo battery and using a button instead of using the reset pin to reach the datalog. After everything is set my plan is to explore implementations of the datalogger using different sensors and to explore different data visualization possibilities.