I'm unclear as to which GNDs are supposed to be connected (picture of setup and robot included)

Hi All,

 

I'm trying to wire up a balancing robot but I'm not sure what to do with all of the grounds.

I'm pretty sure that I will connect the ground from the 3.3V side of the voltage regulator to the grounds of the ATmega32, Gyroscope, and Nrfl201 transmitter (i haven't hooked it up yet as i just want to get the robot balancing first). 

 

The main issue i'm having is with the TB6612FNG motor driver.  It has several grounds.  The datasheet chart shows that there is 2 power grounds, and one "small signal ground".

 

 In looking online, some posts say that since all of the grounds are connected internally, that one only needs to connect one.  So if that's true, do i connect it to the 12V ground or the 3.3V ground?

 

Or am i supposed to connect all grounds together, so then the negative terminal of the 12V power supply and the negative terminal of the 3.3V regulator should also be connected?

 

I also have schottky diodes in place to prevent back EMF but have left their wiring out to make the above picture less tangled with all of the wires.  The wheel encoders also have an IR led and Phototransistor that require 3.3V power and I've also left them out to simplify the diagram.

 

Any help would be much appreciated!

 

Below is a picture of the robot without the wheel encoders attached, just the encoder discs:

 

GNDS

First - Nice diagram and well phrased question!

In general you want to connect all the grounds together. Think of them as common or return paths. Just as much current lows thru the grounds as thru the supply wires. You may need heavier wires for the power grounds to the motor controller. Same as the VIN. If you have noise problems you may need to isolate the motor power from the cpu logic power.

Drawing suggestion - use more colors. I prefer Orange for the battery.

I am also building a self balancer. Different CPU, battery, and motors, same MPU and radio. Suspect you are ahead of me.

What are your plans for the radio?

Please post status reports.

Thanks for the informative

Thanks for the informative reply!  Oh believe me, I’m porbably not as far ahead as you think.  I started by downloading all of the balancing robot code i could find, but then couldn’t understand any of it.  After many months of trying to learn Arduino and AVR, i feel that i know just enough to interpret other people’s balancing robot code and use it.  I actually want to see the robot’s behaviour as i change PID parameters, and also how it behaves when i set the Atmega to 4mhz, and then even 1mhz. will it even run?  and if it does, how slow will its response times be.  i will actually be trying to translate a lot of arduino robot code into the type that the Atmega32 uses, which will help me understand what is really going on behind the scenes.  So this robot is basically a platform to help me learn AVR programming.

Anyhow, regarding the radio, I purchased 2 sony psp thumb joysticks, and plan to connect them to an arduino nano or pro micro since i have those units laying around, and then of course another nrfl201 unit.  I’m not sure how they will be programmed though.

The code i’m currently working with is from József Fekete’s youtube video comments, which links to a dropbox.  His project has a radio and all of the code.  Good luck, and I will indeed use heavier wires for the power grounds and post status updates!  I will start soldering the connections right now and post as soon as i’m done.

One comment: what are you
One comment: what are you using for batteries? I’m assuming a 12v battery of some kind, but you only show alkaline non-rechargeable batteries. Rechargeable batteries normally have more power available.

For batteries, I’m using two

For batteries, I’m using two 1/2 AA sized 6V batteries (4LR44 is their code name), to get a combined voltage of 12V.  I wanted to make the robot as small as possible, and i didn’t want to daisy chain small Lipo batteries, or even use a sufficient multi-cell Lipo because i don’t have a proper Lipo charger.

I’ve read about how important balancing the cells are while recharging (to avoid fires) and don’t want to invest in a proper Lipo setup as yet.  I do have a 12V NiMh pack but it is as big as the robot!  I would be interested in 12V options that are smaller and rechargable…but even though the 1/2 AA are alkaline and may not have a lot of mAh, they worked out to be pretty reasonable as I  bought in bulk on ebay.  about $0.63 each for 20. 

IMG_0915_1_.jpg

Robot Size

I’m not sure you want to minimize the size (height) of your robot. If I understand the mechanics (big IF) the robot will pivot on a imaginary axis at the center of mass. Having all the weight at the bottom will place this axis near the bottom resulting in a larger motion at the top. I think the goal is to have the top remain as steady as possible and use the motors to swing the bottom.

I tried to get some specs on the 4LR44 6V batteries. Do you know anything about the rated mill amp hours?

Fortunately, is is easy to add a vertical column and put the batteries up high.

I saw a demo of a NRF24L01, MPU, Arduino attached to a 1 m strring which was then spun in circles. Approx 10 times per second the radio would broadcast the acceleration and gyro values and a host pc would plot the results. The goal was to make a spinning led display. Still more work to be done!!

Batteries

I was writting while bdk6 was posting the battery link. You may want to do some power calculations.

 

I have a feeling that I will

I have a feeling that I will do exactly as you mentioned and move the batteries higher up.  If the motors allow, i might even tack on the huge 12V pack, which should slow down the “falling momentum” and allow the robot to hopefully balance better.

I’ve also salvaged two short lenghts of red and black wire, of a thicker gauge to use on the battery terminals, thanks for the tip!

I don’t know what motor
I don’t know what motor you’re using, but they need the speed and torque to keep that mass balanced.

Good luck. I’m also trying to build a balancing bot as a prototype for a larger balancing bot.

After flipping the switch,

After flipping the switch, the robot does absolutely nothing.  I’ve used a multimeter and all of the voltages seem to be going where they are supposed to, and are in the correct amounts.

I really should have built the whole thing on a breadboard first, to make troubleshooting easier.  But of course I assumed this would be a standard LEGO type of operation where i just add a bunch of blocks together and then it would automatically start working when power was applied.

I’m going to try to program the atmega with some simple code to get the motors to spin as a start.

 

Getting started

Some suggestions: (not in a special order)

1. Do a mathetical calculation of estimated power consumption. Then make sure
    your supplies can deliver.
2. Start with the wheels off the ground.
3. Test the MPU independent of the motors.
4. Build a caot hanger wire (or other) saftey frame that protects the
    robot when it crashes. And I mean WHEN.
5. Build and test the code in incremental steps. Backup to an independent medium regulary.
6. Get the radio working early so you can dump sensor readings and calculations to a host for analysis.

 

Thanks for the

Thanks for the troubleshooting steps!  Its going to be interesting to find out what the culprit was.  The red light on teh gyro turns on but that’s it. 

I’ve actually made a mock up of a balancing robot on a breadboard, with motors hanging off…and i think i will use an Arduino to test the mock up, and possibly for the real robot as well.  I find its alot easier to get up and running with code when I don’t have to deal with DDRs , PORTs, return(0)s and other “C” things that are somehow behind the scenes in the Arduino world.  

I had planned on getting the radio working last, but you make a good point about using it to send sensor readings to a host for analysis.  

I look forward to seeing your robot as well!