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.
*Proof of Concept Warning*-*Proof of Concept Warning*-*Proof of Concept Warning*
Mission: Utilize a solar cell to vary the intensity of an LED
Supplies: Arduino Duemilanove <--> USB <--> Notebook (Linux, por supuesto)
Breadboard, Jumper Wires, Make-shift Jumper Wires (spare resisters), LEDs, Solar Cell
Setup: Here it is I herd you like to work, I set you up so you can work at work
The setup is pretty straight forward: Read analog, write digital. The primary hurdle was figuring out the initialization step. Basically, I needed to provide a time-frame where you can read in minimum / maximum values from the cell. The LEDs in the awesome video below show the results… v
This project is full of take-off ideas. Reverse the range on the LED outputs, and you have a setup that powers up a light as the ambient light levels fall. Motion detector…you bet. You could implement a setup to run the initialization cycle at intervals, to provide a real-time average light level, and check for a delta of some size. Boom. There you go.
I’ll clean up the code, use some real jumpers, horse around with things in general, and throw up a post. With a snippet. Check back.
Here we go. As I mentioned a few days ago, I’m horsing around with analog input to my Arduino, in the form of input via a solar cell. For the win. It turns out, that I’m getting far better with my casual electronics experimentation…I will chalk this one up as a win.
My basic set-up is this…Radio Shack solar cell, breadboard, florescent light source, Arduino, and a notebook.
Step 1) gauge light source via multimeter.
one point twenty-one gigawatts
1.7 V…no need to toss in a resister, as the Arduino can handle 5V without issue. Good to go.
Step 2) Interface with Arduino via breadboard.
breadless soldierboard
This could have been a direct setup, but for the sake of not soldering a solid lead to my solar cell array, I chose to twist the crap out of the existing + and – leads of the wire outs on the unit, and cram them into the breadboard. USB connected to the Arduino, of course
Step 3) Chop in some code for the Arduino. This was the tricky part…not that tricky, however:
~~code snippet time~~
void setup() {
Serial.begin(9600); }
void loop() {
int v = analogRead(0);
Serial.print(v);
Serial.print(‘ ‘);
delay(900);
}
~~~end code snippet time~~~ enhance...enhance
Note the lack of comments? I’m a flipping math dude, so that is wholly optional in my book. Long story short, Wiring is a stripped cousin of C++…I have to void setup and loop here, since I am not concerned with anything once I let ‘er rip. I will touch on the programming specifics at a later date, but inquiring minds can find this info quite easily on the Arduino project’s main page, or on Wikipedia. Knock your socks off. I added the delay for sake of real-time monitoring, and matched the baud rate to which I had configured my USB connection. ttyUSB0 would be that in question…9600 would be the rate.
Step 4) Read input via serial monitor.
those figures average out to 'awesome'
As you can see, it is pretty much constant, with some fluctuation due to my set-up. Noisy, yes. Cheap components, yes.
Step 5) Testing ‘zero’ state. Here, I have employed my box of smokes. American Spirit Lights, to be precise.
Yellow Box of American Spirits...A Labritory Must-Have
Step 6) Gauge system.
Here, I’m altering between ‘on’ and ‘off’ states. I start with the ‘off’ (smokes on solar panel) configuration for a time, remove the box to open the system to ‘max input’ for appx 7 secs, and then place the box to remove the input energy.
FOR THE WIN INDEED
Most definitely for the win…with the experimental noise, that could be considered effectively zero. For the win.
In summation, I have read in analog, as intended. Lessons learned? Pretty straight forward I suppose. My cheap-o solar cell is rated for a max of 6V, which I was far under. If I was to use this setup with a stronger light source, I would need to take this into consideration. I didn’t perform any data transformation, as I was not concerned with ‘actual voltage input values’ in this case…merely relative. Most importantly, I was able to knock out the task I had set out to do. Hopefully, I can ride my EE high and get cranking on something awesome, like a netbook robot. With some lasers.