First the achievement:
I transmitted wirelessly from outdoors to inside. Still a lot of tweaking and streamlining to go, but the rough idea is there. Here is the photo:
Fig. 1. The camera took a photo outside, and transmitted it about 6 m to the Arduino indoors. The errors are probably due to missing bits or frames during transmission. |
To get there, a bunch of work was necessary. To summarize:
- Modified my SD card photo storage program to communicate with the Lynxcamera over the UART instead of software serial.
- Programmed my XBee transmitters to work at 38400 baud.
- Connected the Lynxcamera to the XBee and battery module, to capture photos remotely.
After the break I discuss the challenges with each of these separately, include some photos of the setup, and post my code.
Using the UART instead of software serial library caused a few challenges for me. I found that the Serial.write() function was substantially better than the Serial.print() function, as the latter ended up printing spurious characters (which I guess were in the buffer for some reason). Debugging was a bit tricky also, as the UART is how I was previously communicating with the Arduino. Soon I will need to get some status LEDs or the LCD screen up and running to help me out here. However once I had a working version of the code, I could get photos using my camera on the UART Tx and Rx pins.
Because my design links the camera to Arduino over wireless, and the XBee transmitters require programming to change their baud rates, I have decided to set communications at 38400 (the camera's default) because I have no way to change the camera and XBee baud rates after power on. Unfortunately this speed seems to be prone to transmission errors (likely between the camera and XBee. Might be something I can solve with proper timing though.
Once the first couple steps were completed, the final task was pretty easy. The XBee radios were essentially a drop-in replacement for a wired connection, so everything works as I had hoped. The code for this version is posted here. I took a couple photos of my hardware at this stage in the project.
Fig. 2. The camera setup in the planter box outside my balcony, taking the photo in Fig. 1. |
At this stage in the project, I have managed to create quite the todo list of things to be fixed up. To iterate them (mostly for myself, and in some semblance of importance...)
- Organize the software into some sort of repository. Make a list of basic unit tests I can run on the software with each release to ensure that all the functionality is working.
- Optimize the timing in the camera communication so that I stop losing packages (or resend packages when I detect errors)
- Get the system taking multiple photos and make an actual time lapse!
- Implement the pushbuttons and LCD on the Arduino for more independence.
No comments:
Post a Comment