Cant seem to get my project to work

i am making a wireless stepper motor control which consists of two boards (transmitting and receiving boards)
on the transmitter side is the Atmega 2560 connected to a Radio frequency 433MHz transmitter which will transmit pulses. please note that the atmega is hooked to a computer which a GUI is to be coded to enable user friendly.
On the receiver side is an RF receiver of the same transmitting frequency connected to Arduino Uno which is also connected to A UNl2003a and then to the stepper motor.
i have the sketch for the transmitter and receiver side but i cant get the arduino codes to work.
. please help.
i have a copy of the codes too

You should post the entire sketchs (rx side and tx side, including the transmitter and receiver connections which are not present in your schematic) and the code you are attempting to use. Right off the top the cheap 433 meg wireless stuff is not very reliable. You would likely be better off with bluetooth or one of the other packetized radio modules.

Peter

1 Like

i wanted to post the entire sketch but i wan not allowed, courtesy of being a first timer.
These are the Motor Connections.
thank you so much.
The following connections are made between the ULN2003 driver and the Arduino board.
• 5V+ connect to +5V
• 5V- connect to 0V (Ground)
• IN1: to Arduino digital input pin 8
• IN2: to Arduino digital input pin 9
• IN3: to Arduino digital input pin 10
• IN4: to Arduino digital input pin 11

I believe the restriction is 1 file per post, so you can post multiple files, you just have to do a new reply for each. However from this it seems that you can’t get the stepper motor to work (as there is no wireless involved yet) from the drawing. If that is correct I expect you will get better help in the arduino forums such as this article

https://www.arduino.cc/en/Tutorial/StepperOneRevolution

which indicates that your stepper is wired incorrectly as one pole is shorted in your drawing and it thus isn’t likely to work correctly.

Peter

1 Like

ok. i wam checking out the link you pasted.
please in making a graphic user interface i was given a visual basic code to manipulate but i cannot seem to know how or which where to paste it to begin with. any help?
meanwhile i am posting the arduino codes right down below this thread.
thank you so much for helping.

#RECEIVER
int freq=500; // speed in frequency
int motorPins[] = {8, 9, 10, 11};// stepper motor control pins
int count = 0; // for motor drive
int count2 = 0; // for motor drive
int speedLimit=32; // speed limit
unsigned int rfData; // data received from RF
// motor direction true=clockwise, false=anticlockwise
boolean stepperDirection = false;
// whether the string is complete
boolean stringComplete = false;
// Pin 13 has an LED connected on most Arduino board
int led = 13;
void setup() {
// initialize serial:
Serial.begin(600);
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
// motor control pin initiallizaion
for (count = 0; count < 4; count++) {
pinMode(motorPins[count], OUTPUT);
}
//set timer 1 interuppt
cli(); // stop all interuppts
TCCR1A=0; // set entire register to 0
TCCR1B=0; // set entire register to 0
TCNT1=0; // initialize counter value to zero
OCR1A=(156624/speedLimit);//((1000000)/(1024freq))-1; // initial value is 15624> for 1Hz
TCCR1B|=(1<<WGM12); // turn on ctc mode
TCCR1B|=(1<<CS12)|(1<<CS10); //set CS12 and CS10 to 1 to set prescaller 1024
TIMSK1|=(1<<OCIE1A); //enable timer compare interuppt
sei(); // enable global interrupt flag
}
void loop() {
// print the string when a newline arrives:
rfData=readUInt(true); // blocking function which will wait for any data from RF
//if(rfData==290) blink(5);
//speed control
if(rfData==280){
blink(1); // Blink Led one time
stepperDirection=true; // anticlockwise direciton
}
else if(rfData==281){
blink(2); // Blink Led two times
stepperDirection=false; // clockwise direciton
}
else if(rfData==282){
blink(3); // Blink Led three times
if(speedLimit<2048) speedLimit=speedLimit
2;
stringComplete = true;
}
else if(rfData==283){
blink(4); // Blink Led four times
if(speedLimit>4) speedLimit=speedLimit/2;
stringComplete = true;
}
else if(rfData==284){
blink(5); // Blink Led four times
speedLimit=32;
stepperDirection = false;
stringComplete = true;
}
if(stringComplete){
OCR1A=(156624/speedLimit);
stringComplete = false;
}
}
// timer 1 interuppt service routine
ISR(TIMER1_COMPA_vect){
if ((count2 == 0) || (count2 == 1)) {
count2 = 16;
}
count2>>=1;
if(stepperDirection==false) {
for (count = 3; count >= 0; count–) {
digitalWrite(motorPins[3 - count], count2>>count&0x01);
}
}
else if(stepperDirection) {
for (count = 3; count >= 0; count–) {
digitalWrite(motorPins[count], count2>>count&0x01);
}
}
}
/void serialEvent() {
while (Serial.available()) {
// get the new byte:
char inChar = (char)Serial.read();
// add it to the inputString:
inputString += inChar;
// if the incoming character is a newline, set a flag
// so the main loop can do something about it:
if (inChar == ‘\n’) {
stringComplete = true;
}
}
}
/

As far as I know visual basic runs on PCs (I doubt there is a version for an arduino but I could be wrong). That would make sense as a gui is usually too much code for an arduino.

Peter

1 Like

what would you recommend. i have decided to use the new approaches like the one you suggested. i will use bluetooth, ULN2004 and i would love to hear your suggestion for a graphic user interface.

I don’t usually write guis so I’m not a good choice for advise on that. I’d guess your first task is to figure out where the gui will run. To me a PC would be the sensible place to run it as it has the screen and the horsepower to provide one. I’d also do this in stages: first get the stepper motor doing what ever it is supposed to do from the arduino (without the wireless). Once that works then move the code that drives the stepper to the arduino on the far side of the radio link and make that work. Once both of those are done, then figure out how to make the gui do what you want;

Peter

2 Likes

thank you. i will take the steps and keep in touch when i get into trouble.
best regards.