Chameleon DAGU Mr Basic Kit
| Attachment | Size |
|---|---|
| chameleon.bas | 2.82 KB |
I was hoping to finish this robot in time for the Mr Basic DAGU II competition, but I doubt I will have it done in the next 24 hours. Here is what I have so far!
- Eventually it will drive until one of the whiskers hits something.
- Then it will stop and try to determine what color the object is that it hit. The color detector shines a red, blue and green light (using a tri-color LED) and measures the amount of light that bounces back.
- It uses those numbers to do software PWM and drive 3 other tri-color LEDs to try to match the color of the object it hit
- After 5-10 seconds it shuts off the LEDs and turns (based upon which whisker was activated) and goes somewhere else until it hits something
I made modules for everything so I don't have to resolder new circuit boards all the time and can build things quicker.
Color Detector- I need to remake it so it looks better and the board is smaller. The clear lump is a tri-color LED. 
Download Circuit
Mr. Basic Kit
PICAXE 40x1 - With a double row of pins soldered on each side. Why 2? I figured if I did a single row I would need to hook something else up on the same pin and wish I had 2.
5volt Regulator with Anode and Cathode Bus - have since removed the switch and added it to the red wire leading into the screw terminal.
The switch on the board was shorted and would fail when it wiggled.
Whisker Sensor
I will work on it some more tomorrow and try to get it done for the competition. I really want that Catepillar kit! Not having to pay for it would be awesome ;)
UPDATE: Added current version of the code. I found myself REALLY wanting to switch to XMOS or Arduino so I could use C. Give me REAL variables and arrays PLEASE! I am also going to bed and declaring defeat against my race to the deadline. If it wasn't for school and working on a robotics project that I get graded on I would have finished this guy. I'll keep plugging away and try to complete it in a couple weeks.
Update: 11-11-09 I had planned to use 3 tri-color LEDs diffeused by a plastic dome or some sort of tissue but the Picaxe 40x1 only has 2 PWM ports. I decided to try to do software PWM (you can see the horrible start to it in the code I posted on 11-10/09). After fiddling with code I have decided to use only 2 Tri-Color LEDs so I can use hardware PWM and make my code cleaner. Eventually I would like to play with software PWM.
UPDATE 11/12/09: With the extended dealine coming to a close I rebuilt my color detector to use pots so I adjusted the values more closely to what I need. However I have everything wired up, but I have a PWM question posted as I haven't used PWM with a PICAXE before. If Iget an answer to my PWM question I may be able to finish within 30-45 minutes. I don't think the color detection and duplication will be spot on, but I think that I can get it close enough to where green = green. It may be a few shades off from the true color, but not bad considerign the color detector costs maybe 2 USD to make.




@ Wed, 2009-11-11 18:24
I wanna see this robot
@ Wed, 2009-11-11 19:34
I'm all for extending the
I'm all for extending the Challenge deadline a day or two so we can include Chameleon.
Hell, extend it to the end of the month and I'll get Mr. Suspense back in the running. I'm coming home from business travel at the end of the week. ; j (I don't seriously expect you to do this. It isn't fair to those that worked so hard to meet the deadline.)
@ Wed, 2009-11-11 19:42
End of the month would rock!
@ Thu, 2009-11-12 00:01
weeeell
I feel that pushing the deadline ahead by more than two weeks is a bit of a stretch. But the 36 hours should be OK.
That would mean you have until November 12th at 2300 hrs Danish time (GMT+1 I think)
Best of luck
@ Thu, 2009-11-12 00:48
I will see what I can do
@ Wed, 2009-11-11 18:53
Not in 24 hours. I have
@ Wed, 2009-11-11 04:43
So I put a multimeter on the
So I put a multimeter on the whiskers and they conduct so that isn't the issue. I did see that when hooked up to 5 volts (via the regulator), the value jumped around pretty crazy. It went from .08 volts to 4.34 volts and every value in between. I think that is why the pin doesn't go high when it is connected to the PICAXE. I don't see why the value would jump around so wildly. I may try hooking it up to an ADC port or analog and see if I can get it to read a value so I can use that instead of a simple on/off.
8 hours until the deadline! Lets see if I can finish :)
@ Wed, 2009-11-11 08:11
This is fairly normal behaviour for such a switch
It is called contact bounce. Probably the simplest solution would be to put a 10uF or higher capacitor in parallel to your 10K resistor. This will charge very quickly when to contacts close and discharge slowly via the 10K resistor when the contacts open.
Micro switches tend to limit this effect by requiring the switch to close more than half way before the contacts spring close and then open more than half way before the contacts spring open.
The caterpillar had this problem with it's ROHS compliant tilt switches. A strategically placed capacitor or two stopped the caterpillar from thinking it had fallen over as a result of vibration causing the contacts to open slightly.
@ Thu, 2009-11-12 07:13
So for my benefit and
@ Thu, 2009-11-12 10:36
Rule of thumb
The capacitor just keeps the voltage at a logical 1 between contact bounces and maintains it for a short period after the last contact is made.
My rule of thumb is that 1uF will discharge in 1 minute using a 1M resistor. So 10uF and 10K should be about 1/10th of a second.
Since the capacitor does not discharge in a linear fashion and your trip point where a digital high becomes a digital low is going to be some where between 2 and 3V the actual time that the input will stay high between contact bounces might only be 1/50th of a second but this should be fine.