String Car Racer - Trinket version

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

String Car Racer - Trinket version

Post by CGrover »

Back in the 1980s, my college-aged brother designed a simple motor+battery car that raced along a string between the birch tree and the street-side power pole. For years now, we've been improving on the design, keeping it really simple: 1 battery-driven motor, flashing lights, and repurposed materials whenever possible. The primary goal was speed and stability. The car ran at full speed until it found the end of the string -- then you either had to be there to catch it or be prepared to repair it before the next time trial.

We talked about making the car smarter so that it could stop and reverse directions, and came up with lots of schemes and circuits to make it possible, but we were more focused on the high-speed "Gump" mode of operation. Run Forrest, run!

Fast forward to now. I retired from a technology management job and was challenged by my son to get back into electronic design. What could be better to start than to realize the dream of a simple, autonomous string car that wouldn't crash at the ends of the string? To keep it simple, I decided to design an initial version with TTL logic and micro-switches as end-of-string sensors. Yeah, I used to design TTL and CMOS back in the day, so I defaulted to that technology.

After shopping around for ICs, I happened on the Arduino web site. Hmm. From there, I gravitated to Adafruit. Here's a microcontroller with 5 I/O pins and just enough memory for what I wanted. Let's see if we can wake up those C++ skills, too. Adafruit tutorials were extremely helpful and were essential in the design process.

Long story short, StringCar 3v1 with software revision 4 is now ready to go. The prototype logic board worked so well that I sent the design off to Fritzing to be printed. The software supports two modes today. First is Pong mode where the car accelerates from a dead stop, races to one end of the string, brakes, reverses direction and speeds to the other end of the string -- forever. The second mode is Boomerang where the car travels to the far end of the string, brakes, reverses, then stops at the origin, flashing its 5mm NeoPixel blue to remind you that it's back home. Selecting the mode is simple. Power-on or reset puts you into Pong mode and initially flashes the LED purple before taking off. Boomerang mode is selected by holding down one of sensor switches during power-on/reset. The LED flashes blue to let you know the car will return and stop.
Rear view of the string car showing the control logic module that plugs into the main car chassis using a 20-pin R-Pi -like header. The 6V DC motor is mounted above the PCB. The 9V battery is on the reverse side of the chassis to maintain balance and center-of-gravity.
Rear view of the string car showing the control logic module that plugs into the main car chassis using a 20-pin R-Pi -like header. The 6V DC motor is mounted above the PCB. The 9V battery is on the reverse side of the chassis to maintain balance and center-of-gravity.
DSC02572a lores.jpg (644.89 KiB) Viewed 7390 times
Big thanks to the folks at Adafruit, Jameco, Hobbymasters (for the difficult-to-find pulleys), and Fritzing.
Last edited by CGrover on Thu Apr 21, 2016 8:20 pm, edited 4 times in total.

User avatar
adafruit_support_bill
 
Posts: 88166
Joined: Sat Feb 07, 2009 10:11 am

Re: String Car Racer - Trinket version

Post by adafruit_support_bill »

Awesome project! Thanks for posting it.

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

Thanks! Here's a front view of the car in action. You know it's fast when you start to see string dust accumulate under the pulley!
Front view of string car. A simple pulley is press-fit onto the motor shaft. Besides PWM speed control via the Trinket, the pulley size can also control speed; larger = faster, but with lower starting torque.
Front view of string car. A simple pulley is press-fit onto the motor shaft. Besides PWM speed control via the Trinket, the pulley size can also control speed; larger = faster, but with lower starting torque.
2015-12-14 DSC02561 lores.jpg (789.81 KiB) Viewed 7344 times

User avatar
adafruit2
 
Posts: 22207
Joined: Fri Mar 11, 2005 7:36 pm

Re: String Car Racer - Trinket version

Post by adafruit2 »

wow beautiful!

User avatar
Disciple
 
Posts: 852
Joined: Tue Jan 06, 2015 8:13 pm

Re: String Car Racer - Trinket version

Post by Disciple »

I visited my first makerfaire only last year, but I think they should host competitions for such as these. Fastest run, highest peak speed, steepest climb, most laps on a standard battery, push war, gravity-powered, mainspring-powered, solar-powered, Stirling engines,.. and a blog entry at the very least.

Hallelujah!
Disciple

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

Some great ideas! You know, the best part of the string car build was the time spent with family members around a workbench stripping motors from cassette and CD players, scheming design ideas, and building the contraptions. Perhaps your ideas will make the outdoor tests and races even more fun than the build.

User avatar
richarduk
 
Posts: 64
Joined: Tue Nov 05, 2013 4:55 pm

Re: String Car Racer - Trinket version

Post by richarduk »

I can see future string racing at maker shows. You know what I am going to ask for next, video? :)

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

Certainly after the weather improves! Obviously, the car wouldn't survive icy/wet conditions very well. ;) Meanwhile, along with a couple other projects, I'll be experimenting with some different EOS (end-of-string) sensors and an upgrade to the sketch to algorithmically predict EOS based on previous laps.
Last edited by CGrover on Tue Jan 12, 2016 3:52 pm, edited 1 time in total.

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

The final version uses an Adafruit TB6612 motor controller and 5mm NeoPixel along with the Trinket 5v.The final design has greater functionality, is more modular, and will permit testing of a variety of motors and EOS sensor schemes.
The PCB design for the original discrete TTL version, discarded for the Trinket-based design.
The PCB design for the original discrete TTL version, discarded for the Trinket-based design.
TTL pcb lores.jpg (195.77 KiB) Viewed 3670 times
Last edited by CGrover on Wed Jan 13, 2016 6:19 pm, edited 3 times in total.

