One of the main issues I identified was extending the battery life of the wireless unit. Currently I can take about 300 photos, which at 30 FPS means 10 seconds of time lapse video. Not great. I thought of a couple ideas that could help me here:
- Power savings mode when the camera is waiting between frames
- Faster data transmission so the camera is in power savings mode for longer
- Hardware modifications like disabling the IR LEDs
Power savings mode was fairly trivial to implement, it was just 2 commands I sent over serial to turn on or off the camera's power savings mode. Next I worked on the transmission speed. My first thought was to decrease the "interval time", or time between successive frames, but this started causing data transmission errors. So instead I worked on increasing the buffer size, so that more data was transmitted at once. However, the microcontroller only appears to have a serial buffer of 64 bytes, so when I tried to get more data than 56 bytes per frame, I was running into problems (due to the 5 extra bytes before the frame starts). What I ended up doing was removing the delays in my code, and implementing a loop to poll the receive buffer. In case of transmission errors, I also added a timeout, and flag that was set upon an unexpected frame size, which caused the erroneous frame to be resent. At the end, it was something like this:
// loop continuously until the data is ready
while(!Serial.available()){
delay(1); // 1 ms delay
timeout++; // timeout counter
if (timeout > TIMEOUT_MAX){ // if 1000 ms pass before data received, assume erroneous data
i = 5; // satisfy exit condition
ResendFlag = 1; // ensure data is resent since erroneous
break;
}
}
// if we get here, data is available so process it
This had some pretty good results, my transmit time was reduced by almost half. Now I'm running an endurance test to see if it actually improves my power consumption, and if so by how much.
No comments:
Post a Comment