Magpi Issue 51 Robot Build

Hi All,

I'm trying to get the Magpi Issue 51 robot up and running but I'm having newbie problems. I'm still waiting on the pimoroni order to arrive so I'm using an adafruit 2 motor chassis.

I followed the instructions in the magazine and all I get are a blinking red activity light on the zeroborg and the occasional activity light on the pi zero when running off a 9v. (At least power doesn't seem to be an issue.) Do I need to map the rock candy joystick in the code somewhere?

While running off a power supply I was able to run the piborg demo and both wheels turned until I closed the app. Yeah!

My problem seems to be with the software since the hardware seems to be behaving. I started with a fresh install of raspbian, updated and upgraded. I successfully installed the diddyborg-web and piborg folders. I ran the joystick test successfully. When trying the web server option it booted (no camera) but I get a 'can not access' error when trying to hit the pi's ip address on my phone's browser.

I'll cross check the magazine instructions to what's on the piborg website tomorrow.

Any insight would be greatly appreciated!

Cheers!

Hans

piborg's picture

Getting things started can be tricky, it is hard to know which end is the problem.

What is shown on the Raspberry Pi's screen when you try and access the IP address from your phone?

Herohans's picture

Gremlins were at work while I slept. While connected to my unpowered, pihut, usb hub and a wall charger the joystick links to the candy rock dongle. I can move front and back but not left or right. Then something goes pear shaped and it just starts running straight and won't stop.

When connected to a 9v the pi zero never seems to fully boot. The raspberry pi icon keeps popping up in the top left hand corner but no splash screen or desktop

The web error is 'this site can not be reach'. '192.168.1.43 refused connection.' both my phone and the robot are connected to the same Wi-Fi router if that matters.

piborg's picture

It sounds like the 9V battery might be flat.

From memory the battery being low causes the kind of behavior you are describing, including the LED on the ZeroBorg flashing.

Herohans's picture

I think you are right. I threw in a non-rechargeable, akaline, 9v and the robot worked.

Or at least it did until my son spilled soda on the ps3 remote.

I think the web interface isn't booting completely because I get a couple of error messages about the camera not being installed. I've got the rasp pi zero flex cable on order but it's coming from China.

Thanks for the help!

Hans

piborg's picture

Glad to here that you found the problem :)

Hopefully leaving the PS3 remote to dry for a day or two should bring it back to life, modern electronics can be fairly resilient these days.

The code for the Web UI does expect a camera to be attached, so that would explain the problem with it starting.

Hi all,

I have been working on this MagPi51 robot build for a while and bumped into an issue I need help with.

I downloaded all the python scripts from the diddyborg-web git repo on a fresh Raspbian Pixel install. Everything works fine but the camera returns a lot of lag and the image is very sluggish when making the server connection. My understanding is the server connection is controlled by yetiWeb.py. The connection seems to be going on and off in a constant loop per the python script prints

Is there a charitable soul to help me give my Tiny Robot better eye sight ?

Thanks for your help!

Marc

piborg's picture

It sounds like the communication is slower than intended.

I think there are two likely culprits here:

  1. The WiFi connection to the robot is not very reliable / a bit noisy
  2. The browser is refreshing the image slower than intended

I would say the WiFi is a more likely suspect, I would try and see how reliable it is.
From a terminal / SSH try running the command ping 8.8.8.8 and see what sort of times you are seeing.
If there are errors or some rather large numbers then it may point to an unreliable WiFi connection.

As for the browser you could try reducing the delay.
In yetiWeb.py look for the line:

displayRate = 2                         # Number of images to request per second

and increase the value, for example:

displayRate = 3                         # Number of images to request per second

Higher numbers should grab images from the camera more often, but too high and the WiFi cannot keep up.

Thank you - lesson learned. Not all dongles are equally performing. And the script needed to be adjusted for faster refresh of the image.

I would like to control the motors from the yetiWeb python script. Whilst the motors perform well when testing on the Zero Demo GUI, they don't when controlled from the web interface. A part from forward, right and left turn, the output is not satisfying with motors failing to even operate at times. The speed at which they run is also inconsistent and uneven. I still power the set-up from the Pi/mains for now so I don't believe the issue comes from the power supply itself.

I have read hints on the forum about motors not outputting the same when in fwd or reverse mode.
However, I need help as I am not sure what to adjust when using the web UI.

Thanks in advance.
Marc

piborg's picture

The first thing to try is setting up the voltages in yetiWeb.py.

By default these are set to 8.4V for the battery (typical rechargable 9V) and 6V for the motors:

# Power settings
voltageIn = 8.4
voltageOut = 6.0

With these settings the script will limit the motor output to approximately 71%.

We usually recommend setting these values to match the ratings for your battery and motors.
If you want to actually go to 100% though you can set both of the values the same, e.g.

# Power settings
voltageIn = 8.4
voltageOut = 8.4

