Gruber
HobbyMasters
M.L. Toys
KidsWheels
Gruber
HobbyMasters
M.L. Toys
KidsWheels
HobbyMasters M.L. Toys
Gruber
KidsWheels
Electronic Scooter Controllers have become a popular addition to our vehicles. Ask specific questions about ESCs here!

***WARNING*** this section is for ADVANCED MODDERS. if you try anything in this section you NEED to expect minor issues with the build up to and including complete FAILURE of EVERYTHING in your freshly built BPRO.

Have fun ;-) :-)
User avatar
By Evan
#130394
I'm planning to implement an Arduino-based ESC in my 1 year old son's Lil Quad based on MomsMechanic's excellent thread.

Starting point:
  • Power Wheels Lil Quad, completely stock. 6 volt, momentary on/off throttle button on right hand grip, no reverse.

Desired Features:
  • Soft start
  • Reverse
  • Adjustable max speed via rotary knob. I'm hoping I can setup the Arduino to read this switch's position to set the MAXFWD and MAXREV values in MomsMechanic's code
  • Maybe adjustable speed gain via rotary knob. This could scale the accel_ratelo, accel_ratehi, decel_rate, and brake_rate values to increase/reduce the smoothing functionality of the ESC - this is low priority, but if I have pins available and can be done for a couple bucks, why not?

Possible Future Upgrades:
  • 12v Conversion
  • High/Low Switch
  • Variable Throttle
  • Remote Kill Switch

Parts Purchased:
  • Knockoff Arduino Uno R3 ATmega328P ATmega16U2 - $10 ebay - ETA March 6th
  • BTS7960B Motor Driver 43A H-Bridge PWM - $10 ebay - ETA March 11th-26th :roll:

Parts Still Needed:
  • Forward/Reverse buttons or toggle switch
  • Connectors so I can unplug the ESC and return to stock functionality at any time without any tools
  • 6V to 5V voltage regulator?
  • Master on/off switch
  • 16 position Rotary DIP Switch - $3 Sparkfun
  • Plastic project box to hold everything

I'm new to all of this, so hopefully I don't have too many missteps along the way. I hope to document well enough for anyone like me to copy. I happen to be learning Javascript lately and I understand the code, so I think I can make the changes I desire.

I haven't looked into any of the parts in the "still needed" list, suggestions and sources would be much appreciated, as would any other thoughts or suggestions.
Last edited by Evan on Fri Feb 27, 2015 7:21 pm, edited 3 times in total.
#130403
Looks like fun! The is a rehab center that needed a way to slow down the 6v rides. If you get this figured out, they may want to buy a batch from you ;)
User avatar
By Evan
#132437
Hopefully I don't. MomsMechanic used one since he used an Arduino Nano that didn't have an onboard regulator. I bought a knockoff Uno via ebay, so I put that in there to remind myself to verify that mine has an onboard regulator.
#132438
Yeah, you might want to check. Most clones I have seen have a voltage regulator on them. Also depending on what you plan on running off the arduino (if it has a regulator onboard), if you supply it 5V the power can be a little unstable on some pins. I would just run it power right from the 6V line. Most people recommend 7-10 volts for stable power though.

It'll be interesting to see how our two projects turn out, as I am just starting mine as well.
#132883
Hi, I'm momsmechanic. I'm glad to see somebody is able to benefit from my post.

Running the setup as I presented it at 6v might pose some issues for you. First although the arduino board you linked to does have a built-in regulator, at 6v you may run into problems. What I've noticed on my 12v setup is that the motors will draw enough power that it will drop the voltage by a couple of volts at times. At 6v, this may pull your voltage well below 5v, which may cause your arduino to reset or run unreliably. (The 5v arduino runs at 16mhz which needs a minimum of around 4v)

You might be able to get around this if you use a 3.3v arduino instead of the 5v. Although it runs at half the speed (8mhz instead of 16), it shouldn't make any noticeable difference. At 8mhz, the arduino only needs a minimum of around 2.7v)

The other issue is the BTS7960B is composed of a set of mosfets (acting as switches) that generally work better when switching higher voltages. The setup as I presented it will work without any modifications up to 28v, assuming the motors can handle it. But at 6v, it will have a more resistance and so you might encounter some heat on the motor controller. Looking at the datasheet, 6v is about the bare minimum. In practice, I don't know how well it will work, or if it will work reliably. Check the graph page 8 of the bts7960b datasheet: http://www.robotpower.com/downloads/BTS ... -12-07.pdf

The easiest way to deal with both these issues is to convert to 12v. I know the battery compartment on these smaller vehicles might not fit the usual 12v batteries, but I believe there may be one that is the same size (albeit with half the amp-hr rating) that may fit. You can just lower the the limits in the code to keep the vehicle speed the same (or lower if you like) as it was with the 6v battery. Since the duty cycle will be half of what it would be with the 6v battery, you should probably get the same or maybe even better battery life with 12v.

