Offline
Newbie
Karma: 0
Posts: 30
Un robot non può recare danno agli esseri Umani, nè può permettere che, a causa del suo mancato intervento, gli esseri Umani ricevano danno
|
 |
« on: February 23, 2013, 01:21:01 pm » |
Buongiorno a tutti! Per la terza volta che chiedo aiuto sul forum(in circa tre mesi...), vi do una bella gatta da...rasare a zero!  Allora, ho da poco comprato una motor Shield per Arduino UNO per comandare 2 motori in continua...(scheda tecnica: http://it.opitec.com/opitec-web/articleNumber/224057/kbmo/p/2). Ho cercato di alimentare i motori con una batteria da 9 volt, mentre le schede le alimentavo a USB, ma, seppur stringendo la morsettiera, non si accendevano i LED che indicano l'elettricità che arriva ai motori(presente sulla scheda Shield). La scheda Arduino accendeva i led ON, TX RX(quando necessario...), ma quelli della scheda Shield (sempre quelli dei famosi motori!!) si accendevano a volte quando spostavo un po' i cavi(li ho provati tutti: fili intrecciati, rame sottile e da breadboard[da scheda milliforata]). Come codice ho usato questo: /* * Sketch Test Motori Shield FE * * @author: Alfieri Mauro * @see: by Giant Savings Extension" href="#" in_rurl="http://i.trkjmp.com/click?v=SVQ6MTg0ODM6OTc3Omh0dHA6OTdjNDFmNDc2YzhmYmEwYmNmMmFmNzgzYzEyMWE5MzQ6ei0xMjQyLTEyNDkwMTp3d3cubWF1cm9hbGZpZXJpLml0OjIwOTAwOjM3YzFmYzUwMjIzYzlmMWE3N2YwYTE4MDlmZDFhMDk3"http://www.mauroalfieri.it * * @licenze: Creative common */ int pinDirA=2; int pinDirB=8; int pinPwmA=3; int pinPwmB=9; void setup() { pinMode( pinDirA,OUTPUT ); pinMode( pinPwmA,OUTPUT ); pinMode( pinDirB,OUTPUT ); pinMode( pinPwmB,OUTPUT ); } void loop() { // Test: rotazione dei motori // stessa direzione, vel digitalWrite( pinDirA,HIGH ); digitalWrite( pinDirB,HIGH ); // velocità massima analogWrite( pinPwmA,255 ); analogWrite( pinPwmB,255 ); delay(5000); // Test: rotazione dei motori // direzione inversa digitalWrite( pinDirA,LOW ); digitalWrite( pinDirB,LOW ); // velocità massima analogWrite( pinPwmA,255 ); analogWrite( pinPwmB,255 ); delay(5000); // Test: rotazione dei motori // direzione incrociata digitalWrite( pinDirA,HIGH ); digitalWrite( pinDirB,LOW ); // velocità massima analogWrite( pinPwmA,255 ); analogWrite( pinPwmB,255 ); delay(5000); // Test: rotazione dei motori // direzione incrociata digitalWrite( pinDirA,LOW ); digitalWrite( pinDirB,HIGH ); // velocità massima analogWrite( pinPwmA,255 ); analogWrite( pinPwmB,255 ); delay(5000); // Test: stop dei motori // nessuna direzione digitalWrite( pinDirA,HIGH ); digitalWrite( pinDirB,HIGH ); // velocità nulla analogWrite( pinPwmA,0 ); analogWrite( pinPwmB,0 ); delay(5000); }
che proviene da qui: http://www.mauroalfieri.it/elettronica/tutorial-collega-la-motor-shield-e-pilota-i-motori.htmlMa non parte nulla!!! grazie a tutti quelli che vorranno aiutarmi!
|
|
|
|
|
Logged
|
|
|
|
|
L'Aquila
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #1 on: February 24, 2013, 02:50:50 pm » |
Domanda banale: hai messo bene i jumper?
Poi non capisco perchè tutti quei: analogWrite( pinPwmA,255 ); analogWrite( pinPwmB,255 );
|
|
|
|
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 160
Posts: 15605
+39 349 2158303
|
 |
« Reply #2 on: February 24, 2013, 04:20:36 pm » |
La batteria é piena? È meglio se usi una batteria da 4,5V visto che i motori non sono per 9V. Secondo me l' errore é nel cablaggio dei motori. Puoi fare un circuito e spedirci una doto dove si vede come hai collegato la batteria e i motori? Ciao Grazie Uwe
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 30
Un robot non può recare danno agli esseri Umani, nè può permettere che, a causa del suo mancato intervento, gli esseri Umani ricevano danno
|
 |
« Reply #3 on: February 26, 2013, 03:50:09 am » |
Lo sketch funziona(ho sostituito i motori con dei led e funzonavano alla grande). Domanda banale: hai messo bene i jumper?
Quanto al Jumper : Cos'è e dove si trova??? La scheda motor shield che ho utilizzato è a versione Rev3. Secondo me l' errore é nel cablaggio dei motori.
Credo che il problema sia nei collegamneti con la morsettiera. La batteria é piena? Sì, la batteria é piena e ben funzionante(nuova di zecca!) Puoi fare un circuito e spedirci una doto dove si vede come hai collegato la batteria e i motori?
cerchero di spedirvi la foto al più presto! Poi non capisco perchè tutti quei: analogWrite( pinPwmA,255 ); analogWrite( pinPwmB,255 ); serve a regolare la velocità! Sono contenot che abbiate risposto, GRAZIE!!!
|
|
|
|
|
Logged
|
|
|
|
|
L'Aquila
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #4 on: February 26, 2013, 05:12:56 am » |
Ottimo.
Pensavo avessi lo stesso shield dell'articolo da cui hai preso il sorgente dove devi usare i jumper per impostare i pin usati..
|
|
|
|
|
Logged
|
|
|
|
|
Cagliari
Offline
Faraday Member
Karma: 49
Posts: 3000
|
 |
« Reply #5 on: February 26, 2013, 05:48:08 am » |
Credo che abbia sbagliato i pin. Se hai la shield ufficiale: Input and Output This shield has two separate channels, called A and B, that each use 4 of the Arduino pins to drive or sense the motor. In total there are 8 pins in use on this shield. You can use each channel separately to drive two DC motors or combine them to drive one unipolar stepper motor. The shield's pins, divided by channel are shown in the table below:
Function pins per Ch. A pins per Ch. B Direction D12 D13 PWM D3 D11 Brake D9 D8 Current Sensing A0 A1
If you don't need the Brake and the Current Sensing and you also need more pins for your application you can disable this features by cutting the respective jumpers on the back side of the shield. The additional sockets on the shield are described as follow: Screw terminal to connect the motors and their power supply. 2 TinkerKit connectors for two Analog Inputs (in white), connected to A2 and A3. 2 TinkerKit connectors for two Aanlog Outputs (in orange in the middle), connected to PWM outputs on pins D5 and D6. 2 TinkerKit connectors for the TWI interface (in white with 4 pins), one for input and the other one for output.
Motors connections Brushed DC motor. You can drive two Brushed DC motors by connecting the two wires of each one in the (+) and (-) screw terminals for each channel A and B. In this way you can control its direction by setting HIGH or LOW the DIR A and DIR B pins, you can control the speed by varying the PWM A and PWM B duty cycle values. The Brake A and Brake B pins, if set HIGH, will effectively brake the DC motors rather than let them slow down by cutting the power. You can measure the current going through the DC motor by reading the SNS0 and SNS1 pins. On each channel will be a voltage proportional to the measured current, which can be read as a normal analog input, through the function analogRead() on the analog input A0 and A1. For your convenience it is calibrated to be 3.3V when the channel is delivering its maximum possible current, that is 2A. Segui questo tutorial --> http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/?ALLSTEPSSchema collegamento  Sketch /************************************************************* Motor Shield 2-Channel DC Motor Demo by Randy Sarafan
For more information see: http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/
*************************************************************/
void setup() { //Setup Channel A pinMode(12, OUTPUT); //Initiates Motor Channel A pin pinMode(9, OUTPUT); //Initiates Brake Channel A pin
//Setup Channel B pinMode(13, OUTPUT); //Initiates Motor Channel A pin pinMode(8, OUTPUT); //Initiates Brake Channel A pin }
void loop(){
//Motor A forward @ full speed digitalWrite(12, HIGH); //Establishes forward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A analogWrite(3, 255); //Spins the motor on Channel A at full speed
//Motor B backward @ half speed digitalWrite(13, LOW); //Establishes backward direction of Channel B digitalWrite(8, LOW); //Disengage the Brake for Channel B analogWrite(11, 123); //Spins the motor on Channel B at half speed
delay(3000);
digitalWrite(9, HIGH); //Engage the Brake for Channel A digitalWrite(9, HIGH); //Engage the Brake for Channel B
delay(1000); //Motor A forward @ full speed digitalWrite(12, LOW); //Establishes backward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A analogWrite(3, 123); //Spins the motor on Channel A at half speed //Motor B forward @ full speed digitalWrite(13, HIGH); //Establishes forward direction of Channel B digitalWrite(8, LOW); //Disengage the Brake for Channel B analogWrite(11, 255); //Spins the motor on Channel B at full speed
delay(3000);
digitalWrite(9, HIGH); //Engage the Brake for Channel A digitalWrite(9, HIGH); //Engage the Brake for Channel B
delay(1000);
}
|
|
|
|
|
Logged
|
IDE 1.0.4 - Arduino UNO R3 - Ethernet Shield R3 - DCF77 Module - Adafruit Data Loggin Shield - LCD 16x2 RGB positive backlight - i2c LCD backpack - RTC 1307 Board - Saleae Compatibile Logic Analyzer 8ch 24Mhz - ATtiny2313 ProtoBoard - Xino Board - ATtiny 4313 - Arduino 2009 - Arduino USB Serial Ligth - DS18B20 - LM35DZ - ShiftRegister - TL431 - ATtiny 85 Ultimi acquisti: CodeBender: http://codebender.cc/register/?referrer=PaoloP
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 30
Un robot non può recare danno agli esseri Umani, nè può permettere che, a causa del suo mancato intervento, gli esseri Umani ricevano danno
|
 |
« Reply #6 on: March 01, 2013, 09:56:03 am » |
che cavolo vuol dire saltare/tagliare il Vin Connect??E'il traduttore di google che spara fischi per fiaschi o cosa???
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16431
Don't know what I do
|
 |
« Reply #7 on: March 01, 2013, 10:03:17 am » |
che cavolo vuol dire saltare/tagliare il Vin Connect??E'il traduttore di google che spara fischi per fiaschi o cosa???
Riporta la frase in inglese, almeno si capisce il verbo che hanno usato.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 30
Un robot non può recare danno agli esseri Umani, nè può permettere che, a causa del suo mancato intervento, gli esseri Umani ricevano danno
|
 |
« Reply #8 on: March 02, 2013, 12:21:13 pm » |
This is possible by cutting the "Vin Connect" jumper placed on the back side of the shield.
|
|
|
|
|
Logged
|
|
|
|
|
Forum Moderator
Italy
Offline
Brattain Member
Karma: 219
Posts: 16431
Don't know what I do
|
 |
« Reply #9 on: March 02, 2013, 01:40:34 pm » |
This is possible by cutting the "Vin Connect" jumper placed on the back side of the shield.
To cut significa proprio "tagliare" nel senso letterale del termine, tagliare. Sicuramente c'è un jumper fatto con una piazzola ed una piccola traccia di stagno (ad esempio quello del RESET-EN dell'Arduino), che va interotto come riporta il testo: Ciò è possibile tagliando [interrompendo] il ponticello "Vin Connect" posto nella parte posteriore dello shield.
|
|
|
|
|
Logged
|
|
|
|
|
BZ (I)
Offline
Brattain Member
Karma: 160
Posts: 15605
+39 349 2158303
|
 |
« Reply #10 on: March 02, 2013, 06:03:37 pm » |
 Il ponticello di cui si parla é quella pista sottile tra le due piazzette stagnate in basso al centro dove é scritto vicino "Vin connect". Ciao Uwe
|
|
|
|
|
Logged
|
|
|
|
|
|