Changing the motor voltages did the trick. It is working perfectly now. Thanks a lot for your help.

Last hurdle, I am trying to give a bit of drive to opposite wheels when turning left/right in order to minimize the tremor due to the grip of the wheels. I have changed the drive(0,1) values but this has had adverse results in reverting to unwanted output of motors (uncontrolled stops, no spin...). Any idea of what needs to be changed to ensure steady output of 4 motors when I set the values to drive(0.3, 1) for e.g.?

thanks again in advance.

piborg's picture

Swapping Drive(0,1) for Drive(0.3,1) and Drive(1,0) for Drive(1,0.3) should change the speeds when turning like you expect.
Changing those values should not affect the spinning controls at all, the spins are set by Drive(-1,1) and Drive(1,-1).

It would help to know what speeds are reported back by the robot after you have made your changes.
If you could list each button and the corresponding speeds reported it may show what is happening a bit clearer.

Images: 

The speeds are accurately reported on screen. It works fine when powering the bot through the Pi.
However, I cannot manage enough juice to power both Pi and motors when on battery (brand new Duracell). I tried many voltage/drive combinations and either the Pi goes off or the motors don't get enough current.
I think my motors are drawing too much current due to their high 298:1 ratio and I believe swapping them for some 50:1 ratio will work better.

Am I on the right path or getting more confused here ?
Thanks for your help

Images: 
piborg's picture

Typically this kind of issue is mostly due to the stall current of the motors.
This is the amount of current that the motor uses when it is not yet moving and effects how much power is needed to get the motor to turn initially.
The gearing does also make things harder to get going, typically resulting in a higher voltage being needed to get the motor to start turning.

The main down sides to having lower gearing are that the stall torque (braking force) will be lower, and the running torque being lower.
If the running torque is too low then the robot might not be able to move itself.
Because of this I expect that going as low as the 11:1 might not be able to move properly.

Based on those specifications I would think that the 50:1 is probably the best option available to try.
This will also make the robot a fair bit faster than with the 298:1 motors you currently have :)

actually, I went for slow motors on purpose to turn the robot into an autonomous obstacle-avoiding rover at some later point. I didn't think of the implication in terms of drawn stall current so it's a learning curve for me.

I am going to swap the motors and will report back.

thanks for your continuous support.

Horror and damnation, the little b*****d won't have it on battery even with different motors. I cannot get enough power to get to pi to run properly. On battery, I cannot see the led on the dongle flashing. I tried playing with the Zeroboard voltage without success in getting at least the pi running the web UI.

I will go for separate power supply if I have to. However, it defeats the purpose of trying to run both pi and controller on the same supply.

Is there anything obvious to check at this stage?

Images: 
piborg's picture

I know this is not what you would expect, but it might be the WiFi dongle causing trouble.

The 5V DC/DC on the ZeroBorg provides up to 1.5A of current at any time.
Normally this is plenty but we have seen USB dongles draw a large amount sometimes.
When too much current is used what typically happens is the DC/DC cannot maintain the 5V supply, causing a dip in power output.
The end result is the Rasperry Pi resetting, far from ideal.

The reason these dongles sometimes take such large currents is that a typical USB port allows at least 1.5A, if not more.
This is why you can power a Raspberry Pi from a computer with a cable :)
The extra current draw is usually used to boost the WiFi signal, getting better range.

If you have a Pi 3 available I would suggest seeing if the robot will work with the Pi 3 using its on-board WiFi.
If that works fine then the WiFi dongle is probably the culprit, if it does not then the problem is elsewhere.

I was so sure it was the dongle that I got two at the same time.

I swapped my power-hungry dongle with the official Rpi dondle and tried on battery only again.
There isn't still enough power delivered to the pi from the Zeroborg.

Everything works well when the Borg is on battery and the pi on the mains.
I tried several non-rechargeable 9V batteries of reputable brands during my on-battery tests.
The best I could achieve on battery was a few seconds of boot then power seems too low (I checked this on screen) for the Pi to run.

Do my make-shift battery connectors look dodgy? (the Borg runs okay on it when powering the Pi on the mains)

I soldered the DC/DC converter myself. Shall I check my soldering job with a multimeter?

May day... May Day....

Images: 
piborg's picture

It does sound like the problem might have something to do with the DC/DC since it is really only used to power the Raspberry Pi.

Using the multimeter can you check what voltage is actually getting to the DC/DC from the battery?
Also what sort of voltages are you seeing on the 5V pin from the DC/DC?

Images: 

battery readings show unstable variation between 5.4-7V
5V for Pi reads a rather steady 5.2V

Images: 
piborg's picture

That battery reading is very low for a 9V battery, both a normal and a rechargeable should be reading much higher.
The DC/DC needs a minimum of 7V to deliver uninterrupted power to the Raspberry Pi, so the voltage going lower than this will mean it cannot supply a good quality 5V output.

What readings do you get from the battery on its own?