User avatar
shinyshez
 
Posts: 1
Joined: Tue Jan 12, 2016 5:47 pm

Re: String Car Racer - Trinket version

Post by shinyshez »

With a mini dv cam (mobius or similar?) stuck to the bottom you could have a nice minimal cable cam that could go up hill as well as down - http://www.pinkbike.com/video/135409/ is an example of video from a gravity powered job!
Cheers
Shez

User avatar
Jeffeb3
 
Posts: 1
Joined: Wed Jan 13, 2016 1:57 pm

Re: String Car Racer - Trinket version

Post by Jeffeb3 »

With some minor changes, this could make a very exciting Science Olympiad event. Add some creative contraints (that could change each year) and you'd have a great learning experience for kids. Some constraints I thought of right away:
- Limit the power, use a super cap of a limited size, and let the kids experiment with different sized pulleys, different logic in the microcontroller, or different motor types, and see who can make it back and forth the most times. In fact, not using a microcontroller at all might be a simple low power solution.
- Try to hit a "target" like a marker in the middle of the string, with different points for the distance from the marker.
- Add complexity to the target by requiring a certain number of back and forth runs before shooting for the target.
- Also control the location of one of the endpoints of the string, to navigate a maze?
- Racing, obviously.
I've judged SO competitions before (specifically the rubber band powered helicopters) and it was always very fun. Having a kit available so most schools can get a head start would help encourage participation, but it's important that a kit isn't required. The fact that this can be created in almost any electronics lab makes it very versatile.

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

I agree Jeffeb3. The first version was a reclaimed motor with a pulley already attached, a spent 9v battery, and a short length of fence wire to use as the chassis and string guides. Using fence wire allowed for many design variants from sleek and compact to stretch versions. The wire bends easily and can be formed into whatever the designer wants, as long as they think about center-of-gravity, balance, traction, stability, and connecting a simple electrical circuit. One challenge was to create the chassis and guides from a single length of wire, front-to-back with only bends, no cutting or brazing allowed.

Here's an example of a "Gump" car from 2006 designed with an open chassis so that it could safely race along the edge of a windy lake. The tilt of the battery was an attempt to center as much of its weight under the pulley as possible to help with stability. For traction issues in damp and cold environments, cut a very thin sliver of surgical tubing (it'll resemble a miniscule rubber band) and snap it into the bottom of the pulley's groove. Don't make the band too wide or the car will pop off the string.
Simple, open chassis with on-off switch. An LED was added later for night runs by the lake.
Simple, open chassis with on-off switch. An LED was added later for night runs by the lake.
2006-07-30 string car lores.jpg (317.46 KiB) Viewed 3768 times
I don't keep the cars very long. This one went to a 10-year-old relative who was instantly captivated. The first modification made was to decorate it to "make it even faster."
Last edited by CGrover on Thu Mar 17, 2016 12:22 pm, edited 1 time in total.

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

Here's the next logic controller PCB design, utilizing an ATtiny85 8-pin DIP with an SN754410 motor controller. This design reduces the PCB size significantly over the Trinket breakout version, but will require direct AVR chip programming. This will be my first time programming an AVR chip via an Arduino ISP so wish me luck. Think I'll breadboard this puppy and take the time to perfect the direct programming process before ordering the new board... ;)

I would have preferred to use a dual-H surface-mount controller (like the TI DRV8872), but I had a bunch of SN754410 quad-H chips in the parts bin -- that's why they're included in this version.
Draft of new Logic Controller PCB design with on-board 5v regulator, ATtiny85, motor controller, and 5mm NeoPixel LED.
Draft of new Logic Controller PCB design with on-board 5v regulator, ATtiny85, motor controller, and 5mm NeoPixel LED.
StringCar 3v2 r00 raw 2016-01-18b.jpg (225.4 KiB) Viewed 3098 times
Software-wise, the predictive braking routine is mostly coded and debugged and is almost ready for the physical, on-string tests.

User avatar
adafruit_support_bill
 
Posts: 88166
Joined: Sat Feb 07, 2009 10:11 am

Re: String Car Racer - Trinket version

Post by adafruit_support_bill »

The SN754410 is a capable chip - as well as being an easy-to-work with through-hole part. I'd be interested to see your predictive braking scheme.

User avatar
CGrover
 
Posts: 188
Joined: Mon Dec 07, 2015 2:52 am

Re: String Car Racer - Trinket version

Post by CGrover »

Yes, the 754410 has been a bullet-proof prototyping tool for me. That's why there are still some left in the parts bin! :)

The predictive braking scheme is pretty simple. This initial version assumes that the forward and reverse lap times will be fairly consistent -- no traction variants and a level string. Not necessarily real-world, but it's a place to start. The elapsed time is measured during the very first lap, from the initial forward movement until the first end-of-string is detected. That elapsed time is directly proportional to the end-to-end length of the string. A braking period, proportional to the normal motor speed, is subtracted from that and is used to predict when to start braking the car before it reaches the end-of-string. The duration minus braking value is then used for all subsequent laps. Future schemes will compare the predicted duration with actual for each lap rather than just relying on a single "learning" lap.

At some point, the car design could include distance sensors instead of limit switches for more proportional braking regardless of traction and incline conditions. That would be particularly useful when payloads (cameras, etc.) are involved just to smooth out the braking/reversal sequence. As it is, though, the car's weight and resulting inertia are low enough to tolerate a rather sudden stop. When the weather improves, I'll post a video of the car in operation to demonstrate the various braking techniques.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”