I am STILL not dead. Yup, it's been a long time since the last post. Had some very messy personal stuff to take care of. Like a jigsaw puzzle, I think I have a lot of the pieces put back together. Enough about the negative stuff. Let's get back to technology. I will be expanding the scope of this blog to not only include Arduino, but my adventures with Raspberry Pi and Orange Pi. Perhaps some Python development, Perhaps some Java. I will have to learn both languages and you, my dear and long-suffering readers, can follow along.
So, to recap-
1) Blog will still be Arduino
Also
2) Raspberry Pi
3) Orange Pi
4) Python
5) Java
I have some work to do to re-establish a small development area, but I am working on that. I'm not sure if it will be interesting enough to include, but we will see.
I am also considering a Patreon account to help with the funding, so if I get that started, there will be some information in here and some in the Patreon account. I'm still figuring that out, but I need some funding to help these projects along.
I haven't even figured out what my posting schedule will be. I need to set up the development area first.
That's enough for tonight. Do have a good evening.
Tuesday, August 28, 2018
Tuesday, June 28, 2011
Power
Well, the timing issues are resolved to some extent. I was able to control direction and right or left wheel decisions. Unfortunately, it seems I now have a power issue.
I have a 9-volt battery powering the processor, so if the motors drag the battery pack down too much, the processor won't attempt a restart. I experienced that with a Basic Stamp and someone else (I wish I could remember who) told me what the problem was. Processors get their own battery from now on.
The problem that I have experienced is that the 9-volt battery pack, powered by six 1.5 volt AA cells, is a little weak to power two motors at the same time. This design calls for four motors to run simultaneously. I don't have the power for that.
I have a 12-volt gel-cell that I think would do the job, except it would over-power the servo motors. I may try a battery for an R/C race car and see if it delivers better power. The gel-cell is pretty heavy for this chassis and motor torque. In addition, I will build a bus for the power in an attempt to keep a larger-diameter conductor in the power circuit.
More news as it happens. In a future post, I will also talk about modifying the VEX Tumbler design.
I have a 9-volt battery powering the processor, so if the motors drag the battery pack down too much, the processor won't attempt a restart. I experienced that with a Basic Stamp and someone else (I wish I could remember who) told me what the problem was. Processors get their own battery from now on.
The problem that I have experienced is that the 9-volt battery pack, powered by six 1.5 volt AA cells, is a little weak to power two motors at the same time. This design calls for four motors to run simultaneously. I don't have the power for that.
I have a 12-volt gel-cell that I think would do the job, except it would over-power the servo motors. I may try a battery for an R/C race car and see if it delivers better power. The gel-cell is pretty heavy for this chassis and motor torque. In addition, I will build a bus for the power in an attempt to keep a larger-diameter conductor in the power circuit.
More news as it happens. In a future post, I will also talk about modifying the VEX Tumbler design.
Sunday, May 15, 2011
Timing
Well, everyone says it's all about timing. Sometimes, it is.
In this case, the timing is down to milliseconds.
The project at hand is making a VEX platform run with an Arduino microcontroller. Should be simple enough. I looked up the specs for the VEX 3-wire servo motor and found that to control direction and speed is:
• PWM Input:1ms - 2ms will give full reverse to full forward, 1.5ms is neutral
• Dead Band:1.47ms - 1.55m
Simple enough- the dead band yields no revolutions, everything below the dead band turns the motor one direction and everything above turns it another within the 1ms and 2ms ranges. I selected a couple of pins for PWM on the Arduino and wrote some code using the analogWrite() command and worked within 1.00 and 2.00 ms. Or so I thought.
It didn't work.
I stripped the code down to writing directly to a pin with a particular value: analogWrite(10,1.50) and could not make it work. It just would not work.
Well, after getting some assistance, it appears the command should have been analogWrite(10,150) and the range was 100-250 with about 190 as neutral and about 180 to 200 as the dead zone. It's probably closer than that, and maybe I will research it further later, but for now, we are in the ballpark.
There will be more work to do- the motor runs faster in the 120-180 range than it does in the 200-250 range. It also runs in a different direction on each side of neutral, but one way is "forward" and the other is "reverse". I use the quotes because "forward" and "reverse" depend on which side of the chassis the motor is mounted. To move the robot forward, one motor runs "forward" and the other "reverse". at the same absolute value from neutral, the different directions run different speeds.
The result is that with the motors running different speeds, a straight line run becomes very difficult to maintain as the robot will turn in the direction of the slower wheel.
I have more work to do- running two motors draws more current than my circuit wants to deliver and this is a four motor platform.
And we missed the RoboRama because neither my son nor I had a running platform. Not even for show and tell or VEX unlimited class. I really wanted to get this VEX platform running; after all, VEX was kind enough to give it to me- I should get it running.
Pictures soon.
Your Host
In this case, the timing is down to milliseconds.
The project at hand is making a VEX platform run with an Arduino microcontroller. Should be simple enough. I looked up the specs for the VEX 3-wire servo motor and found that to control direction and speed is:
• PWM Input:1ms - 2ms will give full reverse to full forward, 1.5ms is neutral
• Dead Band:1.47ms - 1.55m
Simple enough- the dead band yields no revolutions, everything below the dead band turns the motor one direction and everything above turns it another within the 1ms and 2ms ranges. I selected a couple of pins for PWM on the Arduino and wrote some code using the analogWrite() command and worked within 1.00 and 2.00 ms. Or so I thought.
It didn't work.
I stripped the code down to writing directly to a pin with a particular value: analogWrite(10,1.50) and could not make it work. It just would not work.
Well, after getting some assistance, it appears the command should have been analogWrite(10,150) and the range was 100-250 with about 190 as neutral and about 180 to 200 as the dead zone. It's probably closer than that, and maybe I will research it further later, but for now, we are in the ballpark.
There will be more work to do- the motor runs faster in the 120-180 range than it does in the 200-250 range. It also runs in a different direction on each side of neutral, but one way is "forward" and the other is "reverse". I use the quotes because "forward" and "reverse" depend on which side of the chassis the motor is mounted. To move the robot forward, one motor runs "forward" and the other "reverse". at the same absolute value from neutral, the different directions run different speeds.
The result is that with the motors running different speeds, a straight line run becomes very difficult to maintain as the robot will turn in the direction of the slower wheel.
I have more work to do- running two motors draws more current than my circuit wants to deliver and this is a four motor platform.
And we missed the RoboRama because neither my son nor I had a running platform. Not even for show and tell or VEX unlimited class. I really wanted to get this VEX platform running; after all, VEX was kind enough to give it to me- I should get it running.
Pictures soon.
Your Host
Saturday, May 14, 2011
Arduino VEX
No, I am not dead. And neither is this blog. Yes, there has been a lull in the action lately; OK, for a long time. A friend once told me that "That work junk sure gets in the way of a lot of stuff!" He was right. Work has been overwhelming lately. I won't go into details as that is out of scope for this blog, but work has sapped my creative juices for many months now. I put some big issues to bed and hopefully can do some creative things now.
I would like to thank you for reading my post. I hope to post more often in the future.
Last fall the Dallas Personal Robotics Group (dprg.org) visited Innovation First International( http://www.innovationfirst.com/ ). makers of the VEX Robotics Design System ( http://www.vexrobotics.com/ ). We were treated to an outstanding tour of the facility, met the executives and were generally wowed and overwhelmed. The IFI folks were kind enough to hand out some valuable kits as we left. It was my understanding that we (the DPRG folks) were to take the kits and stress them somewhat. It seems that the kids in competition won't stress the kits. It would appear that stressing a kit to the point of failure would keep a school VEX team out of competition, so I can see why they don't do it. Our competitions are different, without so much on the line, so IFI has asked us for some stress testing.
I am getting to an Arduino tie-in here...
In particular, the IFI guys were interested in VEX robots running on some other processors, including Arduino. As I am one of "the Arduino guys", I received a VEX Protobot kit. This solves a major problem for me in that I find the programming kind of easy, but the engineering is problematic for me. With a rolling platform in kit form, the hard work (for me) is done. All I have to do is wire it up and program it. Right.
So, the project needs a name. VEX-duino? Maybe not.
I used the Protobot kit to build the tumbler chassis. It is a steel chassis with four servo motors driving four wheels. It was a simple enough kit to assemble. I will cover more as I move along, but the robot is a tumbler with an Arduino microcontroller and the first task will be to build it for competition in the "Square Dance" event for RoboRama 2011a- a twice-yearly event offered by DPRG. Rules are here: https://docs.google.com/document/pub?id=1NqZZQ4MnlD9Y1EGsEvkvKFXNPVXpH45YAd_l338y-3o&pli=1
More on this project later.
Once again- thanks for reading!
Your host
I would like to thank you for reading my post. I hope to post more often in the future.
Last fall the Dallas Personal Robotics Group (dprg.org) visited Innovation First International( http://www.innovationfirst.com/ ). makers of the VEX Robotics Design System ( http://www.vexrobotics.com/ ). We were treated to an outstanding tour of the facility, met the executives and were generally wowed and overwhelmed. The IFI folks were kind enough to hand out some valuable kits as we left. It was my understanding that we (the DPRG folks) were to take the kits and stress them somewhat. It seems that the kids in competition won't stress the kits. It would appear that stressing a kit to the point of failure would keep a school VEX team out of competition, so I can see why they don't do it. Our competitions are different, without so much on the line, so IFI has asked us for some stress testing.
I am getting to an Arduino tie-in here...
In particular, the IFI guys were interested in VEX robots running on some other processors, including Arduino. As I am one of "the Arduino guys", I received a VEX Protobot kit. This solves a major problem for me in that I find the programming kind of easy, but the engineering is problematic for me. With a rolling platform in kit form, the hard work (for me) is done. All I have to do is wire it up and program it. Right.
So, the project needs a name. VEX-duino? Maybe not.
I used the Protobot kit to build the tumbler chassis. It is a steel chassis with four servo motors driving four wheels. It was a simple enough kit to assemble. I will cover more as I move along, but the robot is a tumbler with an Arduino microcontroller and the first task will be to build it for competition in the "Square Dance" event for RoboRama 2011a- a twice-yearly event offered by DPRG. Rules are here: https://docs.google.com/document/pub?id=1NqZZQ4MnlD9Y1EGsEvkvKFXNPVXpH45YAd_l338y-3o&pli=1
More on this project later.
Once again- thanks for reading!
Your host
Saturday, October 16, 2010
IFI Field Trip
No, I am not dead; just having some trouble getting forward motion on the Arduino project. Work has kept me underwater for some time- I haven't been able to post to TheNonProfitDirector.blogspot.com for a few weeks. There will be posts there soon as there has been a lot of activity at work.
What happened today was an absolutely wonderful field trip to Innovation First International (IFI) in Greenville, Texas. IFI has multiple product lines at the World Headquarters in Greenville: Rack Solutions that designs and produces custom solutions for rack mount problems, HEXBUG and the VEX robotics platform. As a member of the DPRG field trip to IFI, we were most interested in the VEX line, but I would be remiss if I did not mention that they apply rapid prototyping to their development; extremely rapid prototyping that can shut down production equipment for a special run on the prototype for development. They also produce toys in the HEXBUG line that they conceive and develop in a month or so and then send the product overseas for tooling setup.
The VEX line is primarily focused on education; robotics education, that is. It's a terrific teaching tool that has roots in E-Systems and Erector sets. What has come out is an extremely flexible system of engineering a robot (or robots) that can be developed by a middle-school student.
IFI was extremely generous with their time and their products during our visit. They took the time to answer all of our questions and provided us with a guided tour of the entire facility. Before we left, those that were interested were allowed to take home Cortex and ProtoBot bundles.
I will be blogging here on the use of the Arduino with the ProtoBot. IFI has asked that we provide feedback to them if we take a VEX product with us. That's a deal that is hard to beat.
So, hats off to Bob and the gang at IFI- thank you for hosting us and providing a tour of your facility! It is my hope that IFI and DPRG will have a long history together.
What happened today was an absolutely wonderful field trip to Innovation First International (IFI) in Greenville, Texas. IFI has multiple product lines at the World Headquarters in Greenville: Rack Solutions that designs and produces custom solutions for rack mount problems, HEXBUG and the VEX robotics platform. As a member of the DPRG field trip to IFI, we were most interested in the VEX line, but I would be remiss if I did not mention that they apply rapid prototyping to their development; extremely rapid prototyping that can shut down production equipment for a special run on the prototype for development. They also produce toys in the HEXBUG line that they conceive and develop in a month or so and then send the product overseas for tooling setup.
The VEX line is primarily focused on education; robotics education, that is. It's a terrific teaching tool that has roots in E-Systems and Erector sets. What has come out is an extremely flexible system of engineering a robot (or robots) that can be developed by a middle-school student.
IFI was extremely generous with their time and their products during our visit. They took the time to answer all of our questions and provided us with a guided tour of the entire facility. Before we left, those that were interested were allowed to take home Cortex and ProtoBot bundles.
I will be blogging here on the use of the Arduino with the ProtoBot. IFI has asked that we provide feedback to them if we take a VEX product with us. That's a deal that is hard to beat.
So, hats off to Bob and the gang at IFI- thank you for hosting us and providing a tour of your facility! It is my hope that IFI and DPRG will have a long history together.
Sunday, September 12, 2010
Still alive and well
Just a short post to let you know this blog is still alive and well. Activity on the Arduino project has been swallowed up in work assignments. There is some urgencyin getting this class finished, so I am hoping ot have more fun and games posted soon!
Thank you for your patience!
Thank you for your patience!
Sunday, May 16, 2010
More Arduino Reading Optical
Here's a code snippet for you, all dirty and messy. It will be cleaned up prior to inclusion in the class. Currently working on including the TSL230R Light-to-Frequency Converter with code shamelessly borrowed from:
http://roamingdrone.wordpress.com/2008/11/13/arduino-and-the-taos-tsl230r-light-sensor-getting-started/
I will probably use the code as-is. It handles this device as an interrupt process, and handling interrupts was an intention of the class.
I have this mystery phototransistor from Tanners. No datasheed can be found by several people working on int and Tanners sells the item "No data". It looks like a TO-18 case with a glass top, so I will assume that the connections are the same. It has a base pin, it would seem, which I thought was odd as I thought that that base was controlled by light. I have several, so I will experiment with a few, but I'm not sure how I will know if I have destroyed one or not. I think I may skip this one for another day and leave it out of the class.
----- Code 4 You -------
/*
IR1
*
detects moving infrared with PIR. Upon sensing, checks light level with Light Dependent Resistor (Cadmium photocell) and then uses infrared rangefinding to determine range of object.
*/
int IRrangePin = 0; // select the input pin for the potentiometer
int inPin = 1; // select pin for IR detector (analog)
int LRpin = 2; //select analog pin for LDR
int ledPin1 = 13; // select the pin for the LED
int ledPin2 = 12; // second led
int ledPin3 = 11; // third led
int val = 0; // variable to store the value coming from the sensor
int dval = 0; // variable to store valud from IR detect
int Lval = 0; // Variable for use with LDR
int NewVal = 0; // Work variable
void setup() {
Serial.begin(9600);
Serial.println("Setup. ");
pinMode(ledPin1, OUTPUT); // declare the ledPin1 as an OUTPUT
pinMode(ledPin2, OUTPUT); // declare the ledPin2 as an OUTPUT
pinMode(ledPin3, OUTPUT); // declare the ledPin3 as an OUTPUT
pinMode(inPin, INPUT); // declare the Infrared detect pin as an INPUT
pinMode(LRpin, INPUT); // declare teh LDR pin as an INPUT
digitalWrite(ledPin3, LOW); // full on
}
void loop() {
dval=LOW;
detect();
val = analogRead(IRrangePin); // read the value from the sensor
/*
Serial.print("Proximity: "); Serial.println(val);
digitalWrite(ledPin1, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin1, LOW); // turn the ledPin off
*/
delay(val); // stop the program for some time
}
void detect()
{
delay(100);
dval = analogRead(inPin); // read input from IR detector
//Serial.print(dval);
if (dval>0)
{
Serial.println();
Serial.print(" Detection >YES. ");
digitalWrite(ledPin2, HIGH); // turn the ledPin on
LDR();
findRange();
}
if (dval<=0)
{
Serial.print(".");
digitalWrite(ledPin2, LOW); // turn the ledPin off
}
delay(200);
}
void LDR(){
Lval = analogRead(LRpin);
Serial.print(" LDR: "); Serial.print(Lval); Serial.print(" ");
analogWrite(ledPin3,(75+Lval));
delay(100);
}
void findRange(){
val = analogRead(IRrangePin); // read the value from the sensor
NewVal = val/100;
Serial.print("Proximity: "); Serial.print(val);
switch (NewVal) {
case 0:
//far away
Serial.print(" Too far. ");
break;
// break is optional
case 1:
//do something when var == 1
Serial.print(" Zone 1. ");
break;
case 2:
//do something when var == 2
Serial.print(" Zone 2. ");
break;
case 3:
//do something when var == 3
Serial.print(" Zone 3. ");
break;
case 4:
//do something when var == 4
Serial.print(" Zone 4. ");
break;
case 5:
//do something when var == 5
Serial.print(" Zone 5. ");
break;
case 6:
//do something when var == 6
Serial.print(" Zone 6. ");
break;
case 7:
//do something when var == 7
Serial.print(" Zone 7. ");
break;
default:
// if nothing else matches, do the default
// default is optional
Serial.print(" Unknown. ");
}
Serial.println();
digitalWrite(ledPin1, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin1, LOW); // turn the ledPin off
delay(val); // stop the program for some time
}
http://roamingdrone.wordpress.com/2008/11/13/arduino-and-the-taos-tsl230r-light-sensor-getting-started/
I will probably use the code as-is. It handles this device as an interrupt process, and handling interrupts was an intention of the class.
I have this mystery phototransistor from Tanners. No datasheed can be found by several people working on int and Tanners sells the item "No data". It looks like a TO-18 case with a glass top, so I will assume that the connections are the same. It has a base pin, it would seem, which I thought was odd as I thought that that base was controlled by light. I have several, so I will experiment with a few, but I'm not sure how I will know if I have destroyed one or not. I think I may skip this one for another day and leave it out of the class.
----- Code 4 You -------
/*
IR1
*
detects moving infrared with PIR. Upon sensing, checks light level with Light Dependent Resistor (Cadmium photocell) and then uses infrared rangefinding to determine range of object.
*/
int IRrangePin = 0; // select the input pin for the potentiometer
int inPin = 1; // select pin for IR detector (analog)
int LRpin = 2; //select analog pin for LDR
int ledPin1 = 13; // select the pin for the LED
int ledPin2 = 12; // second led
int ledPin3 = 11; // third led
int val = 0; // variable to store the value coming from the sensor
int dval = 0; // variable to store valud from IR detect
int Lval = 0; // Variable for use with LDR
int NewVal = 0; // Work variable
void setup() {
Serial.begin(9600);
Serial.println("Setup. ");
pinMode(ledPin1, OUTPUT); // declare the ledPin1 as an OUTPUT
pinMode(ledPin2, OUTPUT); // declare the ledPin2 as an OUTPUT
pinMode(ledPin3, OUTPUT); // declare the ledPin3 as an OUTPUT
pinMode(inPin, INPUT); // declare the Infrared detect pin as an INPUT
pinMode(LRpin, INPUT); // declare teh LDR pin as an INPUT
digitalWrite(ledPin3, LOW); // full on
}
void loop() {
dval=LOW;
detect();
val = analogRead(IRrangePin); // read the value from the sensor
/*
Serial.print("Proximity: "); Serial.println(val);
digitalWrite(ledPin1, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin1, LOW); // turn the ledPin off
*/
delay(val); // stop the program for some time
}
void detect()
{
delay(100);
dval = analogRead(inPin); // read input from IR detector
//Serial.print(dval);
if (dval>0)
{
Serial.println();
Serial.print(" Detection >YES. ");
digitalWrite(ledPin2, HIGH); // turn the ledPin on
LDR();
findRange();
}
if (dval<=0)
{
Serial.print(".");
digitalWrite(ledPin2, LOW); // turn the ledPin off
}
delay(200);
}
void LDR(){
Lval = analogRead(LRpin);
Serial.print(" LDR: "); Serial.print(Lval); Serial.print(" ");
analogWrite(ledPin3,(75+Lval));
delay(100);
}
void findRange(){
val = analogRead(IRrangePin); // read the value from the sensor
NewVal = val/100;
Serial.print("Proximity: "); Serial.print(val);
switch (NewVal) {
case 0:
//far away
Serial.print(" Too far. ");
break;
// break is optional
case 1:
//do something when var == 1
Serial.print(" Zone 1. ");
break;
case 2:
//do something when var == 2
Serial.print(" Zone 2. ");
break;
case 3:
//do something when var == 3
Serial.print(" Zone 3. ");
break;
case 4:
//do something when var == 4
Serial.print(" Zone 4. ");
break;
case 5:
//do something when var == 5
Serial.print(" Zone 5. ");
break;
case 6:
//do something when var == 6
Serial.print(" Zone 6. ");
break;
case 7:
//do something when var == 7
Serial.print(" Zone 7. ");
break;
default:
// if nothing else matches, do the default
// default is optional
Serial.print(" Unknown. ");
}
Serial.println();
digitalWrite(ledPin1, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin1, LOW); // turn the ledPin off
delay(val); // stop the program for some time
}
Tuesday, May 11, 2010
Arduino Reading Optical
Here is what is currently in production for the Arduino project. It is a draft and not finished work.
Reading Optical
Many optical devices are analog and not digital. The task is often to convert the response of the analog device into a more-or-less digital response. In the application of the analog devices in this segment, the analog pins on the Arduino chip will be used. Pins 0, 1 and 2 will be used. The analog pins on the Arduino read the input voltage from the device and convert into a numeric value.
The Arduino reference manual states, “This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit.”
Note that the voltages are still between 0 and 5 volts. Be careful not to fry your Arduino.
The numeric values from the analog pins may then be tested and branched using ranges of values and a case statement; an “if” structure will also work. Synthesizing digital action from an analog device merely means that the voltage has crossed a certain threshold; the number returned from the pin has passed a certain value and a test becomes true of false accordingly.
Goal
Instruct the student on input sensors- light (including optical encoder), switches and potentiometer. Optical encoders and switches are the “more binary” devices in the group; other items are “more analog”
Prerequisites
No prerequisites beyond the basic Breadboard Arduino class. These programs cover new material for this class and do not build on previous material.
Method
Cover analog versus digital input. Reiterate voltage capacities of the Arduino (0-5 volts). More information is available through the serial output than with LEDs in this segment.
Notes
There are multiple circuits on this board. Neither takes up much breadboard space or pins on the Arduino. If the infrared rangefinder is the Sharp brand, then a connector will most likely need to be built. In this case, a three pin, 0.10 inch pitch header pin was soldered to the end of the special pigtail for the sensing unit. After soldering, insulation and stability were needed, so a blob of hot-melt glue was added to the header pin.
The Parallax PIR unit, without a pigtail will only fit on the corner of the board due to I/O pin placement and jumper pin placement. A couple of ling wires are needed to connect to the Arduino. Other components are fairly straightforward.
The programs have some serial output to be displayed on the computer monitor. Power indicators may be left off.
The Class
Optical sensors are sensitive to light. Infrared (IR) has been grouped into this segment as it is looked at as both heat and light. It is light that cannot be seen with the naked eye, but certain electronic devices are sensitive to it. The remote control for your television is an IR device. For some reason, cameras on cell phones are sensitive to IR light. If you aim your TV remote at your cell phone camera, you will be able to see the light produced by the remote. There is more going on than just an IR flashlight, but at least you can verify that the batteries are not dead.
In this class, there are three devices- a simple photo resistor that passes power as a function of the amount of light striking it. This particular device is translucent and as such, is also sensitive to some of the light striking the back of the device. As more light strikes the surface, the resistance lowers. When the resistance lowers, more voltage appears on the Arduino analog pin and the Arduino returns a higher numerical value.
The infrared rangefinder uses reflected infrared light to determine range up to about 50 inches. Since it is using light, it is also susceptible to interference- things that would also get in the way of visible light. It is also sensitive to the color of the reflective surface. If sensing people, different colored clothing will yield different responses. It is not an exact science.
The Passive Infrared (PIR) device works the same way as the motion detector lights that light your driveway when someone walks by. It has a series of Fresnel lenses over an IR-sensitive device. When the device senses IR moving from one lens to another, a signal is produced. This device is also sensitive to distance. This particular PIR is a Parallax device designed for hobbyists.
Reading Optical
Many optical devices are analog and not digital. The task is often to convert the response of the analog device into a more-or-less digital response. In the application of the analog devices in this segment, the analog pins on the Arduino chip will be used. Pins 0, 1 and 2 will be used. The analog pins on the Arduino read the input voltage from the device and convert into a numeric value.
The Arduino reference manual states, “This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit.”
Note that the voltages are still between 0 and 5 volts. Be careful not to fry your Arduino.
The numeric values from the analog pins may then be tested and branched using ranges of values and a case statement; an “if” structure will also work. Synthesizing digital action from an analog device merely means that the voltage has crossed a certain threshold; the number returned from the pin has passed a certain value and a test becomes true of false accordingly.
Goal
Instruct the student on input sensors- light (including optical encoder), switches and potentiometer. Optical encoders and switches are the “more binary” devices in the group; other items are “more analog”
Prerequisites
No prerequisites beyond the basic Breadboard Arduino class. These programs cover new material for this class and do not build on previous material.
Method
Cover analog versus digital input. Reiterate voltage capacities of the Arduino (0-5 volts). More information is available through the serial output than with LEDs in this segment.
Notes
There are multiple circuits on this board. Neither takes up much breadboard space or pins on the Arduino. If the infrared rangefinder is the Sharp brand, then a connector will most likely need to be built. In this case, a three pin, 0.10 inch pitch header pin was soldered to the end of the special pigtail for the sensing unit. After soldering, insulation and stability were needed, so a blob of hot-melt glue was added to the header pin.
The Parallax PIR unit, without a pigtail will only fit on the corner of the board due to I/O pin placement and jumper pin placement. A couple of ling wires are needed to connect to the Arduino. Other components are fairly straightforward.
The programs have some serial output to be displayed on the computer monitor. Power indicators may be left off.
The Class
Optical sensors are sensitive to light. Infrared (IR) has been grouped into this segment as it is looked at as both heat and light. It is light that cannot be seen with the naked eye, but certain electronic devices are sensitive to it. The remote control for your television is an IR device. For some reason, cameras on cell phones are sensitive to IR light. If you aim your TV remote at your cell phone camera, you will be able to see the light produced by the remote. There is more going on than just an IR flashlight, but at least you can verify that the batteries are not dead.
In this class, there are three devices- a simple photo resistor that passes power as a function of the amount of light striking it. This particular device is translucent and as such, is also sensitive to some of the light striking the back of the device. As more light strikes the surface, the resistance lowers. When the resistance lowers, more voltage appears on the Arduino analog pin and the Arduino returns a higher numerical value.
The infrared rangefinder uses reflected infrared light to determine range up to about 50 inches. Since it is using light, it is also susceptible to interference- things that would also get in the way of visible light. It is also sensitive to the color of the reflective surface. If sensing people, different colored clothing will yield different responses. It is not an exact science.
The Passive Infrared (PIR) device works the same way as the motion detector lights that light your driveway when someone walks by. It has a series of Fresnel lenses over an IR-sensitive device. When the device senses IR moving from one lens to another, a signal is produced. This device is also sensitive to distance. This particular PIR is a Parallax device designed for hobbyists.
Monday, May 10, 2010
Package from Sparkfun redux
It came- hooray for Sparkfun! Well, it probably came on Friday, but I wasn't there to receive it. I had it shipped to work thinking for some reason that it would get int my hands faster. In reality, the opposite was true. I received five twenty-eight pin chips with the little red dot. Now, I have to find out how to return the non-arduino chips. I'm pretty sure they have a procedure for that.
So, the big lesson here is that Sparfun made a boo-boo. Hey- it happens. The important thing is that they corrected the situation in a timely manner. When you next need electronic components- how about checking http://www.sparkfun.com/ first?
I should get back to work.
So, the big lesson here is that Sparfun made a boo-boo. Hey- it happens. The important thing is that they corrected the situation in a timely manner. When you next need electronic components- how about checking http://www.sparkfun.com/ first?
I should get back to work.
Monday, May 3, 2010
Arduino Light Dependent Resistor
Well, tonight, the board has a light dependent resistor (LDR). Only two of the three leads are used, so it's a little tacky, but this is, after all, prototyping. It will be cleaned up later- functionality is the name of the game right now. The analog value returned from the LDR drops with the light level. Using this value will enable the implementation of a small night-light circuit rather easily.
The easiest approach is to take the value returned from the LDR and feed it into an analogWrite command and use PWM to alter the brightness of the LED. Doing this directly would normally dim the LED as the light was dimmed. The LED was reversed and now operates as the inverse of the value read from the LDR. That is, as the light dims, the LDR returns a lower value, that value is fed into the analogWrite command and as the value drops, the LED gets brighter. Quick, easy, effective.
Here is the code in action:
Here is the board in action:
The easiest approach is to take the value returned from the LDR and feed it into an analogWrite command and use PWM to alter the brightness of the LED. Doing this directly would normally dim the LED as the light was dimmed. The LED was reversed and now operates as the inverse of the value read from the LDR. That is, as the light dims, the LDR returns a lower value, that value is fed into the analogWrite command and as the value drops, the LED gets brighter. Quick, easy, effective.
Here is the code in action:
Here is the board in action:
Happy breadboarding!
Sunday, May 2, 2010
Arduino Infrared
OK-
Nothing from Sparkfun yet, but weekend delivery was not expected- They need time to respond. So the next best thing was to borrow an Arduino off another board and get moving again.
The current project is an optical board with Arduino. Starting with infrared which may not actually be classified as optical, but it will be for this board. Passive Infrared (PIR) coupled with an infrared rangefinder makes sort of a neat human detector (or dog, cat, rats, what-have-you). Currently, the two items operate independently, but the code will be changed to let the PIR drive. If a heat source is sensed, then the rangefinder will be engaged. Perhaps. There are other approaches.
For your viewing pleasure, here is a picture of the board so far. It's a little blurry, but you should be able to get the point.
More news as it happens.
Nothing from Sparkfun yet, but weekend delivery was not expected- They need time to respond. So the next best thing was to borrow an Arduino off another board and get moving again.
The current project is an optical board with Arduino. Starting with infrared which may not actually be classified as optical, but it will be for this board. Passive Infrared (PIR) coupled with an infrared rangefinder makes sort of a neat human detector (or dog, cat, rats, what-have-you). Currently, the two items operate independently, but the code will be changed to let the PIR drive. If a heat source is sensed, then the rangefinder will be engaged. Perhaps. There are other approaches.
For your viewing pleasure, here is a picture of the board so far. It's a little blurry, but you should be able to get the point.
The PIR is at the bottom right, the IR rangefinder is at the upper right with the cable pinned under the breadboard. The LEDs indicate the power is on for the PIR and it has sensed motion, and power is on for the IR rangefinder and it has not yet been engaged.
More news as it happens.
Friday, April 30, 2010
Another Sparkfun Response
OK- from the previous post, it would seem that Sparkfun made a boo-boo and is doing the right thing to fix it. Hurray for Sparkfun!
While I am composing the last post, this email comes in (I left off the email headerinformation because it was a pain to post as it kept gagging the HTML):
Hello Bruce,
Our returns department finished testing the ATmega328s you returned to us, and found that they had somehow made it out without the Arduino Bootloader having been loaded. I have placed a new order, # 21xxxx, which contains five ATmega328, DEV-09217.
Please let me know if I can help with anything else, and have a great day!
Best,
L (Sparkfun rep name)
Customer Service
SparkFun Electronics
Now- I have not yet returned anything, but they have tested them. I think I will wait and see what comes in the mail. Sparkfun may be experiencing growing pains- that's OK; it happens. Let's see how they handle it. I believe they will make everything right, it just may take another pass at the problem to get there.
While I am composing the last post, this email comes in (I left off the email headerinformation because it was a pain to post as it kept gagging the HTML):
Hello Bruce,
Our returns department finished testing the ATmega328s you returned to us, and found that they had somehow made it out without the Arduino Bootloader having been loaded. I have placed a new order, # 21xxxx, which contains five ATmega328, DEV-09217.
Please let me know if I can help with anything else, and have a great day!
Best,
L (Sparkfun rep name)
Customer Service
SparkFun Electronics
Now- I have not yet returned anything, but they have tested them. I think I will wait and see what comes in the mail. Sparkfun may be experiencing growing pains- that's OK; it happens. Let's see how they handle it. I believe they will make everything right, it just may take another pass at the problem to get there.
Sparkfun Response
Received from Sparkfun:
Subject: Re: [FWD: SparkFun Order 21xxxx]
From: Tech Support
Date: Fri, April 30, 2010 10:16 am
To: "Your Host"
Hi Bruce,
I talked to customer service, they should be sending you out 5 replacement ATMega328s with the bootloader and a return label for the 5 unprogrammed ones. Sorry for the inconvenience this has caused.
Thanks,
P (Sparkfun rep name)
Subject: Re: [FWD: SparkFun Order 21xxxx]
From: Tech Support
Date: Fri, April 30, 2010 10:16 am
To: "Your Host"
Hi Bruce,
I talked to customer service, they should be sending you out 5 replacement ATMega328s with the bootloader and a return label for the 5 unprogrammed ones. Sorry for the inconvenience this has caused.
Thanks,
P (Sparkfun rep name)
Monday, April 26, 2010
Sent to Sparkfun
Subject: [FWD: SparkFun Order 2xxxxx]
Date: Mon, April 26, 2010 11:39 pm
To: customerservice@sparkfun.com
Good day.
I received my latest order from Sparkfun. I had some spark, but unfortunately, no fun.
On my previous order, I received Arduino 328 chips. All were marked with a red dot but one. I had my doubts, so I reserved it. When attempting a project with the unmarked chip, it would not load. OK, I still needed some more Arduino chips, so I ordered four more- Order 2xxxxx. I received the four chips I ordered, but none were marked. I removed one from the package and tested it- it would not load.
Here is what I did to test:
1) Took a known good circuit and removed the Arduino
2) Installed the unmarked Arduino
3) Recompiled the code
4) Attempted to download
5) Received the following error:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
6) Powered down
7) reinstalled the known good chip
8) Powered up, recompiled code
9) Downloaded code
10) Code executed as expected
I think none of these chips has the Arduino bootloader loaded on, even though my packing list has a certification of compliance signed by the Customer Service Manager. What do you think?
I am attempting to write a class using Arduino chips, but that is rather difficult when they are not the correctly configured chip and my deadlines are slipping. I now have 5 chips that are not what I purchased. What can you do to rectify this situation?
Sincerely,
Date: Mon, April 26, 2010 11:39 pm
To: customerservice@sparkfun.com
Good day.
I received my latest order from Sparkfun. I had some spark, but unfortunately, no fun.
On my previous order, I received Arduino 328 chips. All were marked with a red dot but one. I had my doubts, so I reserved it. When attempting a project with the unmarked chip, it would not load. OK, I still needed some more Arduino chips, so I ordered four more- Order 2xxxxx. I received the four chips I ordered, but none were marked. I removed one from the package and tested it- it would not load.
Here is what I did to test:
1) Took a known good circuit and removed the Arduino
2) Installed the unmarked Arduino
3) Recompiled the code
4) Attempted to download
5) Received the following error:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
6) Powered down
7) reinstalled the known good chip
8) Powered up, recompiled code
9) Downloaded code
10) Code executed as expected
I think none of these chips has the Arduino bootloader loaded on, even though my packing list has a certification of compliance signed by the Customer Service Manager. What do you think?
I am attempting to write a class using Arduino chips, but that is rather difficult when they are not the correctly configured chip and my deadlines are slipping. I now have 5 chips that are not what I purchased. What can you do to rectify this situation?
Sincerely,
Testing the Unknown
Not what I wanted to see:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
Looks like my backup chip really is not an Arduino.
Neither are the chips in the new order.
I took a known good circuit with a known good Arduino in it, removed the Arduino and replaced it with an unmarked chip. I recompiled the code and tried to download it. I received the error above. I powered down, swapped the known good chip back in, powered up, recompiled, loaded to the chip and the program ran as expected.
Time to contact Sparkfun.
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
Looks like my backup chip really is not an Arduino.
Neither are the chips in the new order.
I took a known good circuit with a known good Arduino in it, removed the Arduino and replaced it with an unmarked chip. I recompiled the code and tried to download it. I received the error above. I powered down, swapped the known good chip back in, powered up, recompiled, loaded to the chip and the program ran as expected.
Time to contact Sparkfun.
Package from Sparkfun
The package from Sparkfun arrived today. I need to do some testing. On the last order, all the chips were marked with a red dot, except one. The unmarked chip does not appear to have the Arduino bootloader on it. I will run one more test on it. None of the chips that arrived today were marked. I hope they just forgot to mark them.
I am hopeful that I can start on the Arduino project again- I have ideas and need to implement them!
Slightly out-of-focus pictures below tell the story better.
I am hopeful that I can start on the Arduino project again- I have ideas and need to implement them!
Slightly out-of-focus pictures below tell the story better.
Marked Arduino on left, Unmarked, probably not Arduino on right.
Unmarked chips. Hoping for bootloaders.
Since we are on the topic, it has been bbrought to my attention that one may construct an Arduino bootloader burner rather easily. This may be something to add to the end of the class. If I have an order of plain AtmelATMega 328 chips, then I may have to do this. Not without a call to Sparkfun first.
Saturday, April 24, 2010
Anticipation
Not much going on right now. Awaiting the delivery of new Arduinos from Sparkfun. My last adventure cost me an Arduino, if you remember. I will have A new Arduino as well as a few spares now. More posts as things move forward.
Saturday, April 17, 2010
Good day at The Generator
Today is the last Saturday of National Robotics Week. DPRG marked that date with an event at The Generator, a coffee shop in downtown Garland. the Arduino project made an appearance as well. There would have been one more Arduinp project board, but trying to get the board running at 6:30 this morning, a careless application of 12 volts was made, and that particular Arduino chip is no more. My backup chip, it turns out, may be a wonderful ATMega 328, but it is no Arduino. Maybe at one point, I will learn how to put the bootloader on the ATMega, but not today. Time for another order from Sparkfun.
The Arduino appeared in a rare, shared-power configuration. The Cylon board already had a voltage regulator on it, the Ping did not. These particular boards will snap together, so they were shapped and a jumper was run between the positive and negative 5-volt buses on each board. It would have looked great with the switching board in the middle, but that was not to be today.
The Arduino appeared in a rare, shared-power configuration. The Cylon board already had a voltage regulator on it, the Ping did not. These particular boards will snap together, so they were shapped and a jumper was run between the positive and negative 5-volt buses on each board. It would have looked great with the switching board in the middle, but that was not to be today.
Friday, April 9, 2010
RBNO
It's been a busy week.
Tuesday night was a productive night at Robot Builders Night Out (RBNO), a weekly gathering of DPRG (Dallas Personal Robotics Group http://www.dprg.org/ ) members. I finished a basic Arduino breadboard for the next class session. The next task is to see how much junk I can cram onto this board. It is sitting in front of me and the only additions are the USB to TTL converter and a phototransistor.
There have only been minimal changes made to the class, so there isn't much to report there.
Hopefully, I can make some progress this weekend and have more to report to you.
Tuesday night was a productive night at Robot Builders Night Out (RBNO), a weekly gathering of DPRG (Dallas Personal Robotics Group http://www.dprg.org/ ) members. I finished a basic Arduino breadboard for the next class session. The next task is to see how much junk I can cram onto this board. It is sitting in front of me and the only additions are the USB to TTL converter and a phototransistor.
There have only been minimal changes made to the class, so there isn't much to report there.
Hopefully, I can make some progress this weekend and have more to report to you.
Monday, April 5, 2010
Arduino Project Checkpoint
Well, maybe I haven't been quite fair with you. Much of the work of the Arduino Project has been completed; at least as a draft. You have gotten to see snippets of the document without getting anything complete. I won't apologize for that as it is still a working document. I can't share the document at this point as I am working with someone else on this and have not discussed the topic with him.
What I will do is share the table of contents with you. I know, it isn't much, but you can get a feel for how things are progressing. The section on reading input has not been started yet. I need to build the board, write the class and the programs.
If you happen to be within the reach of the Dallas Personal Robotics Group (http://www.dprg.org/), then please consider taking the introductory class and getting that under your belt. If you happen to BE a DPRG member, so much the better. If you are NOT YET a member of DPRG, visit the website and sign up! We do a lot of interesting things and have a lot of fun.
There are still a lot of detail items to complete before this class can be offered, but forward motion is being made; please have patience and the class should be available soon!
Remember- this is a DRAFT!
The Table of Contents is really tiny as that is the size I had to select to get the TOC to fit on the page. Go get your reading glasses and check it out.
Here is the Table of Contents:
What I will do is share the table of contents with you. I know, it isn't much, but you can get a feel for how things are progressing. The section on reading input has not been started yet. I need to build the board, write the class and the programs.
If you happen to be within the reach of the Dallas Personal Robotics Group (http://www.dprg.org/), then please consider taking the introductory class and getting that under your belt. If you happen to BE a DPRG member, so much the better. If you are NOT YET a member of DPRG, visit the website and sign up! We do a lot of interesting things and have a lot of fun.
There are still a lot of detail items to complete before this class can be offered, but forward motion is being made; please have patience and the class should be available soon!
Remember- this is a DRAFT!
The Table of Contents is really tiny as that is the size I had to select to get the TOC to fit on the page. Go get your reading glasses and check it out.
Here is the Table of Contents:
Subscribe to:
Posts (Atom)



