Tuesday, October 16, 2007

measurements for midterm


I set up a test rig to see how much current our circuit was actually pulling. I did this by connecting a 12V DC power supply through my multimeter (measuring current in mA) and connecting the (-) probe of the meter to the (+) pin of the arduino DC power input. If this sounds confusing, it may be because I am being too specific. In other words, I connected the multimeter in series with the DC power input of the arduino. This gave power to the entire LED circuit, and from there I was able to measure the total current pulled by the circuit. Why do this? Because I needed to know how much current a battery needs to supply in order to power the circuit, and based on that amount, I can see how long it will take for a certain battery to fully drain. As can be seen by the picture above, the average current measurement on this circuit (when the LEDs were about medium slow in sequence) was about 42 mA. It is important to note that the current pull through the circuit is greater when the LED sequence is slower. Why might this be? I think it has to do with the fact that the LEDs are turned on longer when the sequence is slower.

I chose a DC power supply over using a standard 9V battery because I couldn't get the battery to work right with the circuit. For some reason, the battery got unneccesarily hot when I tried to connect it in series with a 5V regulator and then the output of the regulator went to the power input on the arduino. I will look into this problem further tomorrow.

Monday, October 15, 2007

Here comes the sun: Issues with solar sensors, and general wonderment for the project

After trying a couple protoype procedures centered around our main sensor, the solar cell, I have come up with a list of issues related to the real-life implementation of such a device:

1. We need to measure how much current the entire circuit is drawing. Why? We need to know how big the battery needs to be in order to power the entire circuit.
2. If the circuit pulls current from the battery quickly, the battery will die before it has the chance to recharge fully from the solar cell. Therefore, we also need to know how long it takes to fully charge the battery.
3. Is it inefficient for us to use a solar cell for both charging a battery and sensing the ambient light outside?
4. The solar cell should be flexible for maximum mounting possibilities. Also, we might need a few solar cells to produce the necessary voltage on the imput of the arduino circuit.

editing and prototyping the midterm design


We've been tailoring our bike reflector design a little bit, and here are some changes. Once the LEDs are turned on and powered up, it would be cool to have a sequencer triggering the lights, so that cars coming from behind the bike rider at night will see movement, perhaps causing them to be more careful with their speed. Eric brought up the idea of incorporating a motion sensor componant, mounted on the bike, so that as the bike slows down, the LEDs start flashing at a different speed or something like that. We still aren't quite sure how we are going to implement the motion sensor (i.e. are we mounting it to the bike? or are we mounting it to the reflector? Here's the code for the arduino, which creates a cool "night rider" effect. Just like David Hasselhoff!

int potPin = 0; // Analog input pin that the potentiometer is attached to
int potValue = 0; // value read from the pot
int pinArray[] = {2, 3, 4, 5, 6, 7};
int count = 0;
int timer = 30;

void setup(){
// initialize serial communications at 9600 bps:
Serial.begin(9600);
for (count=0;count<6;count++) {
pinMode(pinArray[count], OUTPUT);
}
}

void loop() {
potValue = analogRead(potPin); // read the pot value
// analogWrite(timer); // PWM the LED with the pot value (divided by 4 to fit in a byte)
timer= (potValue/4)+1;
Serial.println(potValue); // print the pot value back to the debugger pane
delay(10); // wait 10 milliseconds before the next loop
for (count=0;count<5;count++) {
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count + 1], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer*2);
}
for (count=5;count>0;count--) {
digitalWrite(pinArray[count], HIGH);
delay(timer);
digitalWrite(pinArray[count - 1], HIGH);
delay(timer);
digitalWrite(pinArray[count], LOW);
delay(timer*2);
}
}


And here's a video of the LEDs in action:

Wednesday, October 10, 2007

Some code with that project?


Here's the Arduino code that we've been using for the bike reflector project. It's probably going to change a bit between now and the final stages, but here's what we got right now. Oh, and here's a picture of the group doing some on-site bike reflector research at K Mart.


int potPin = 0; // Analog input pin that the potentiometer is attached to
int potValue = 0; // value read from the pot
int ledPin = 9; // PWM pin that the LED is on. n.b. PWM 0 is on digital pin 9
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}

void loop() {
potValue = analogRead(potPin); // read the pot value
Serial.println(potValue); // print the pot value back to the debugger pane
// wait 10 milliseconds before the next loop
if (potValue<1000) {
//delay(1000);
digitalWrite(ledPin, HIGH);
} else {
// if(potValue<500)
delay(1000);
digitalWrite(ledPin, LOW);

}

}

Midterm rambling


For our midterm project, my group wanted to create something to help the blind. Upon further research we realized that if at any time we did come up with a good idea, it probably was reached much earlier by some lucky designer. So scratch that plan... We set out on a journey through the great wilderness of invention, locked ourselves in an abandoned ITP classroom (it was Columbus Day, after all) and began to write down any terms and ideas we could find. After much deliberation, we decided to design a solar powered, LED bike reflector. The concept is really quite simple, but I'll lay out the initial problem for you anyway:

You are riding your bike in the early evening before the sun sets. As you ride, the sky gets darker and darker, but since you are in a rush to get home, you don't think to turn on your battery powered flashing bike reflector. In this case, cars cannot see you riding the bike in the dark, and you are placing yourself at a major risk of getting run over. What can you do about this?

Well, what if the reflector could sense the amount of light around you, and based on a simple program, turn on flashing LEDs in the reflector without any help from you, the bike rider. What could make this better? How about charging the battery in the smart reflector by solar power?

Here's the plan (see attached picture)

Thursday, October 4, 2007

Analog Out/Servo Control Lab


Here's a small snapshot of my analog out/servo control lab. For my variable resistor, I used a pot rather than anything super fancy like a photosensor, but the results were the same nonetheless. When the pot was fully counter-clockwise the resistance was 0ohms and therefore the analog output to the arduino was essentially 5V. As I moved the pot clockwise, the output voltage to the arduino approached 0V, and thus moved the servo clockwise.

I tried to get creative with this assignment and I imagined a scenario where I could implement a servo like this. I was talking to someone around ITP and he said, "use the servo to open or close something." Since my mind has lately been in my kitchen, specifically improving my efficiency in kitchen appliances, I thought of my garbage can (I know, not really an appliance, but follow me on this one). I have one of those garbage cans that opens when you step on the mechanical lever. I thought, why not replace the lever with a push button or some type of sensor pad so that it sends a pulse to the arduino (let's say a 5V pulse), and then goes through a loop (starting with minPulse=500 and going to maxPulse=2500). With a little help from Hans I sort of figured out how to write this function into the code, however I am still working out the kinks. I posted a video of me activating the servo with a pushbutton. My main obstacle to get over is my lack of programming experience. My background is more centered in electronics, but I would like to make my job easier in the analog domain by figuring out some coding. More to come on the code topic...