Battery test shows it's not running low. It's returning a voltage well above 8V

piborg's picture

8V is actually rather low, our rechargeables tend to read 10.3 V or higher when freshly charged.

By any chance are the batteries you are using labelled either "heavy duty" or "super heavy duty"?

erratum - the battery reads above 9V - my bad. Not 8V as written previously.
I am using non-rechargeable off-the-shelves Duracell/Sony. They are standard and bear no particular label.

I wonder if you could clarify what is the recommended type of battery to use. I assumed non-rechargeable would be the easiest and most reliable option to start with.

cheers - Marc

Herohans's picture

I ended up using a 9v lithium battery and it seems to work better than the non-rechargeable alkaline 9v.

The rechargeable 9v batteries I got from eBay were rubbish.

Hans

piborg's picture

We usually use rechargables as we find that motors eat through batteries!

The ones we would recommend are the Powerex 8.4V 300mAh.
These have proven very reliable for us during our first Formula Pi season which has robots based on ZeroBorg as well.

I too went through this build with 4x 50:1 motors and the KS2 zeroborg.

I can't get any of the scripts to run for any length of time without power loss rebooting the Pi. It's not the dongle either, it does this without it.

For example, using the zbRemote.py script, I've tweaked the MaxPower, and it won't go above 0.50 without the problem occurring.

What should I debug / check next? Any help appreciated

piborg's picture

The usual culprit in these cases is the battery.
If you have not already I would recommend recharging your battery (if rechargeable) or replacing for a brand new battery.

What battery are you using to power the robot?

I have the same problem having built the MagPi device exactly as in the magazine and can only just get it running, and definitely can't turn corners.

In the scripts the voltageOut is set to about 4 - any lower and it just won't move, any higher and it dies as soon as it starts moving.

I am using a non-rechargeable Duracell PP3 battery. I was wondering about hooking up two batteries in parallel in case one can't supply the power needed. I am not sure if it is related to the current limiting in the Zeroborg, or the power from the battery. Since it will barely move I am hoping it isn't current limiting.

I feel your pain!

Same thing, 9v Duracell. Switched to a rechargeable Maplin battery and suddenly everything is working!

The Duracell outputs more than 9v (closer to 10), where the rechargeable is closer to 8v. I'm not exactly clear on what causes all this (I naively assumed that the Duracell would be better).

I have ordered some rechargeable batteries (and a charger) - should arrive in a few days, hopefully that will make things better. There is a 4 year old child (and a 46 year old one) waiting on the results!

piborg's picture

We have spoken to several people now with this same trouble, both in person and via the web. It does seem to be that typical alkaline batteries actually have less "grunt" than the rechargeables.

As Herohans points out above the non-rechargeable lithium batteries are also better than the alkalines, but that is a rather expensive option for running a small robot. Trying some rechargeables is definitely the way to go.

The parallel battery idea is also a good one, we tend to do this ourselves for improving runtime on our small robots (like BOB). It should double the runtime of the batteries as well as the cranking amps (think grunt) that the batteries can provide.

I have eventually started using rechargeable batteries and the robot works really well. 9V Alkaline cannot deliver enough juice for the set-up. It is another lesson learned.

I sourced my batteries locally but consider trying the ones people use for Formula Pi to compare performance. From full charge down to 8.4V (cannot go lower), it is a rather short run and I think I will explore other battery types and look at this parallel battery idea.

I will update the thread with my new power development when I come to it.

Thanks for the support.

Images: 

So I started using two non-rechargeable batteries in parallel, while waiting for the rechargeable ones to arrive, and that made a big difference, but still not good enough. The robot couldn't do the "fast" turns and wasn't quite right.

Now I have some EBL 600mAh Li-ion rechargeable batteries. Since I have two battery connectors I charged and connected both and now it flies (well, nearly - anyone watch Kipper the Dog with their children?).

Hi new to this forum, sorry to piggy back this post but it seemed silly to open a new one.
I have built the robot from issue 51 however the issue i have is that everything seems to work ok but the mostors on one side run a lot fast in fact the ones on the other side seem not to run much at all, could this be an issue with the zeroborg board itself?
cheers
Tim.

i just took some readings with a multimeter, going forwards the mostor on one side get 1.2 volts and the motors on the other side get 5.6,
when i reverse the motors the opposite happens, as in the side that was getting 1.2 now gets the 5.6 and vise versa.
hope that extra info can help someone fix my issue
cheers
Tim

piborg's picture

It sounds like your trouble is probably due to the difference ZeroBorg has between positive and negative drive levels. The good news it is can be solved by making a simple change to the code and the robot wiring :)

What you want to do is change all of the SetMotor calls in the code to use negative values when moving forwards. Any motor outputs you swap in code you will need to also swap the + and - wiring for so that they still drive the correct direction.

Check out this post for more detail on what to change: Forward / reverse differences

Subscribe to Comments for "Magpi Issue 51 Robot Build"