[solved] Make rotoshield work 2

[solved] Make rotoshield work 2

Message non lude erik » Sam 23 Juil 2011 15:48

Hi,

I've just gotten a fully assembled rotoshield and connected it to my Arduino Mega 2560 Board. I've also connected 4 small DC motors and a ca. 7 V battery pack to the external power supply.

When I turn on the power to the main board (mega 2560) the blue LED lights up. But nothing happens when I upload a simple sketch like this:
#include <Wire.h>
#include <snootor.h>

SnootorDC M1;
SnootorDC M2;
SnootorDC M3;
SnootorDC M4;

void setup(){
  Serial.begin(9600);
  Serial.println("Motor test!");
  Wire.begin();
  M1.init(1);
  M2.init(2);
  M3.init(3);
  M4.init(4);
  M1.setSpeed(200);
  M2.setSpeed(200);
  M3.setSpeed(200);
  M4.setSpeed(200);
  M1.run(FORWARD);
  M2.run(FORWARD);
  M3.run(FORWARD);
  M4.run(FORWARD);
}

void loop(){
  Serial.println("forward...");
  delay(2000);
}



I do see the "println" stuff when running the serial monitor.

REMARK: The blue LED does not light up when I turn on the external power supply (even though the polarity is right), but it does turn on when I turn on the power supply for the main board!

