Jump to content
ELFORUM - Forumul electronistilor

Arduino


Guest madfalcon81

Recommended Posts

Guest madfalcon81

Prima mea postare pe acest forum, sunt destul de incepator (ca sa zic asa in acest domeniu), deci aveti mila :speriat

 

Avem asa:

 

1 bucata arduino uno: http://arduino.cc/

1 bucata motor stepper: Nema17, 4 fire (deci bipolar..sper:P), 0,4 A

1 bucata L298n driver: http://www.magazin_online

 

Cum le conectez intre ele ???

 

Din cate am inteles cele 4 fire de la motor se duc 2 cate 2 in OUTPUT A, respectiv B (vezi poza driverului), in 12 V si 5 V intra curent de la o sursa (in cazul meu una de calculator). Ce fire "trag"de la arduino ??? Presupun ca trebuie 4 (?!?!) fire trase in cele 4 intrari logice ?! Si daca da, atunci cum controlez directia, si stepul motorului..?

Link to comment
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

  • yo9hnf

    2

  • MatyC

    1

  • 2 months later...

Intreb si eu aici...Trebuie sa afisez pe un LCD o turatie.Problema este ca din algoritm turatia imi este afisata cu doua zecimale (cu 3 zecimala daca rpm < 1000).Mie imi trebuie sa vad, pentru comoditate, turatie ca numar intreg sau rotunjit (fara virgula). (Ex: 3400 in loc de 3400,22). Am incercat diverse metode de rotunjire a variabilei, care functionau, dar daca cresteam (brusc) turatia de la 600rpm la 3000rpm iar apoi o scadeam brusc, rezultatul "intreg" era de 10 ori mai mare decat realitatea , de exemplu pentru 600,20 , imi arata 6000. Am incercat asa :lcd.print(int(rpm) Am incercat si asa :if (rpm<1000){rpm=rpm/10;} Nicio varianta nu merge. Aveti vreo idee ?

Link to comment

Si inca o chestie...

 

Codul intreg (momentan) este :

 

#include <LiquidCrystal.h>LiquidCrystal lcd(12, 11, 5, 4, 3, 6);byte trigger;                                                    // Set to TRUE if the interrupt has triggered at least once since the last loopunsigned long t0, t1;                                            // The time in milliseconds that the interrupt fired qfloat rpm;                                                     void setup(){  lcd.begin(20, 4);    attachInterrupt(0, rpm_fun, RISING);                           // to pin2 of the ArduinoSerial.begin(9600);  t0 = 0;                                                        // Previous time = 0  t1 = 0;                                                        // This time = 0  trigger = 0;  lcd.setCursor(0,0);  lcd.print("--------------------");  lcd.setCursor(0, 3);  lcd.print("---------------- RPM");  lcd.setCursor(0, 1);  lcd.print("Turatie  impusa=");  lcd.setCursor(0,2);  lcd.print("RPM acum=");}void loop(){  float g = 0;  if (trigger != 0) {    // If the interrupt has been fired, work out the new RPM    g = t1 - t0;    //g = g/1000; // Convert to milliseconds    rpm = (1/g) * 60000000;      trigger = 0;  // Reset the interrupt   }  // Print RPM every second, or thereabouts, provided there's at least one average     // Wait around 1s delay(1000);  lcd.setCursor(10,2);  lcd.print(rpm);  Serial.println(rpm);   }void rpm_fun(){  // Each rotation, this interrupt function is run twice  // (is it?? Why? A: It's not (necessarily), it depends on the magnet.  if (t0 == 0)    t0 = micros();  else {    t0 = t1;    t1 = micros();    trigger = 1;  }} 

Daca opresc motorul (deci rpm=0), el imi arata in continuare pe ecran, dar si in consola seriala o turatie de circa 500-600 rpm fixa, gen 530.26 .

Cum pot face sa imi arate 0 cand motorul este oprit ?

 

Am incercat cu if pulseIn..... , sa stearga secventa respectiva de pe LCD, dar tot asa face.

Link to comment
  • 1 month later...

Salutare ,

Am un proiect care include un Arduino si putina electronica, in principal ma intereseaza programarea unui Arduino cu un altgoritm . Problema este ca nu ma pricep la nici una. Nu caut un ajutor ci un serviciu contra cost .

 

Urgent : 072663388 Alex

 

si email , [email protected]

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines