Hello all, I am grateful for becoming a new member of your community. I am very new to Arduino , I bought an Uno last week. I also bought Programming Arduino Next Steps Going Further with Sketches by Simon Monk and it has been very helpful to me.
After dabbling with blink I figured out how to get my motor for my project to spin then I went online and found a sketch someone had already with a loop with the motor going clockwise for 1500 steps then pausing for a second and going 1500 steps counter clockwise a lot faster. I messed with this loop and changed it to int i = 0; i < 9000; i++ instead of 1500 because i figured out i need that many steps i need to move a wood cross beam all the way down my linear rail track.
so I successfully have my wood going across my x axis nicely. I want to throw in some y axis movement so i have to get some more rails and motors but i wanted it to run so y axis comes up before x axis engages then when x returns to start position y engages and comes back down to original position.
I also wanted to integrate either a bluetoothe module (i have the SunFounder bluetooth 4.0 HM-10 Master Slave Modoule) or an RFID chip of some sorts
My original bluetooth plan was to make it run off a phone app to change start stop and speeds of the motor, i know of LightBlue but dont know how to work it exactly, so i feel like i will run into problems there.
I figured an RFID chip i could throw in and make an IF command for everything to only engage and run one loop when i swipe by the chip.. im not sure where to get these or how they work entierly so any information would help.
Also, the motor works fine plugged into the wall. my laptop and a Dcell battery wasnt enough to power it though. I worry what adding another motor to the mix will do. I wanted to find a reliable battery to power my loads, i was thinking lithium ion maybe?
Also i apologize ive had to retype this twice it erased on me. My project is a wooden crossbeam that i have a belt attached to. The belt sends the beam up and down the linear tracks ( x axis) with the help of a bipolar stepper motor.
Thankyou
Thankyou for your help
A couple of points that will help...
use tags when posting code - you can fix / edit the post above.
And before you find out the hard way, study delays without using the delay() function. Once you introduce more than one axis, and remote control/rfid, non-blocking will be critical to your success!
You wrote a long post but I'm afraid I don't understand it. Maybe a diagram of your machine would make it clearer.
And I can't figure out what it is that you want help with. It sounds like you want to extend your program in a few different ways - but I can't make sense of your sentences.
I get the impression you are using a stepper motor even though you never actually mention it
void setup(){
/*Sets all pin to output; the microcontroller will send them(the pins) bits, it will not expect to receive any bits from thiese pins.*/
pinMode(smDirectionPin, OUTPUT);
pinMode(smStepPin, OUTPUT);
Serial.begin(9600);
}
void loop(){
digitalWrite(smDirectionPin, HIGH); //Writes the direction to the EasyDriver DIR pin. (HIGH is clockwise).
/*Slowly turns the motor 1600 steps*/
for (int i = 0; i < 9000; i++){
digitalWrite(smStepPin, HIGH);
delayMicroseconds(100);
digitalWrite(smStepPin, LOW);
delayMicroseconds(100);
}
delay(1000); //Pauses for a second (the motor does not need to pause between switching direction, so you can safely remove this)
digitalWrite(smDirectionPin, LOW); //Writes the direction to the EasyDriver DIR pin. (LOW is counter clockwise).
/*Turns the motor fast 1600 steps*/
for (int i = 0; i < 9000; i++){
digitalWrite(smStepPin, HIGH);
delayMicroseconds(300);
digitalWrite(smStepPin, LOW);
delayMicroseconds(300);
}
delay(1000);
}
I lost original post refreshing server so apologies for that.
I have a bipolar stepper motor programmed to move a block of wood side to side down a track.
my main goal is program in a Bluetooth mod so i can control the motor with a phone app or something of that nature bare minimum atleast get the mod to act as an on off switch because im just running a continous loop at the moment.
If an rfid would be a more efficient way i could look into that.
I've long had an obsession with hidden compartments and moving bookcases that open into other rooms and cool stuff like that.
Lets say i had a tile floor with a 4x4 section cut out and a compartment in the hole to hide valuables in. I want to lift the tile up an inch with my Y -axis before my other motor runs and sends the tile cover in a horizontal position exposing the compartment.
It would be nice to control it from a phone device via wifi so only i know how to open it or i saw walmart sell those hidden vent compartments that are rfid activated. I dont really need a loop function just open and close.
my main goal is program in a Bluetooth mod so i can control the motor with a phone app
Have you got a Bluetooth module for your Arduino?
Do you know how to make an app on your phone send a message to the Arduino Bluetooth module?
Start by sending "Hello World" and displaying it on the Arduino Serial Monitor. Have a look at the examples in Serial Input Basics - simple reliable ways to receive data on your Arduino.