The photocell should work, not sending data, just a simple HIGH/LOW..
Just in case you do not have the link.
http://www.picbasic.co.uk/forum/showthread.php?t=5874
The photocell should work, not sending data, just a simple HIGH/LOW..
Just in case you do not have the link.
http://www.picbasic.co.uk/forum/showthread.php?t=5874
Dave
Always wear safety glasses while programming.
I'm not getting my analog voltage comparator act together.
I want the teacher, at race time, to certify that each car will respond correctly to the bright lights at the beginning and end of the maze.
The photoresister R/C to PIC toggling threshold should be calibrated per car.
The PICkit2 comes with a built in pot attached to pin RA0. Each car while being exposed to the bright light could have its pot turned with a long handled screw driver (avoiding shadows) to the point that the car's control toggles.
This translates to a voltage comparison between the input of RA0 and RA1. The photoresister 10807 reduces its resistance in bright light from 5k down to near 500 ohms If I build a voltage divider with a 5k resistor to Vss = 5V and the 10807 to Gnd and attach it to RA1 will that do the trick? It would give the PIC a swing of about 2V not figuring the input impedance of the PIC.
I've got a some of questions.
First, does the above make sense?
Second, do any of you know some PBP code that does a similar comparison?
Three, I believe I will need to smooth out noise during the transition as the car comes into and leaves the bright light? How would you suggest I do that?
Ken
Yes.First, does the above make sense?
I do not have any code but here is how I might try setting it up.Second, do any of you know some PBP code that does a similar comparison?
First add a switch on the car and code for the switch at power-up. Also add a LED for calibration indicator.
If switch is HIGH then ADC_SETUP routine. The code will go here once and never loop back to it.
Inside the SET_UP routine have the drive wheels turned off and sub loop reading the ADC from the light and the "calibration" pot.
Have it coded so when the reading from the light and pot are equal with in a certain amount (exact will be difficult) the calibration LED come on.
Then when the calibration switch is turned off the code will go to EXIT_SETUP. This routine will save the ADC reading from the pot to EEPROM then goto the main program.
Now the main program will read the EEPROM to get the value to use for light checking. The reason for EEPROM writing is you will only have to "setup" once and not have to do the setup every time the car is turned on. Maze changes do another SET_UP.
Turn to the students and say "SSHHH"Three, I believe I will need to smooth out noise during the transition as the car comes into and leaves the bright light? How would you suggest I do that?
Are you meaning light noise? If so this is where the ADC needs to be with in a certain amount so a small range of "bright" light will do the triggering. This partwill take some experimentation for car speed and othe on site variables.
Dave
Always wear safety glasses while programming.
I took the car to a TV studio today. It was going to be on Access television. I brought the laptop computer and the USB connector. I forgot the battery charger. The car had not been charged for a couple of days. Big mistake.
At the beginning it did just as I thought I had told it, but then as time went on it crashed more, got stuck more. I chose not to do the TV shoot. It sort of worked, but not quite.
I think as the battery discharges, even with the 5volt voltage regulator in the electronic speed control box, everything degrades before it finally refuses to move. I know the DC wheel power motor uses lots of juice
Sound correct to you all?
Ken
Sounds correct to me. When the voltage drops below a certain point all kinds of strange things can happen. The PIC ® is probably running "OK" at 8Mhz, but the 5 volt peripherals are probably not happy.
Dave
Always wear safety glasses while programming.
To be honest I would never use the same power pack to power the electronics. Even when using electric helicopters I would use an RC pack for the receiver, with the main flight pack used just for driving the main motor. 4 x 1.2v Nicads provides a decent supply for the electronics
I too initially designed with two battery packs. One for the servos and the other for the electronics. My problem is one of packaging. Getting a cheap kit that fits easily into a HPI Racing Touring Car Ready to Race package is way beyond my expertise. Why the HPI car? That is what I have. Also Ten80 Education
( Which I know as http://www.ten80eduction.com)
specializes in using radio control cars for curriculum and lesson plans supporting STEM in our schools. One of that company's sponsors is HPI Racing. I hope to get ten80 support. One battery is much easier to mount than two.
I took my car again for a run. It is using the "there is nothing within four feet of me, I must be under radio control" toggling algorithm. I liked the effect. It is important that the room have lots of room. Clearly a gymnasium fits that criteria. Adding the photoresistor system is more than I can deal with at this time.
Two projects are looming. 1. Get help and advice on packaging (surface mount prototyping). 2. Create a video story board then shoot a video showing what I have built, why I built it, how to modify the code and why I think middle school students will jump to learn.
I discovered a neat trick today. The studio has a small push cart with roller skate sized wheels. I put my car on the cart (back end facing me - it has no sonar sensor) and pushed it around the maze. I could easily see the reaction of the car to each position. It made very clear that the problems are speed, momentum and reaction time.
Ken
Bookmarks