Ahmad shaaban
LEBANON • + Follow
Edit Project
Tools, APP Software Used etc.
|
Soldering Iron Wire Welding Lead Roll |
|
|
Soldering iron |
|
|
arduino IDEArduino
|
Description
6channels mini arduino ppm/pwm receiver based on arduino and smd nrf24 module
6channels mini arduino ppm/pwm receiver based on arduino and smd nrf24 module
channel 2 is the ppm channel
components:
16mhz crystal with internal 2x22pf capacitors
10k: R7,R8,R1-1206
1206 led
0.1uF: C8-C0805
15k: R3-1206
Atmega328p-au
nrf24 radio transmitter/receiver "smd module"
some male pins
note: by ordering any of my free project from pcbway you are supporting me to complete and publish my new project witch is an open source 10d0f flight controller board that supports mission planing, return to home, gps fix, baro fix , acro and auto level and much much more
Code
pwm code
Arduino
/* Receiver code for the Arduino Radio control with PWM output
* Install the NRF24 library to your IDE
* Upload this code to the Arduino UNO, NANO, Pro mini (5V,16MHz)
* Connect a NRF24 module to it:
Module // Arduino UNO,NANO
GND -> GND
Vcc -> 3.3V
CE -> D9
CSN -> D10
CLK -> D13
MOSI -> D11
MISO -> D12
This code receive 7 channels and create a PWM output for each one on D2, D3, D4, D5, D6, D7and D8
Please, like share and subscribe : https://www.youtube.com/c/ELECTRONOOBS
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h> //To create PWM signals we need this lybrary
const uint64_t pipeIn = 0xE8E8F0F0E1LL; //Remember that this code is the same as in the transmitter
RF24 radio(9, 10); //CSN and CE pins
// The sizeof this struct should not exceed 32 bytes
struct Received_data {
byte ch1;
byte ch2;
byte ch3;
byte ch4;
byte ch5;
byte ch6;
byte ch7;
};
Received_data received_data;
Servo channel_1;
Servo channel_2;
Servo channel_3;
Servo channel_4;
Servo channel_5;
Servo channel_6;
Servo channel_7;
int ch1_value = 0;
int ch2_value = 0;
int ch3_value = 0;
int ch4_value = 0;
int ch5_value = 0;
int ch6_value = 0;
int ch7_value = 0;
void reset_the_Data()
{
// 'safe' values to use when NO radio input is detected
received_data.ch1 = 0; //Throttle (channel 1) to 0
received_data.ch2 = 127;
received_data.ch3 = 127;
received_data.ch4 = 127;
received_data.ch5 = 0;
received_data.ch6 = 0;
received_data.ch7 = 0;
}
/**************************************************/
void setup()
{
//Attach the servo signal on pins from D2 to D8
channel_1.attach(2);
channel_2.attach(3);
channel_3.attach(4);
channel_4.attach(5);
channel_5.attach(6);
channel_6.attach(7);
channel_7.attach(8);
//We reset the received values
reset_the_Data();
//Once again, begin and radio configuration
radio.begin();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1,pipeIn);
//We start the radio comunication
radio.startListening();
}
/**************************************************/
unsigned long lastRecvTime = 0;
//We create the function that will read the data each certain time
void receive_the_data()
{
while ( radio.available() ) {
radio.read(&received_data, sizeof(Received_data));
lastRecvTime = millis(); //Here we receive the data
}
}
/**************************************************/
void loop()
{
//Receive the radio data
receive_the_data();
//////////This small if will reset the data if signal is lost for 1 sec.
/////////////////////////////////////////////////////////////////////////
unsigned long now = millis();
if ( now - lastRecvTime > 1000 ) {
// signal lost?
reset_the_Data();
//Go up and change the initial values if you want depending on
//your aplications. Put 0 for throttle in case of drones so it won't
//fly away
}
ch1_value = map(received_data.ch1,0,255,1000,2000);
ch2_value = map(received_data.ch2,0,255,1000,2000);
ch3_value = map(received_data.ch3,0,255,1000,2000);
ch4_value = map(received_data.ch4,0,255,1000,2000);
ch5_value = map(received_data.ch5,0,1,1000,2000);
ch6_value = map(received_data.ch6,0,1,1000,2000);
ch7_value = map(received_data.ch7,0,255,1000,2000);
//Creathe the PWM signals
channel_1.writeMicroseconds(ch1_value);
channel_2.writeMicroseconds(ch2_value);
channel_3.writeMicroseconds(ch3_value);
channel_4.writeMicroseconds(ch4_value);
channel_5.writeMicroseconds(ch5_value);
channel_6.writeMicroseconds(ch6_value);
channel_7.writeMicroseconds(ch7_value);
}//Loop end
ppm code
Arduino
/* Receiver code for the Arduino Radio control with PWM output
* Install the NRF24 library to your IDE
* Upload this code to the Arduino UNO, NANO, Pro mini (5V,16MHz)
* Connect a NRF24 module to it:
Module // Arduino UNO,NANO
GND -> GND
Vcc -> 3.3V
CE -> D9
CSN -> D10
CLK -> D13
MOSI -> D11
MISO -> D12
This code receive 7 channels and create a PPM output on digital D2 with all the values
Please, like share and subscribe : https://www.youtube.com/c/ELECTRONOOBS
*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
////////////////////// PPM CONFIGURATION//////////////////////////
#define channel_number 7 //set the number of channels, in this case: 4 channels
#define sigPin 2 //set PPM signal output pin on the arduino
#define PPM_FrLen 27000 //set the PPM frame length in microseconds (1ms = 1000µs)
#define PPM_PulseLen 400 //set the pulse length
//////////////////////////////////////////////////////////////////
int ppm[channel_number];
const uint64_t My_radio_pipeIn = 0xE8E8F0F0E1LL; //Remember that this code is the same as in the transmitter
RF24 radio(9, 10); //CSN and CE pins
// The sizeof this struct should not exceed 32 bytes
struct Received_data {
byte ch1;
byte ch2;
byte ch3;
byte ch4;
byte ch5;
byte ch6;
byte ch7;
};
Received_data received_data;
void reset_received_Data()
{
// 'safe' values to use when NO radio input is detected
received_data.ch1 = 0; //Throttle (channel 1) to 0
received_data.ch2 = 127;
received_data.ch3 = 127;
received_data.ch4 = 127;
received_data.ch5 = 0;
received_data.ch6 = 0;
received_data.ch7 = 0;
PPM_width_Values();
}
void PPM_width_Values()
{
//Here we map the received values from 1000 to 2000
//and create the ppm signals for each channel
ppm[0] = map(received_data.ch1, 0, 255, 1000, 2000);
ppm[1] = map(received_data.ch2, 0, 255, 1000, 2000);
ppm[2] = map(received_data.ch3, 0, 255, 1000, 2000);
ppm[3] = map(received_data.ch4, 0, 255, 1000, 2000);
ppm[4] = map(received_data.ch5, 0, 1, 1000, 2000);
ppm[5] = map(received_data.ch6, 0, 1, 1000, 2000);
ppm[6] = map(received_data.ch7, 0, 255, 1000, 2000);
}
/**************************************************/
/**************************************************/
void setup()
{
pinMode(sigPin, OUTPUT);
digitalWrite(sigPin, 0); //set the PPM (D2 in this case) signal pin to the default state (off)
//Configure the interruption registers that will create the PPM signal
cli();
TCCR1A = 0; // set entire TCCR1 register to 0
TCCR1B = 0;
OCR1A = 100; // compare match register (not very important, sets the timeout for the first interrupt)
TCCR1B |= (1 << WGM12); // turn on CTC mode
TCCR1B |= (1 << CS11); // 8 prescaler: 0,5 microseconds at 16mhz
TIMSK1 |= (1 << OCIE1A); // enable timer compare interrupt
sei();
//Call the reset data function
reset_received_Data();
//Once again, begin and radio configuration
radio.begin();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1,My_radio_pipeIn);
//We start the radio comunication
radio.startListening();
}
/**************************************************/
unsigned long lastRecvTime = 0;
//We create the function that will read the data each certain time
void receive_the_data()
{
while ( radio.available() ) {
radio.read(&received_data, sizeof(Received_data));
lastRecvTime = millis(); //Here we receive the data
}
}
/**************************************************/
void loop()
{
//Receive the radio data
receive_the_data();
//Create the PPM widths
PPM_width_Values();
//////////This small if will reset the data if signal is lost for 1 sec.
/////////////////////////////////////////////////////////////////////////
unsigned long now = millis();
if ( now - lastRecvTime > 1000 ) {
// signal lost?
reset_received_Data();
//Go up and change the initial values if you want depending on
//your aplications. Put 0 for throttle in case of drones so it won't
//fly away
}
}//Loop end
#error Delete this line befor you cahnge the value (clockMultiplier) below
#define clockMultiplier 2 // set this to 2 if you are using a 16MHz arduino, leave as 1 for an 8MHz arduino
//Interruption vector. here we create the PPM signal
ISR(TIMER1_COMPA_vect){
static boolean state = true;
TCNT1 = 0;
if ( state ) {
//end pulse
PORTD = PORTD & ~B00000100; // turn pin 2 off. Could also use: digitalWrite(sigPin,0)
OCR1A = PPM_PulseLen * clockMultiplier;
state = false;
}
else {
//start pulse
static byte cur_chan_numb;
static unsigned int calc_rest;
PORTD = PORTD | B00000100; // turn pin 2 on. Could also use: digitalWrite(sigPin,1)
state = true;
if(cur_chan_numb >= channel_number) {
cur_chan_numb = 0;
calc_rest += PPM_PulseLen;
OCR1A = (PPM_FrLen - calc_rest) * clockMultiplier;
calc_rest = 0;
}
else {
OCR1A = (ppm[cur_chan_numb] - PPM_PulseLen) * clockMultiplier;
calc_rest += ppm[cur_chan_numb];
cur_chan_numb++;
}
}
}
Sep 06,2022
1,540 views
6channels mini arduino ppm/pwm receiver based on arduino and smd nrf24 module
6channels mini arduino ppm/pwm receiver based on arduino and smd nrf24 module
1540
1
0
10.00 (1)
Published: Sep 06,2022
BOM(Bill of materials)
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
File Last Updated: 2023/10/20 (GMT+8)
File update record
2023-10-2017:04:37
Parts List (BOM) is updated.
2023-10-2017:04:37
Gerber file is updated.
2023-10-1310:44:05
Parts List (BOM) is updated.
2023-10-1310:44:05
Gerber file is updated.
Only PCB
PCB+Assembly
*PCBWay community is a shared platform and we are not responsible for any design issues.
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-ShareAlike (CC BY-SA)
License.
- Comments(0)
- Likes(1)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
Remove
It looks like you have not written anything. Please add a comment and try again.
View More
- Olegcm Jun 27,2023
View More
VOTING
1 votes
- 1 USER VOTES
10.00
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
-
10design
-
10usability
-
10creativity
-
10content
10.00
More by Ahmad shaaban
- wii-fly@BR-F4 flight controller wii-fly@BR-F4 is an stm32f411 based flight controller made to be like whoop flight controllers it su...
- Ardupilot OBAL FCB The Schematic & Board describes a new Linux-based board for Ardupilot called Open-Board Architec...
- 6channels mini arduino ppm/pwm receiver based on arduino and smd nrf24 module 6channels mini arduino ppm/pwm receiver based on arduino and smd nrf24 modulechannel 2 is the ppm ch...
- fpv audio-video 5.8GHZ rx receiver based on rx5808 8 channels fpv audio-video 5.8GHZ rx receiver based on rx5808 8 channels note: by ordering any of my free proje...
- fpv audio-video 5.8GHZ vtx "transmitter" based on tx5823 with voltage regulator built in 8 channels 5.8GHZ Audio-Video transmitter circuit based on TX5823 very simple and easy to solder. c...
- inav-board new a uart to i2c converter for all flight controllers that donet support uart gpsnote: by ordering any ...
You may also like
-
Open Source Very Large Stick - Freejoy & MMjoy2 breakout board
487 0 0 -
RF Control training board for students based on ESP32 C3
645 0 2 -
Aquarius+ Computer, Standard PCB
856 0 4 -
KINETIC COASTERS with a TWIST! Laser or 3D Print some DIY Magic
593 0 1 -
RPI - 8 IO PLC With ATTiny85 Watch Dog
515 0 1 -
Nintendo Famicom HVC-001 Controller Shells
615 0 1 -
COMMODORE 128 DIAGNOSTIC REV.785260 KEYBOARD DONGLE
572 0 4 -
COMMODORE 128 15KHz DISPLAY ADAPTER (C128 80 COLUMN ADAPTER)
776 1 5 -