Furthermore, when I check the voltage differences it looks like there is a missing link somewhere. It's like the circuit is broken, but I don't know enough electronics to find out where :(

Do you think you'll be able to help?

Thanks,
Erik
erik
 
Messages: 4
Inscription: Sam 23 Juil 2011 15:40

Re: Make rotoshield work 2

Message non lude Lionel » Sam 23 Juil 2011 20:20

Hi Erik,

Sure we'll help you !!

I'll try asap your config and sketch,
We plan to update the library, very soon and we'll release an update at the beginning of the coming week,

Just a detail, a super simple sketch is like that
(sure it's working on uno & duemillanove, I'll check tomorrow on a mega)

Code: Tout sélectionner
// Snootlab Max 7313 Motor shield library
// Based on Adafruit Motor shield library
// https://github.com/adafruit/Adafruit-Motor-Shield-library
// copyleft Snootlab, 2011
// this code is public domain, enjoy!


#include <Wire.h>
#include <snootor.h>

SnootorDC M1;
SnootorDC M2;

void setup(){
  Wire.begin();
  M1.init(1);
  M2.init(2);
}

void loop(){
  M1.setSpeed(255);
  M1.run(FORWARD);
  M2.setSpeed(255);
  M2.run(FORWARD);
  delay(2000);
  M1.setSpeed(255);
  M1.run(BACKWARD);
  M2.setSpeed(255);
  M2.run(BACKWARD);
  delay(2000);
 }


Thank's for your feedback, i'll keep you in touch super quickly
Image - Distributeur officiel Arduino - Conception de shields
Avatar de l’utilisateur
Lionel
 
Messages: 734
Inscription: Mar 21 Déc 2010 09:52
Localisation: Toulouse

Re: Make rotoshield work 2

Message non lude erik » Sam 23 Juil 2011 22:04

Hi Lionel,

Thanks for the quick response.

I tried your sketch, but still no response from the motors.

I've attached a couple of photos so you can see my setup.

Cheers,
Erik
Fichiers joints
mainBoardPower.jpg
Main board power is on - now the LED is shining, but the sketch does not work (no response from engines).
mainBoardPower.jpg (291.12 Kio) Vu 6050 fois
motorPowerNoLight.jpg
Motor power is on (as shown in the voltmeter reading), but no light in LED.
motorPowerNoLight.jpg (670.66 Kio) Vu 6050 fois
voltmeterReading.jpg
Voltmeter reading showing that external power is on, and correctly connected.
voltmeterReading.jpg (1.42 Mio) Vu 6050 fois
erik
 
Messages: 4
Inscription: Sam 23 Juil 2011 15:40

Re: Make rotoshield work 2

Message non lude Lionel » Lun 25 Juil 2011 14:59

Hi Erik,

I try with an arduino Mega 2560 and here are the things to have it up and running:

I²C signal re-mapping :

At this moment, the library did not map the I²C pins from rotoshield to arduino Mega so you've to bridge them like this :

Rotoshield -> Arduino Mega
Pin 4 -> Pin 20 (SDA)
Pin 5 -> Pin 21 (SCL)

Here is a photo :

mega_rotoshield.png
mega_rotoshield.png (494.45 Kio) Vu 6035 fois


Power supply

I strongly suggest you use two differents power supplies (split supply) one for arduino and one for the motors.

Motors are big parasitic sources when running, sending noise on power line.
This noise is able to disturb the microcontroller causing unexpected behavior

Moreover, suddent direction changes or several motor simultaneous start can take lot of energy from source causing unexpected reset on the microcontroller if the same power source is shared.

I suggest you use a big Lead Acid or NiMH battery pack (As suggested in the photo above), or other sources like LiPo... but splitting is highly recommended...

Here is the super simple test sketch I used for 4 DC motors.

Code: Tout sélectionner
// Snootlab Max 7313 Motor shield library
// Based on Adafruit Motor shield library
// https://github.com/adafruit/Adafruit-Motor-Shield-library
// copyleft Snootlab, 2011
// this code is public domain, enjoy!


#include <Wire.h>
#include <snootor.h>

SnootorDC M1;
SnootorDC M2;
SnootorDC M3;
SnootorDC M4;

void setup(){
  Wire.begin();
  M1.init(1);
  M2.init(2);
  M3.init(3);
  M4.init(4);
}

void loop(){
  M1.setSpeed(255);
  M1.run(FORWARD);
  M2.setSpeed(255);
  M2.run(FORWARD);
  M3.setSpeed(255);
  M3.run(FORWARD);
  M4.setSpeed(255);
  M4.run(FORWARD);
  delay(2000);
 
  M1.setSpeed(255);
  M1.run(BACKWARD);
  M2.setSpeed(255);
  M2.run(BACKWARD);
  M3.setSpeed(255);
  M3.run(BACKWARD);
  M4.setSpeed(255);
  M4.run(BACKWARD);
  delay(2000);
 
 }



Hope it'll help
Image - Distributeur officiel Arduino - Conception de shields
Avatar de l’utilisateur
Lionel
 
Messages: 734
Inscription: Mar 21 Déc 2010 09:52
Localisation: Toulouse

Re: Make rotoshield work 2

Message non lude erik » Lun 25 Juil 2011 17:04

Hi,

Before I try your setup I'd like to clarify two things:

1. I did use an external power supply for the motors, but just a pack of batteries.

2. Is it correct that there is no light in the blue LED when the external power is connected to the Rotoshield card? (and the rotoshield card is not connected to the main board)

Thanks again,
Erik
erik
 
Messages: 4
Inscription: Sam 23 Juil 2011 15:40

Re: Make rotoshield work 2

Message non lude Lionel » Lun 25 Juil 2011 17:32

Hi,

It's my fault, there is one thing that is not clear on the Rotoshield use.

The M+ power line for motors is totally independant (for noise consideration)

If you put power only on M+, your logic board (arduino) is not powered.

If M+ is in the arduino power in range (6 to 10V) you can use M+ to power your arduino board. To do that, you have to link M+ and Vin (you can use wire jumper between M+ and Vin)
Vin will be regulated by the arduino board and the 5V regulated by the arduino board will be used for its own power.
But, doing that is not splitting the power sources, and as I said in my previous post, you can expect weird behavior with this use (but it can work...)


erik a écrit:1. I did use an external power supply for the motors, but just a pack of batteries.

Ok, it's good for motors, but you have to power on your Arduino
(see above)

erik a écrit:2. Is it correct that there is no light in the blue LED when the external power is connected to the Rotoshield card? (and the rotoshield card is not connected to the main board)

Yes, because the blue light is only indicating the 5V logic (arduino regulated 5V on)
Image - Distributeur officiel Arduino - Conception de shields
Avatar de l’utilisateur
Lionel
 
Messages: 734
Inscription: Mar 21 Déc 2010 09:52
Localisation: Toulouse

Re: Make rotoshield work 2

Message non lude erik » Lun 25 Juil 2011 18:40

Hi Lionel,

It's working now - great, awesome! Thanks! Merci!
erik
 
Messages: 4
Inscription: Sam 23 Juil 2011 15:40

Re: Make rotoshield work 2

Message non lude Lionel » Lun 25 Juil 2011 19:23

Thank's for your feedback,
Image

I'm glad it's ok now,
have fun !!
Image - Distributeur officiel Arduino - Conception de shields
Avatar de l’utilisateur
Lionel
 
Messages: 734
Inscription: Mar 21 Déc 2010 09:52
Localisation: Toulouse


Retourner vers Support for Snootlab Products

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité

cron