My next step is to refine the project, add some automation, and make it cooler in general.
I grabbed a few thing to make that happen:
3x the possibilities
Second IOIO board for bootloader work…which will allow for bluetooth communications between the board and a phone. Two additional solar panels…to increase the complexity of my sensor setup.
I hope you don’t mind, but I went ahead and stepped it up a few notches.
My newest project brings my end-goal a few steps closer. I now have the pieces in place to put together an actual robotic implementation with the IOIO…since things have officially reached the cool stage, I decided to drop this as a stand-alone project. Complete with pics, a vid, and an app.
IOIOSeek:
dig the lighting
What I have here are two slider bar controlled servos, an analog input-read solar panel, and some LEDs toggled via a button. The control is via the IOIO / Android.
dig the wires
The pictures, however nice, don’t really tell the story. Take a look at the video to see this thing in action:
As the video alludes to, I am going to run with this concept. The automation (robotics) lies in the analog reading with respect to the servo positions. I plan to ‘scan’ the panel…that is the piece that is missing. Once I can implement that mess, I will have a tracking system. Implementations will fall out of that.
+1 tape
As with the last few projects, I have dumped the app on the Android Market for general perusal. The app’s description provides the details of the pin configuration, which is straight forward. I have two PWM outputs, a pure 3.3V digital toggle, and a pin configured for analog input. That is that.
I will push my code to GitHub as well eventually, and provide a link therein. I still need to polish my generic servo code, since my latency was borderline awful in retrospect. Look for that in the near future as well.
As always, drop any questions to joe[at]swantron[dot]com. Feel free to share your IOIO projects with me…
So, I’ve formalized the solar cell project I have been poking at for a while. I managed to clean up my code and mess with some initial conditions, etc., and now have a fairly solid proof of concept for a solar cell-centered night light.
you may want to ramp up that LED a bit
As was the case in my first few runs, my sketch incorporates a five second initialization phase. This acts to set both relative minimum and maximum values which act to provide “full light on” and “full light off” values, respectively. The generated power from the solar cell is read in to the Arduino via analog input, and the LEDs are driven via digital outs. The rest is some simple math that transforms the range of the analog signal into a digital range of zero to two hundo fifty five.
It’s giant-ass-text-having snippet time!
// Solar LED IO
// Joseph Swanson | https://swantron.com
// 2011
// Define constants
const int sensorPin = A3; // Solar cell Pin
const int ledPin = 5; // varuiable LED Pin
// Define variables
int sensorValue = 0; // wipe read value
int sensorMin = 0; // set initial min
int sensorMax = 1023; // set initial max
void setup() {
// turn on Pin 11 LED…indicates calibration period begin
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
// stay lit for five seconds
while (millis() < 5000) {
sensorValue = analogRead(sensorPin);
// adjust for real max
if (sensorValue < sensorMax) {
sensorMax = sensorValue;
}
// adjust for real min
if (sensorValue > sensorMin) {
sensorMin = sensorValue;
}
}
// end Pin 11… calibration period finito
digitalWrite(11, LOW);
}
void loop() {
// read the solar cell analog
sensorValue = analogRead(sensorPin);
// apply a little calibration to the sensor reading
// bit from example sketch at http://arduino.cc
sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255);
// set constraint for outliers with respect to min/max
sensorValue = constrain(sensorValue, 0, 255);
// fade the LED from one to 255
analogWrite(ledPin, sensorValue);
}
Pretty straight forward. On to the vid…
It’s web2.0-too-many-script-ass-calling embedded video time!
Not too bad. Again, I used an Arduino Duemilanove and a Solar World panel. I might try to further this concept by incorporating my 120V switch and getting a lamp up in here. Stay tuned, as always.