Open latest posts
motion simulator DIY community 

Arduino uno stepper gauge rev meter help.

Aufbau, Betrieb, Reparatur und der Entwicklung von Kontrollern oder sonstiger externer Hardware - Assembly, handling, repair and construction of controllers or external hardware.
on 24.06.2012, 20:39

Arduino uno stepper gauge rev meter help.

Postby antenna on 24.06.2012, 20:39

Hi to all.
I'm a new italian user, so sorry for my english. I've found this great forum searching for build a simple rpm meter for my sim, and after viewing other user post i realize my first project. The platform is an arduino uno connected to an h bridge to drive a small stepper motor from real car cluster( a clone of switec x25). I,'m using x-sim 3. The bound rate is setting to 115200 , x-sim sending data at 8 bit, decimal output. If i start the simulator the meter moves accordly but with some issue, is slow to reach the high point of the scale and sometimes instead of return to min, hold a casual position. I try to change the pause in converter from 33ms to 40ms and slower but seems only affected the accuracy of the movement, if set to lower value instead the motor jitter or not moving at all.
I've tried the example sketch motor knob and other and the stepper works properly.
I think the problem is that arduino analog.read function is too slow to reading the data coming from x-sim as decimal output. Maybe if i send it in binary form the aquisition could be faster but i need a help for the code. I post the currently used.
Thanks in advance.

Code: Select all
#include <Stepper.h>


Stepper stepper(720, 2, 3, 4, 5);


int rpm;
int nextStep;
int pos = 0;


char kind_of_data;


void setup(){
 
Serial.begin(115200);
 
stepper.setSpeed(30);


}


void loop()
{
 
while(Serial.available() > 0)
{

    kind_of_data = Serial.read();
    if (kind_of_data == 'R' ) Read_rpm();
   
   
}

}
void Read_rpm(){
  delay(1);
  int rpm100 = Serial.read()- '0';
  delay(1);
  int rpm10 = Serial.read()- '0';
  delay(1);
  int rpm1 = Serial.read()- '0';

  rpm = 100*rpm100 + 10*rpm10 + rpm1;
  rpm = map(rpm,127,255,0,600);

  nextStep = rpm - pos;
  stepper.step(nextStep);
  pos = rpm;
}
antenna
new member
 
Posts: 1
Joined: 03.06.2012, 16:23
Local time: 20.05.2013, 05:15
Obtained thanks: 0 time


on 11.07.2012, 16:20
Re: Arduino uno stepper gauge rev meter help.

Postby nicko_esx on 11.07.2012, 16:20

check my post may help you.
I think you need to define the number of steps you have your engine.
sorry for my English.
arduino-uno-x-sim-tacometro-con-motor-pap-t3941.html
nicko_esx
full member
 
Posts: 19
Joined: 28.05.2012, 21:14
Local time: 20.05.2013, 05:15
Obtained thanks: 2




Similar topics

Return to X-Simulator compatible hardware


Add this Thread to:
Add this page to Mr. Wong Add this page to Del.icio.us Add this page to Webnews Add this page to Icio Add this page to Oneview Add this page to Linkarena Add this page to Newskick Add this page to Folkd Add this page to Yigg Add this page to Digg Add this page to Reddit Add this page to Simpy Add this page to StumbleUpon Add this page to Slashdot Add this page to Netscape Add this page to Furl Add this page to Yahoo Add this page to Spurl Add this page to Google Add this page to Blinklist Add this page to Blogmarks Add this page to Diigo Add this page to Technorati Add this page to Newsvine Add this page to Blinkbits Add this page to Ma.Gnolia Add this page to Smarking Add this page to Netvouz

Who is online

Users browsing this forum: No registered users and 0 guests

cron