How to make a bot wireless?

OK guys i always wanted to make a bot wireless so i immediately bought a hobby king 6ch 2.4ghz tx and rx and then i thought i could hook it up to normal motors using h bridges and arduino but after reading i found out that it is difficult to decode the pwm output of the reciver :frowning:

and i also heard while it is decoding the pwm it cant do any other task and it takes up lots of time... so i need ur help in building a sumo bot....

i would be using a differential drive so would need the bot to go in forward, reverse, rotate cw, rotate ccw, and and extra output for my weapon.....

so please tell me if it is possible to make my bot wireless with arduino and 2.4ghz 6channel transmitter and reciver

Here is a link to something non English, but still is very good at describing how to do what you want: http://www.pillsofbits.com/project/libreria-di-arduino-leggere-segnali-ppm

Also here is the link to the library from that post that does all of the ppm decoding for you: GitHub - domenicomonaco/PPM-Signal-Reader-ARDUINO: Arduino PPM signal reader/decoder Library

okay so i downloaded the header file PPMrcIn.h into a folder name PPMrcIN created in libraries

then used the following code

#include <ppmrcin.h>
// must be install into libraries http://github.com/kiuz/Arduino-Statistic-Library
#include <Statistic.h>

//init a Channel class to store and manage CannelX form reciever
Channel channel1;

void setup() {
  Serial.begin(9600);
 
  Serial.println("Ready:");

  pinMode (13, INPUT);
  channel1.init(1,13);
}

void loop() {
  delay(20);
  
  channel1.readSignal();
  
  Serial.println(channel1.getSignal());
  Serial.println(channel1.getPosition());
  Serial.println(channel1.getVersus());
  Serial.println(" ");
}

it gives me errors while compiling as
ppmrcin.h no such file or directory
statistic.h no such file or directory
'Channel' does not name a type

in function void setup():
'channel1' was not declared in this scope

in function void loop():
'channel1' was not declared in this scope

Hi,

I think you'll find most of those issues will be caused by the two libraries you need not being present.
The library is actually made up of (at least) two files. PPMrcIn.cpp and PPMrcIn.h in this case.

I notice the info on that project also mentions to grab statistic library from github here: GitHub - domenicomonaco/Arduino-Statistic-Library: Simple Statistic Library so you'll need to download and install that library's files also.

Cheers !
Geoff

okay i made a ppmrcin and statistic sub folders in library folder and copied ppmrcin.h, ppmrcin.cpp and statistic.h,statistic.cpp to respective folders and still i get error

sketch_mar15a.cpp:12:21: error: ppmrcin.h: No such file or directory
sketch_mar15a:16: error: 'Channel' does not name a type
sketch_mar15a.cpp: In function 'void setup()':
sketch_mar15a:24: error: 'channel1' was not declared in this scope
sketch_mar15a.cpp: In function 'void loop()':
sketch_mar15a:30: error: 'channel1' was not declared in this scope
Bad error line: -1

is there any other code which is more efficient like the one using interrupt method rather than the pulse in method??? i meant which does not spend all the time reading the input signal but only reads them when changed???

also i want to use 3 channels for input, one channel ill divide them into half such that if there is a value above the half then it moves front and if its value below the half it moves back.... and other channel such that if its greater than half then it rotates clockwise and if its less than half it rotates counter clockwise....

and last channel to activate my weapon

so please tell me how to modify an effective code which can help my bot with all these actions and it does not spend much time decoding signal or else if it spends half time reading signal and half time implementing code then my bot would get only power half the time

extract the files from the attached zip to your arduino library folder.

PPMrcIn.zip (1.29 MB)

thanks sirbow2 i extracted them into my libraries folder but still i get this error

after extracting i started arduino program again so that it can load new libraries

sketch_mar15a.cpp:2:21: error: ppmrcin.h: No such file or directory
sketch_mar15a:3: error: 'Channel' does not name a type
sketch_mar15a.cpp: In function 'void setup()':
sketch_mar15a:11: error: 'channel1' was not declared in this scope
sketch_mar15a.cpp: In function 'void loop()':
sketch_mar15a:17: error: 'channel1' was not declared in this scope
Bad error line: -1

they probably need to be updated for 1.0, try arduino v23 or something to test it

unsigned long transmitterThrottlee=0;
unsigned long transmitterLeftRight=0;
unsigned long transmitterForwardBack=0;

void setup()
{
pinMode (8, INPUT);
pinMode (9, INPUT);
pinMode (10, INPUT);

Serial.begin(57600);
Serial.println("Done with setup");
}

void checkTransmitter()
{
transmitterThrottlee = (pulseIn (9, HIGH, 100000))/10; //read RC channel, wait max of 0.1 seconds for pulse
transmitterLeftRight = (pulseIn (8, HIGH, 100000))/10; //read RC channel, wait max of 0.1 seconds for pulse
transmitterForwardBack = (pulseIn (10, HIGH, 100000))/10; //read RC channel, wait max of 0.1 seconds for pulse
}

void loop()
{
checkTransmitter();//check the data being received by the transmitter.
Serial.print ("data: ");//if we decrease altitude we should check for landing, and slow our decent when we get close to the ground.
Serial.println (transmitterThrottle);
Serial.println (transmitterLeftRight);
Serial.println (transmitterForwardBack);
;
}

okay guys this code i found loaded it onto my board and it works really good, i get all the values of the 3 channels at a time..... so i want to ask how much time is wasted reading signals because it reads 3 channels and is there a way to reduce the max waiting time which is given as 0.1 seconds of pulse so that it becomes more effective?

void loop()
{
int time1 = millis();
checkTransmitter();//check the data being received by the transmitter.
Serial.print ("data: ");//if we decrease altitude we should check for landing, and slow our decent when we get close to the ground.
Serial.println (transmitterThrottle);
Serial.println (transmitterLeftRight);
Serial.println (transmitterForwardBack);
int time2 = millis();
Serial.println(time2-time1); // this returns time it takes to run the code once
}

you could also change the serial to 115200 to send data faster, and thus reduce time to loop

ill remove the serial communication only as i wouldnt be needing it later but only for calibration.....

so any other method to make it more effective?