I like the idea about the pots to set max speeds and rates. It's nice and simple, although I would have to figure how to keep the kids from tampering with them. But it makes it a lot easier to change the values when tweaking the setup, i.e. not having to have to hook up the laptop every time you want to change something.

Good luck with your project. I took some video of my kids driving their jeep last week. When I get a chance I'll upload it to the original thread.
Last edited by momsmechanic on Sat Jun 13, 2015 9:26 pm, edited 3 times in total.
#132885
Sven37 wrote:Yeah, you might want to check. Most clones I have seen have a voltage regulator on them. Also depending on what you plan on running off the arduino (if it has a regulator onboard), if you supply it 5V the power can be a little unstable on some pins. I would just run it power right from the 6V line. Most people recommend 7-10 volts for stable power though.

It'll be interesting to see how our two projects turn out, as I am just starting mine as well.


Not a good idea to power right from the 6v line. If you check the datasheet for the atmega328, you'll see it's maximum is 5.5v. You might get lucky and it may work at 6v, but you also need to remember that when fully charged these batteries can be closer to 7v.

The other problem is that the linear type regulators on these boards eat up about 1.7v, meaning to get 5v, you need to supply at least 6.7v. Luckily the 5v arduino is running at 16mhz, which actually requires 4v to run at that speed, meaning you can get away with 6v-1.7v=4.3, but that's cutting it close. As I mentioned in my previous message, when the motors turn on, they will pull down the voltage and if you're operating that close to the minimum, you may not get reliable performance.
Last edited by momsmechanic on Sat Jun 13, 2015 7:24 pm, edited 1 time in total.
#132917
momsmechanic wrote:
Sven37 wrote:Yeah, you might want to check. Most clones I have seen have a voltage regulator on them. Also depending on what you plan on running off the arduino (if it has a regulator onboard), if you supply it 5V the power can be a little unstable on some pins. I would just run it power right from the 6V line. Most people recommend 7-10 volts for stable power though.

It'll be interesting to see how our two projects turn out, as I am just starting mine as well.


Not a good idea to power right from the 6v line. If you check the datasheet for the atmega328, you'll see it's maximum is 5.5v. You might get lucky and it may work at 6v, but you also need to remember that when fully charged these batteries can be closer to 7v.

The other problem is that the linear type regulators on these boards eat up about 1.7v, meaning to get 5v, you need to supply at least 6.7v. Luckily the 5v arduino is running at 16mhz, which actually requires 4v to run at that speed, meaning you can get away with 6v-1.7v=4.3, but that's cutting it close. As I mentioned in my previous message, when the motors turn on, they will pull down the voltage and if you're operating that close to the minimum, you may not get reliable performance.


I grabbed my data right from the Arduino website:

"
Summary
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts. "
#132927
Sorry, I got a little mixed up when you said "power direction from 6v". I thought you meant to bypass the built-in regulator. This can be done if you feed power to the 5V pin instead of using the barrel connector (or the Vin pin)

I agree, if you use the built-in regulator, you don't need an external regulator. I only used one because the Arduino Nano I used to prototype this up didn't have one.

Although nowadays you can get an Arduino Leonardo clone for about $6USD, which works just as well an Uno.
#132963
You can try running it at 6V to see if it works. If not, all you need to do is add another 6v battery (if your original is not too old - refer to the faq about mixing new and old batteries) or replace the original battery with a 12v that fits.

In theory everything should work, but as I mentioned before everything is so close to the minimums, that I'm not sure it will be reliable. I strongly recommend you test everything out before letting your kids loose on it.

I believe this particular motor controller has built-in protection against overheating, short-circuit, etc. Also, when the arduino controller resets, all the output pins go low, which will disable motor(s).

At 6V I believe the stock wiring should be sufficient, but if you do decide to go 12, you might want to beef up the wiring from the battery to the motor controller and motor(s). The rest should be fine, (i.e. switches, throttle, etc) since they only carry minimal current at 5v.

