Engineers and their Toys | Cypress Semiconductor
Engineers and their Toys
What is it with engineers and toys? You can't keep us away from them. Do we ever grow up?
Sure, we tell everyone that embedded applications are changing the future, connecting people, improving lives, saving them even, but we're not really interested. In reality all we want is a battery-operated controller with some flashing LEDs and a toy car to steer around the office when the boss isn't looking.
My mate Rajesh was in town last week and he told me about his latest pet project - and, yup, it's a toy car. Ever on the lookout for a cheap blog topic I asked him to send me a video, which he duly did, but he also made me promise to give out a big thankyou to his team; Sandeep, Rinku and Sriram. Well done lads, now - all of you - get back to those world-changing engineering projects we pay you for! From this point on I have to pretend to be a little indignant about the frivolity of it all when, really, I am a bit jealous that they didn't ask me to help.
So, here it is. Not the first toy car to be driven by a PSoC and probably not the last. The recipe is simple enough.
- Purchase one battery-powered toy car
- Break it - this is traditional engineering practice
- Rip off the fancy plastic shell - we don't need stripes to make it go faster
- Apply liberal amounts of glue to whatever you find underneath and attach a FirstTouch kit (zip ties are an acceptable alternative)
- Insert a WirelessUSB (CYRF7936) kit into the 12-pin connector
- Do that configuration and software stuff and to program the receiver
- Find another FirstTouch kit and CYRF7936 and do more of that configuration and software thing to program the transmitter
- Spend hours driving it as fast as you can around the office - blame the cleaners for the damage to the walls
Here's the video - www.cypress.com/ui/2_5/images/blogs/userfile/ToyCAR640x480.mpg
Anyway, Rajesh will get all grumpy if I do not tell you about how it really works so here goes...
|The transmitter uses the accelerometer on the FirstTouch kit to detect the orientation of the board and decide how to drive the car. The accelerometer is connected to the on-chip ADC through a software-controlled multiplexer. The software loop simply switches the MUX between the two inputs from the accelerometer (X and Y axes), reads the ADC, and sends a message (via a SPI interface to the radio) to the car if anything changed. The X axis controls steering (left, straight, right). The Y axis controls direction (forward, backward) and speed from the angle of tilt.|
|The receiver just listens for messages and does what it is told. It uses a control register to drive high/low signals out of pins to set the direction (both off = straight ahead).|
|The speed is managed with a PWM (pulse width modulator) with a software-variable duty cycle - the greater the duty cycle the faster it goes. Another control register controls a de-multiplexer, which channels the PWM output to the motor, driving it forward or backward at the desired speed.|
So there it is - a $10 toy car for only $150! Only one question remains really... Rajesh, where's MY damn car!