New to stepper motors.. trying to tie GPS into stepper mapping
hi there,
i've found excellent examples online of tinygps++ along stepper motor examples. i've managed far gps set motor speed , start making tiny steps depending on going forward. since gps doesn't have "you're slowing down now, you're needing go back", i'm having hard time wrapping head around how stepper motor go back.
here's code i've ran far mixture of different examples i've found online through tinygps++ library along arduino examples. far, seems give me ability stepper motor move forward slightly. nothing else.
this doesn't control that's calibrated though.
so in case, if motorspeed above 0, determined yanking tinygps++ mph mark, , stepper motor goes in steps, faster if go faster, no actual ability map specific mph.
if i'm going 5, want step 10 steps. if i'm going 10mph want jump 10 steps. if slow down , speed goes down, want able reduce steps , go 1 value.
i'm @ bit of hair pull on 1 because i've never worked stepper motors on this. thing mine /may/ wired in backwards seems go /forward/ -values , backwards +values.
if sounds incredibly stupid, have apologies. i'm still learning stuff. did manage @ least move 1 one little 5mph scoot down road while had hold mess of wires , got, "hey it's moving!"
so know gps recall mph in tinygps++ works, , stepper motor seems fine. i'm @ loss on how loop in manner can precise angles.
i read on adafruit's website automotive stepper motor gauge 600 steps per rotation, 1 rotation full 315 degrees. i'm going using closer 300 degrees on gauge. if chop down i'm close 2 steps per 1mph on rotation, it's more 1.9.
i don't expect write me, if has recommendations on functions need read on since i'm new this, appreciate learning.
i've found excellent examples online of tinygps++ along stepper motor examples. i've managed far gps set motor speed , start making tiny steps depending on going forward. since gps doesn't have "you're slowing down now, you're needing go back", i'm having hard time wrapping head around how stepper motor go back.
here's code i've ran far mixture of different examples i've found online through tinygps++ library along arduino examples. far, seems give me ability stepper motor move forward slightly. nothing else.
#include <stepper.h> #include <softwareserial.h> #include <tinygps++.h> // tinygps++ object tinygpsplus gps; softwareserial ss(12, 3, false); const int steps = 600; // change fit number of steps per revolution const int test = 100; int stepcount = 0; // initialize stepper library on pins 8 through 11: stepper mystepper(steps, 4, 5, 6, 7); void setup() { // initialize serial port: { serial.begin(115200); ss.begin(9600); } } void loop() { int sensorreading = gps.speed.mph(); serial.print("miles per hour="); serial.print(sensorreading); int motorspeed = map(sensorreading, 0, 180, 0, 100); if (motorspeed > 0) { mystepper.setspeed(motorspeed); mystepper.step(-steps / 100); } } |
this doesn't control that's calibrated though.
so in case, if motorspeed above 0, determined yanking tinygps++ mph mark, , stepper motor goes in steps, faster if go faster, no actual ability map specific mph.
if i'm going 5, want step 10 steps. if i'm going 10mph want jump 10 steps. if slow down , speed goes down, want able reduce steps , go 1 value.
i'm @ bit of hair pull on 1 because i've never worked stepper motors on this. thing mine /may/ wired in backwards seems go /forward/ -values , backwards +values.
if sounds incredibly stupid, have apologies. i'm still learning stuff. did manage @ least move 1 one little 5mph scoot down road while had hold mess of wires , got, "hey it's moving!"
so know gps recall mph in tinygps++ works, , stepper motor seems fine. i'm @ loss on how loop in manner can precise angles.
i read on adafruit's website automotive stepper motor gauge 600 steps per rotation, 1 rotation full 315 degrees. i'm going using closer 300 degrees on gauge. if chop down i'm close 2 steps per 1mph on rotation, it's more 1.9.
i don't expect write me, if has recommendations on functions need read on since i'm new this, appreciate learning.
so in case, if motorspeed above 0, determined yanking tinygps++ mph mark, , stepper motor goes in steps, faster if go faster, no actual ability map specific mph.are trying use stepper motor move needle on speedometer? so. or else explain motor intended do.
if speedometer don't want change stepper's speed match mph value, need change position.
you don't seem have code motor move 0 position start. need figure how many steps required max indicated speed. , can relate position between 0 , max gps speed.
...r
stepper motor basics
simple stepper code
Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > New to stepper motors.. trying to tie GPS into stepper mapping
arduino
Comments
Post a Comment