The nicest thing about running at 12v is that you can use easily-obtained (and relatively cheap) car parts (especially in SoCal where you're from). That chip on this motor controller was originally designed for controlling power window/seat/wiper motors/etc. It been working pretty well for me so far.
Last edited by momsmechanic on Tue Jun 16, 2015 7:50 am, edited 2 times in total.
#141096
I know this is a stale thread, but I saw this thread from momsmechanic original post. Great work by the way!

In the original post the topic of motor speeds came up.. I'm using these; I have them on the front spindle to get a true speed regardless of wheel spin. Just glue the magnet(s) to the back of the wheel. :) I use 2 magnets to get a better slow speed update resolution.

http://www.ebay.com/itm/NJK-5002C-Hall- ... SwnLdWrrDv

dirt simple to install, and they run on 5V. The only catch is the output is Open-Collector, so you need a resistor between 5V, and the output wire. It'll rest on 5V until the magnet passes by, and blip to ground (0V) You can use pulseIn() on your Arduinos to measure the time, and calculate wheel speed.

Another topic of current measuring showed up. The BTS Fets have it built in. The x_IS pins on the connection header can be read with an Arduino using the analogRead(). There is a resistor installed that you can swap out (R5&R6), for a more tailored current range. I believe the one on mine (IBT-2s) were 1Ks. momsmechanic is correct on the voltage of using them.. 8V is a number that sticks in my head. The FETs Rds was enormous below 8V.

The formula is ResistorValue = (MaxVoltageOut/ (LoadCurrent/8500)) ie 1000 ohms gives you 5V/(40amps/8500) From that you can use the Arduino map() function to translate the adc reading to 0-40A

As far as regulators, and powering things.. Be weary of the ebay Arduino Clones. I've had a few, and had to rework them as they were cheap parts, and sometimes poorly made. My F150 is running off an eBay Arduino Due, and I spent 3 days tracing a problem to a missing resistor on the PCB. The best thing to do would be to run everything off a standalone regulator.

I've been using these babies for everything.... FYI they state 2-3 Amps, but cheap means cheap, and the PCB will only sink off about 1A before the heat is too close to max part temps. Don't push them past 1A, and your golden. I buy these by the dozen, and they're good upto 28V.

http://www.ebay.com/itm/5X-LM2596s-DC-D ... SwiylXC1ke

I hope the project went well Evan, or still is going well.
#141098
So sedzy, you understand this pwm and arduino stuff Huh? Is arduino the kind of thing that a caveman like me might have a chance at figuring out? I mean, I don't even know what a raspberry pi is, but I'm down for anything cheap and tinkery if I can get it to work like this power wheels soft start I can't get duplicated. I'm not exactly familiar with that kind of software stuff. Thanks
By Sedzy
#141100
I don't profess to be any expert or anything, but I know my way around a circuit board. :) The raspberry pi is a single board computer, with a simplified interface so people without an engineering degree can program it. (still not for the faint of heart though)

The Arduino was made specifically for "Get up and Run" without much knowledge beforehand. I've seen kids in grade 5 write sketches for it. Head over to https://www.arduino.cc/en/Guide/HomePage The main beauty of Arduino, is the open-source resources. If you can think of it, somebody else probably already has, and has written a library for it. All you have to do, is find it, and use it.

The Arduino Uno is a the basic module, but is really starting to show it's age. The Mega is the minimum I would recommend to anyone jumping in. If you want to tinker with writing code, and making cool things happen, the Mega would be a good start.(although it's a larger PCB)

momsmechanic put his arduino sketch up on his post, and despite his humble disclaimer on it, it looks like a solid sketch. replicating the setup should be pretty straight forward. I think he used an UNO, but another great thing with Arduinos is they're standardisation, and compatibility. His sketch will work in a Mega just the same.

The Arduino programming is also pretty basic, it's C++ variant, but with the libraries you get, have example sketches you can use/dissect/modify to suit your needs.

Give Arduino a go. Invest some time going through the website, and reading the tutorials, and learning the basics, and the rest just happens. The arduino forum is also a goldmine of information on helping/info/issues/etc.

Get yourself a Mega, even if it's just to mess around and pass time, I promise you, once you get into the swing of it, you'll be finding uses for it all over. :) I'm quite sure we can help here on MPW too.
#141124
Ya, I spent quite some time reading some tidbits from anduino for dummies, and through some starter kits info. Looks like I'll be buying my local radio shack guy lunch trying to make friends with him, if he's familiar? Thanks for the nudge! ;-)
My phone never wants to let me say andruino, but I guess I'd better add it to the dictionary
User avatar
By Evan
#141136
Sadly, I've got nothing new to contribute. I've been too busy with other things, so the parts are still sitting on the shelf. The 12v conversion will be nice, since the quad struggles in the wood chips that now cover our whole back yard. I'm off to a web development bootcamp in a while, so hopefully I'll finally get to this after I've gotten school out of the way.
HELLO!

THANK YOU FOR THE ADD! LOOKING TO BE ABLE TO ASK A[…]

Unibody Jeep Front End Sag

I did this on my Hurricane. I used a fairly long M[…]

I will have to look at the shifter when I get off […]

Upgrade BMW i8 Concept

If the 6v bat is stock it may have a built in fuse[…]

HobbyMasters Udemy Course