Finally I found what I need. Super, but part 2 is still not (The author does not abandon the topic. I really look forward to continuing. Thank you so much.
Wow! You achieved superhero status with your level of crisp and crystal clear explanations. Yep, you earned yourself my humble sub as my token of thanks and appreciation. By chance, did you make the part 2 yet?
Very nice explanation. This is going to help me out a bunch. I realize there are 101 ways to code the same functionality, but I was wondering if you see an advantage in storing the PWM duration into RC_SHARED and then calling the rc_read_values subroutine to port the values into RC_VALUES. Why not just store the PWM duration directly into RC_VALUES and eliminate the rc_read_values subroutine altogether?
Good video and I look forward to part two.I like the plotter, hadn't seen anyone use that before. I have a project where I need to remotely control a 4000w hub motor that will be used as a winch. The motor's controller requires a 0 to 5v analog input signal to control the speed of the motor in one direction only so, I need the RC receiver PWM signal to enter the arduino nano that I have and come out as an analog signal. I understand the Nano does not have a real analog output but a pulsed output mimicking analog but, I was wondering if the tiny MCP4725 PWM to Analog module that I have could turn that into a smooth variable DC output. I've never done this sort of thing before and have spent some time scratching around the net trying to get some idea as to what code I would need and wondered if your code could be adapted. I would only be using one channel on my 3 channel receiver so would think the code would look rather spartan in comparison. Would you have any ideas on my problem please other than give-up {:-))
nice explanation, but does it work parallel? I mean, interrupt interrupts whole flow to compute a thing... what if at the same time second input comes in? or third? or all 4 channels? can it handle all 4 inputs at same time and provide proper reading/acting?
If you have suggestions for part 2 let me know, I have been working on this video but I can certainly add more before I publish if you can think of something you would like to see!
@@AndyVickersNet Great tutorial, thank you. I hope you continue to develop this series into a functional four wheel RC robotics platform. There are lots of impressive 4 wheel robot videos on youtube and some even use RC controls and have "skid steering" (turn in place) but I haven't seen a series that takes it from start to finish with the detail you're providing. Cheers!
Really helpful, thanks a lot!! how to control 2 DC motors (which has encoder with PWM ,DIR and A&B feedback pins) using RC receiver!! And Can the code support PPM (It would be great, Even if the video is about PPM and DIR pins only) thank you very much!!
Only pins 2&3 are interrupts on the nano according to the arduino website: www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/#:~:text=Uno%2C-,nano,-%2C%20Mini%2C%20other%20328%2Dbased
I'm getting a "'rc_read_values' was not declared in this scope" error. Why?? // Set the size of the arrays (increase for more channels) #define RC_NUM_CHANNELS 4 // Set up our receiver channels - these are the channels from the receiver #define RC_CH1 0 // Right Stick LR #define RC_CH2 1 // Right Stick UD #define RC_CH3 2 // Left Stick UD #define RC_CH4 3 // Left Stick LR // Set up our channel pins - these are the pins that we connect to the receiver #define RC_CH1_INPUT 18 // receiver pin 1 #define RC_CH2_INPUT 19 // receiver pin 2 #define RC_CH3_INPUT 20 // receiver pin 3 #define RC_CH4_INPUT 21 // receiver pin 4 // Set up some arrays to store our pulse starts and widths uint16_t RC_VALUES[RC_NUM_CHANNELS]; uint32_t RC_START[RC_NUM_CHANNELS]; volatile uint16_t RC_SHARED[RC_NUM_CHANNELS]; // Setup our program void setup() {
// Set the speed to communicate with the host PC Serial.begin(9500); // Set our pin modes to input for the pins connected to the receiver pinMode(RC_CH1_INPUT, INPUT); pinMode(RC_CH2_INPUT, INPUT); pinMode(RC_CH3_INPUT, INPUT); pinMode(RC_CH4_INPUT, INPUT); // Attach interrupts to our pins attachInterrupt(digitalPinToInterrupt(RC_CH1_INPUT), READ_RC1, CHANGE); attachInterrupt(digitalPinToInterrupt(RC_CH2_INPUT), READ_RC2, CHANGE); attachInterrupt(digitalPinToInterrupt(RC_CH3_INPUT), READ_RC3, CHANGE); attachInterrupt(digitalPinToInterrupt(RC_CH4_INPUT), READ_RC4, CHANGE); } // Thee functions are called by the interrupts. We send them all to the same place to measure the pulse width void READ_RC1() { Read_Input(RC_CH1, RC_CH1_INPUT); } void READ_RC2() { Read_Input(RC_CH2, RC_CH2_INPUT); } void READ_RC3() { Read_Input(RC_CH3, RC_CH3_INPUT); } void READ_RC4() { Read_Input(RC_CH4, RC_CH4_INPUT); } // This function reads the pulse starts and uses the time between rise and fall to set the value for pulse width void Read_Input(uint8_t channel, uint8_t input_pin) { if (digitalRead(input_pin) == HIGH) { RC_START[channel] = micros(); } else { uint16_t rc_compare = (uint16_t)(micros() - RC_START[channel]); RC_SHARED[channel] = rc_compare; } } void loop() {
// read the values from our RC Receiver rc_read_values(); } / this function pulls the current values from our pulse arrays for us to use. void rc_read_values() { noInterrupts(); memcpy(RC_VALUES, (const void *)RC_SHARED, sizeof(RC_SHARED)); interrupts(); } // output our values to the serial port in a format the plotter can use Serial.print( RC_VALUES[RC_CH1]); Serial.print(","); Serial.print( RC_VALUES[RC_CH2]); Serial.print(","); Serial.print( RC_VALUES[RC_CH3]); Serial.print(","); Serial.println(RC_VALUES[RC_CH4]);
I was struggling with a solution which I made in my AVR for whole day, but just a few minutes of watching your video solved my problem. Thank you:)
Finally I found what I need. Super, but part 2 is still not (The author does not abandon the topic. I really look forward to continuing. Thank you so much.
Part 2 is live! I hope it gives you what you need
Great video+explanation+presentation! Thank you for sharing! Well done mate - NEW SUB 🙏🏻
I really appreciate your clear and concise video.
i needed this, this is great!
Wow! You achieved superhero status with your level of crisp and crystal clear explanations. Yep, you earned yourself my humble sub as my token of thanks and appreciation. By chance, did you make the part 2 yet?
Thank you SO MUCH for the kind feedback! Part 2 just posted! I hope it lives up to part 1!
@@AndyVickersNet Yes it did. Great stuff man 👍🏽👍🏽
This was really helpful! Any news on part 2 of this video?
Yes! This was released, please check it out!
Very nice explanation. This is going to help me out a bunch. I realize there are 101 ways to code the same functionality, but I was wondering if you see an advantage in storing the PWM duration into RC_SHARED and then calling the rc_read_values subroutine to port the values into RC_VALUES. Why not just store the PWM duration directly into RC_VALUES and eliminate the rc_read_values subroutine altogether?
Good video and I look forward to part two.I like the plotter, hadn't seen anyone use that before. I have a project where I need to remotely control a 4000w hub motor that will be used as a winch. The motor's controller requires a 0 to 5v analog input signal to control the speed of the motor in one direction only so, I need the RC receiver PWM signal to enter the arduino nano that I have and come out as an analog signal. I understand the Nano does not have a real analog output but a pulsed output mimicking analog but, I was wondering if the tiny MCP4725 PWM to Analog module that I have could turn that into a smooth variable DC output. I've never done this sort of thing before and have spent some time scratching around the net trying to get some idea as to what code I would need and wondered if your code could be adapted. I would only be using one channel on my 3 channel receiver so would think the code would look rather spartan in comparison. Would you have any ideas on my problem please other than give-up {:-))
nice explanation,
but does it work parallel?
I mean, interrupt interrupts whole flow to compute a thing...
what if at the same time second input comes in? or third? or all 4 channels?
can it handle all 4 inputs at same time and provide proper reading/acting?
good instructions ,i need part2 of this video
If you have suggestions for part 2 let me know, I have been working on this video but I can certainly add more before I publish if you can think of something you would like to see!
@@AndyVickersNet Great tutorial, thank you. I hope you continue to develop this series into a functional four wheel RC robotics platform. There are lots of impressive 4 wheel robot videos on youtube and some even use RC controls and have "skid steering" (turn in place) but I haven't seen a series that takes it from start to finish with the detail you're providing. Cheers!
Hello Andy have published part 2 yet. I was thinking of using a set frequency for pwm so I wouldn't need interrupts
Second video is live! I am not sure what you mean with the set frequency. Is there a reason you want to remove the interrupts?
Thanks, I am going to use Futaba FM 72.75 MHz Digital Proportional Radio Control to do experiment with Arduino, will it be OK?
Kindly guide.
This metode to receive Ppm output from remote sir?
Great work sir keep it up
AWESOME Thank You
Really helpful, thanks a lot!!
how to control 2 DC motors (which has encoder with PWM ,DIR and A&B feedback pins) using RC receiver!!
And Can the code support PPM
(It would be great, Even if the video is about PPM and DIR pins only)
thank you very much!!
Part 2 has servo control in it. Setting up steppers would be very easy if you follow that example
Great video!
Thank you for the support!
Can you help with a code that can drive this project with a stepper motor?
Good
How to make suspensi wit servo
Part 2 shows how to use servos
hi bro nice presentaion. how to do codeing for rc car using arduino uno...........
Part 2 of the RC controller series is up and that shows servos so it should get you half way there!
I have and Arduino Nano, but it's not working, i change the pins from 18, 19, 20 and 21 to digital 8, 9, 10 and 12 but nothing- Help
Only pins 2&3 are interrupts on the nano according to the arduino website:
www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/#:~:text=Uno%2C-,nano,-%2C%20Mini%2C%20other%20328%2Dbased
Hello, sir can you help me in writing a Arduino code
All the code is available on my website linked in the description
I need part 2 ????
Its been released! Please check it out and let me know if it helps!
I'm getting a "'rc_read_values' was not declared in this scope" error. Why??
// Set the size of the arrays (increase for more channels)
#define RC_NUM_CHANNELS 4
// Set up our receiver channels - these are the channels from the receiver
#define RC_CH1 0 // Right Stick LR
#define RC_CH2 1 // Right Stick UD
#define RC_CH3 2 // Left Stick UD
#define RC_CH4 3 // Left Stick LR
// Set up our channel pins - these are the pins that we connect to the receiver
#define RC_CH1_INPUT 18 // receiver pin 1
#define RC_CH2_INPUT 19 // receiver pin 2
#define RC_CH3_INPUT 20 // receiver pin 3
#define RC_CH4_INPUT 21 // receiver pin 4
// Set up some arrays to store our pulse starts and widths
uint16_t RC_VALUES[RC_NUM_CHANNELS];
uint32_t RC_START[RC_NUM_CHANNELS];
volatile uint16_t RC_SHARED[RC_NUM_CHANNELS];
// Setup our program
void setup() {
// Set the speed to communicate with the host PC
Serial.begin(9500);
// Set our pin modes to input for the pins connected to the receiver
pinMode(RC_CH1_INPUT, INPUT);
pinMode(RC_CH2_INPUT, INPUT);
pinMode(RC_CH3_INPUT, INPUT);
pinMode(RC_CH4_INPUT, INPUT);
// Attach interrupts to our pins
attachInterrupt(digitalPinToInterrupt(RC_CH1_INPUT), READ_RC1, CHANGE);
attachInterrupt(digitalPinToInterrupt(RC_CH2_INPUT), READ_RC2, CHANGE);
attachInterrupt(digitalPinToInterrupt(RC_CH3_INPUT), READ_RC3, CHANGE);
attachInterrupt(digitalPinToInterrupt(RC_CH4_INPUT), READ_RC4, CHANGE);
}
// Thee functions are called by the interrupts. We send them all to the same place to measure the pulse width
void READ_RC1() {
Read_Input(RC_CH1, RC_CH1_INPUT);
}
void READ_RC2() {
Read_Input(RC_CH2, RC_CH2_INPUT);
}
void READ_RC3() {
Read_Input(RC_CH3, RC_CH3_INPUT);
}
void READ_RC4() {
Read_Input(RC_CH4, RC_CH4_INPUT);
}
// This function reads the pulse starts and uses the time between rise and fall to set the value for pulse width
void Read_Input(uint8_t channel, uint8_t input_pin) {
if (digitalRead(input_pin) == HIGH) {
RC_START[channel] = micros();
} else {
uint16_t rc_compare = (uint16_t)(micros() - RC_START[channel]);
RC_SHARED[channel] = rc_compare;
}
}
void loop() {
// read the values from our RC Receiver
rc_read_values();
}
/ this function pulls the current values from our pulse arrays for us to use.
void rc_read_values() {
noInterrupts();
memcpy(RC_VALUES, (const void *)RC_SHARED, sizeof(RC_SHARED));
interrupts();
}
// output our values to the serial port in a format the plotter can use
Serial.print( RC_VALUES[RC_CH1]); Serial.print(",");
Serial.print( RC_VALUES[RC_CH2]); Serial.print(",");
Serial.print( RC_VALUES[RC_CH3]); Serial.print(",");
Serial.println(RC_VALUES[RC_CH4]);