loading
 
Arduiino module problem
Alan Coggins from Australia  [32 posts]
11 year
I'm trying to do a  basic program where I use the Arduino module to control 2 motors (forward and back) and a tilt on a webcam - these are mapped to some keyboard keys. I can get it all working OK, but then when I close Roborealm and come back later and reload the robo file it doesn't work any more. I find I have to open and close the prgram and keep reloading the file and keep hitting the reset button on the Arduino a random number of times till it "takes" again.

Sometimes I get weird results in the process like one motor going full speed non-stop. Eventually I can get it working properly, but it's annoying.

Any ideas what is going on? I have attached the robo file. Thanks!
program.robo
Anonymous 11 year
Alan,

Are you attaching the motors directly to the pin outs? Most likely what is happening is that power is dropping on the Arduino and causing it to reset. You have to not only supply external power but use additional power circuitry for motors that use more than 50ma (yes, that's 50ma and not 1a).

To verify this remove the motors and see if things behave a bit better. The servo should be ok without additional power.

STeven.
Alan Coggins from Australia  [32 posts] 11 year
Hi Steven,

Sorry, should have mentioned that in the original post. The motors are controlled through an H-bridge chip and have a separate power supply. The problem occurs with both the motors and also the servo on the tilt webcam (that is also run from the separate battery). I have common grounds to everything including Arduino.

It is more that it doesn't seem to "re-initialise" - I load the program then try and use the motor control keys (which I have set as up and down arrows) but those keys still function in the RoboRealm interface rather than taking on the new keyboard mapping.  
Alan Coggins from Australia  [32 posts] 11 year
Hi Steven,

Here's a bit more detail about what's happening. When I restart the computer and open Roborealm it opens to the program I posted above. The webcam almost freezes (0.8 FPS) and the number next to Arduino module (what do these numbers mean anyway?) says 01:406 or similar.  Nothing works on the robot. I then push the Arduino reset button and it goes haywire - left motor running full speed and webcam jittering and bouncing madly. I have to keep clearing program and reloading, and hitting the Arduino reset until it all decides to settle down. Once it has reset itself it works fine.

As I'm building an independent robot I need this to open and work when the computer starts. By the way, the Arduino is always connected to the computer by the same USB port.

Hope you can help. Thanks, Alan

 
Alan Coggins from Australia  [32 posts] 11 year
OK - I've completely dismantled it and started rebuilding step by step, testing as I go. It seems that the problem is something to do with the interface between the H-bridge chip I'm using to control the motors and the Arduino module.

I'll keep playing around... maybe try a different way to control the motors.
Anonymous 11 year
Alan,

The numbers of the left side of the pipeline indicate the amount of seconds that are being used by that module. Normally this is not of great interest other than when debugging or optimizing. The 1+ second on the Arduino module indicates that it is not able to communicate to the Arduino in a correct way and is timing out. That's the reason the fps is also so slow ... once the connection is made the speed should dramatically increase.

Good call on the rebuild. Simplify it down to where you know things are working and then piece-wise add back in components ensure that things still work as you do so. That should tell you where the fault is.

Good luck!
STeven.
Alan Coggins from Australia  [32 posts] 11 year
Hi Steven.

I have tracked down the problem finally. A bit obscure so I thought I'd post it here in case it is causing someone else simialar headaches.

I have set up digital pins 4, 5 6 and 7 (see image) ... just wires coming out, nothing attached to them. Voltage on all four wires is about 0.2V. When you click the  little box to activate a pin, it jumps to 5V. The others stay at about 0.2V.

Now,  I close RoboRealm, shut down the computer and restart, then open RoboRealm. The voltage on two of the pins is still 0.2V, but the voltage on the other two is now 0.4V - that is actually enough to trigger the H-bridge and start a motor running.

If I hit the reset button on the Arduino then all pins go back to being around 0.2V and the motors behave normally again.

Obviously I will need to find a different, less sensitive motor control.

 
Anonymous 11 year
Alan,

What happens when you uncheck the box after being checked. Does the voltage drop from 5V to 0.4V or to 0.2V? I'm wondering if just activating the port as an output port may be adding a 0.2V.

You could also try adding a resistor between the pin and the motor controller to decrease the voltage ... seems that the motor controller is very sensitive.

STeven.
Anonymous 11 year
Hi Steven,

I just about ready to give up on this. There is some strange voltage problem happening with your Arduino module and I just can't work out what is going on. I bought a new motor controller (http://www.dfrobot.com/index.php?route=product/product&product_id=66#.UCWecKD4V8E) and I'm getting the same issues.

It couldn't be simpler - connections for two motors and four Arduino pins. But when I first start RoboRealm there is a humming from the motors like they are getting a bit of current from somewhere but not enough to run them. There are lights on the board to show when an Arduino signal is received, and these are dimly lit. Sometimes it works OK once I start to use the motor control, and then the humming stops and it settles down. But sometimes the motor controls don't work at all.

I've tried resistors but that doesn't help. Even if I uncheck all the motors and close and reopen Roborealm then I still get that slight current and the motors hum.

Any other suggestions before I pack it in?

Alan

Anonymous 11 year
FINALLY!! I have tracked down the problem!!!

The issue is with the use of shared pins in your Arduino module. The motor controller works perfectly if I just stick to pins 2, 4, 7 and 8. Pins 3, 5, 6, 9, 10, 11 are the ones giving erratic results.

It seems that when Roborealm first starts up there are some mixed messages going on. Once you use a pin, then it seems to settle down (mostly, not always) as if it now knows what that pin is meant to do.

Anyway, I'll leave that with you to think about.
Anonymous 11 year
Alan,

Thanks for the info. We tracked down the problem to the initialization of the servos even if the pin was allocated to be a DIO pin. This would cause some of the issues that you had been seeing and would settle down after the DIO pin would be used for a bit. This has been corrected in the latest version.

Thanks!
STeven.
Anonymous 11 year
Great work Steven - glad I could help.

I'll be expecting a complimentary bottle of hair-restorer tonic from Roborealm :-)

Cheers, Alan

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index