ajonsson883
Published

RC controller

Want to make a universal controller for all your RC needs well let me show you what ive done

AdvancedShowcase (no instructions)373
RC controller

Things used in this project

Hardware components

AMS117 3.3V
Step down from 5v to 3.3 for Transceiver
×1
NRF24l01+ Wireless Transceiver
×1
Joysick PS2 module
×2
Atmega328p
×1
Oled display White 1.3"
×1
Resistor 10k ohm
Resistor 10k ohm
×6
Momentary Tactile push button
The link ive given is like 100 switches and you only need 6 so if you can find a better place to buy that would be better
×6

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Main hub

The main hub were all the controlls sits everything exepts the batteries

Controller Left arm

Holds the a battery and 1 step up module

Just a mirrored Left arm

Holds a battery

Schematics

Schematic

Its messy, i know

Schematic for controller

Code

Code for controller

Arduino
#include <SPI.h>74
#include <nRF24L01.h>
#include <RF24.h>
#include <U8glib.h>

RF24 radio(7, 8); // CE, CSN

U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);
const uint8_t rook_bitmap[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x70, 0x01, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0xe0, 0x00, 0xff, 0xf8, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x01, 0xe0, 0x00, 0xe0, 0x1c, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x03, 0xc0, 0x01, 0xc0, 0x1e, 0x1f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x0f, 0x00, 0x01, 0x80, 0x0e, 0x7f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x07, 0xfe, 0x00, 0x03, 0x00, 0x1f, 0xff, 0xfc, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x18, 0x00, 
  0x00, 0x3f, 0xff, 0x00, 0x02, 0x00, 0x7f, 0xff, 0xe2, 0x40, 0x03, 0x80, 0x00, 0x00, 0x3c, 0x00, 
  0x00, 0xf8, 0x0f, 0xe0, 0x06, 0x01, 0xff, 0xff, 0xe3, 0x40, 0x0f, 0x80, 0x00, 0x00, 0x3f, 0x00, 
  0x07, 0xc0, 0x07, 0xfc, 0x0c, 0x7f, 0xff, 0xff, 0xb7, 0x40, 0x1f, 0x80, 0x00, 0x00, 0x3f, 0x80, 
  0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xe7, 0xff, 0x1c, 0x80, 0x3f, 0xff, 0xe0, 0x7f, 0xff, 0xc0, 
  0x3e, 0x00, 0x00, 0xff, 0xff, 0x80, 0x01, 0xfd, 0x1c, 0x80, 0x7f, 0xff, 0xf0, 0xff, 0xf9, 0xe0, 
  0xfc, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0x79, 0xbc, 0x81, 0xf1, 0xff, 0xf0, 0xff, 0xf8, 0xf8, 
  0x9c, 0x00, 0x01, 0xff, 0xf8, 0x00, 0x00, 0xf9, 0xe7, 0x03, 0xe0, 0x00, 0x70, 0xe0, 0x00, 0x7c, 
  0x8c, 0x00, 0x07, 0xff, 0xb8, 0x00, 0x01, 0xf8, 0x63, 0x07, 0xc0, 0x00, 0x70, 0xe0, 0x00, 0x3e, 
  0xce, 0x00, 0x0f, 0xe1, 0xdc, 0x00, 0x07, 0xf0, 0x3c, 0x0f, 0x80, 0x00, 0x70, 0xe0, 0x00, 0x1f, 
  0x7f, 0x80, 0x1f, 0x43, 0xec, 0x00, 0x7e, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x70, 0xe0, 0x00, 0x0f, 
  0xff, 0x80, 0x3c, 0xe6, 0x2c, 0x03, 0xe0, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x70, 0xe0, 0x00, 0x3e, 
  0xff, 0xe0, 0x7b, 0x3c, 0x36, 0x3f, 0x80, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x70, 0xe0, 0x00, 0x7c, 
  0x7f, 0xff, 0xfb, 0x04, 0x37, 0xfe, 0x00, 0x00, 0x00, 0x01, 0xf1, 0xff, 0xf0, 0xff, 0xf8, 0xf8, 
  0x3f, 0xf7, 0xfb, 0x06, 0x37, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x7b, 0xff, 0xf0, 0xff, 0xf9, 0xe0, 
  0x3f, 0xf1, 0xf9, 0x9b, 0xe3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xe0, 0x7f, 0xff, 0xc0, 
  0x1f, 0xf8, 0xf0, 0xb1, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x80, 0x00, 0x00, 0x3f, 0x80, 
  0x0f, 0xff, 0xe0, 0xf1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x3f, 0x00, 
  0x01, 0xff, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x3c, 0x00, 
  0x00, 0x3f, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x18, 0x00
};

// 'Plane android', 128x64px
const unsigned char myBitmap1 [] PROGMEM = {
0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x01, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x01, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x03, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x01, 0xff, 0xff, 0x80, 0x00, 0x00, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x7f, 0xff, 0xe0, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x3f, 0xff, 0xf0, 0x00, 0x00, 0x1f, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x3f, 0xff, 0xf0, 0x00, 0x00, 0x1f, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x1f, 0xff, 0xfc, 0x00, 0x00, 0x1f, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x0f, 0xff, 0xff, 0x80, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x03, 0xff, 0xff, 0xc0, 0x00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x01, 0xff, 0xff, 0xf0, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x3f, 0xff, 0xf8, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x07, 0xff, 0xff, 0x80, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x03, 0xff, 0xff, 0xf0, 0x03, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x07, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x30, 0x1f, 0xc0, 0x3f, 0xff, 0xff, 0xff, 0xec, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x38, 0x3f, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x3c, 0x7f, 0xf0, 0x0e, 0xff, 0xff, 0xff, 0xc4, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x18, 0x00, 
  0x1e, 0x4f, 0xfc, 0x06, 0x7f, 0xff, 0xff, 0x8e, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x3c, 0x00, 
  0x0f, 0x47, 0xfe, 0x06, 0x3f, 0xff, 0xf8, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x3f, 0x00, 
  0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x1f, 0x80, 0x00, 0x00, 0x3f, 0x80, 
  0x03, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x3f, 0xff, 0xe0, 0x7f, 0xff, 0xc0, 
  0x01, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x7f, 0xff, 0xf0, 0xff, 0xf9, 0xe0, 
  0x03, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xf0, 0x00, 0x01, 0xf1, 0xff, 0xf0, 0xff, 0xf8, 0xf8, 
  0x07, 0xff, 0xff, 0xff, 0xc0, 0x0f, 0xff, 0xfc, 0x00, 0x03, 0xe0, 0x00, 0x70, 0xe0, 0x00, 0x7c, 
  0x00, 0x3c, 0xff, 0xf8, 0x00, 0x03, 0xff, 0xff, 0x00, 0x07, 0xc0, 0x00, 0x70, 0xe0, 0x00, 0x3e, 
  0x00, 0x1c, 0x38, 0x38, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x0f, 0x80, 0x00, 0x70, 0xe0, 0x00, 0x1f, 
  0x00, 0x0e, 0xe0, 0x1c, 0x00, 0x00, 0x7f, 0xff, 0xf0, 0x0f, 0x80, 0x00, 0x70, 0xe0, 0x00, 0x0f, 
  0x00, 0x07, 0xf0, 0x0e, 0x00, 0x00, 0x1f, 0xff, 0xf0, 0x07, 0xc0, 0x00, 0x70, 0xe0, 0x00, 0x3e, 
  0x00, 0x03, 0xf0, 0x07, 0x00, 0x00, 0x0f, 0xff, 0xf8, 0x03, 0xe0, 0x00, 0x70, 0xe0, 0x00, 0x7c, 
  0x00, 0x01, 0xf0, 0x03, 0x80, 0x00, 0x0f, 0xff, 0xf8, 0x01, 0xf1, 0xff, 0xf0, 0xff, 0xf8, 0xf8, 
  0x00, 0x00, 0xe0, 0x01, 0xc0, 0x00, 0x07, 0xff, 0xf8, 0x00, 0x7b, 0xff, 0xf0, 0xff, 0xf9, 0xe0, 
  0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0xff, 0xf0, 0x00, 0x3f, 0xff, 0xe0, 0x7f, 0xff, 0xc0, 
  0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x1f, 0x80, 0x00, 0x00, 0x3f, 0x80, 
  0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x3f, 0x00, 
  0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x3c, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x18, 0x00
};

int potRX = A0;
int potRY = A1;
int potLX = A2;
int potLY = A3;
int pinLS = 2;
int pinRS = 3;
int pinDLS = 4;
int pinDRS = 5;
boolean DLS = LOW;
boolean DRS = LOW;

int pinBRS = 9;
int pinBLS = 10;

int counter = 0;
int car;


 const  byte address[6]= "00001";
   
struct Data_pack {
  byte LX;
  byte LY;
  byte RX;
  byte RY;
  byte LS;
  byte RS;
  byte BR;
  byte BL;
};
Data_pack data;

void draw(int);
  
void setup() {
   pinMode(pinDLS, INPUT);
   pinMode(pinDRS, INPUT);
   pinMode(pinLS, INPUT);
   pinMode(pinRS, INPUT);
   pinMode(pinBLS, INPUT);
   pinMode(pinBRS, INPUT);
   draw(counter);
   
Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(address); // 00001
  radio.setPALevel(RF24_PA_MAX);
   radio.stopListening();
}

void loop() {
  DRS = digitalRead(pinDRS);
  DLS = digitalRead(pinDLS);
  if(DRS == LOW){
    if (counter == 2){
      counter = 0;
    } 
    else {
    counter++;
    }
 //  delay(200); 
    draw(counter);
  }
  else if(DLS == LOW){
    if (counter == 0){
      counter = 2;
    }
    else{
    counter--;
    }
        draw(counter);
  }

  data.LX = map(analogRead(potLX), 1023, 0, 0, 255);
  data.LY = map(analogRead(potLY), 1023, 0, 0, 255);
  data.RX = map(analogRead(potRX), 1023, 0, 0, 255);
  data.RY = map(analogRead(potRY), 1023, 0, 0, 255);
  data.LS = digitalRead(pinLS);
  data.RS = digitalRead(pinRS);
  data.BL = digitalRead(pinBLS);
  data.BR = digitalRead(pinBRS);
 /* if(data.BL == LOW){
    data.LY = data.LY + 2;
  } */

  Serial.print("LY : ");
  Serial.print(data.LY);
  Serial.print(" ");
  Serial.print("RY : ");
  Serial.println(data.RY);
  radio.write(&data, sizeof(Data_pack));

  //  display.setTextSize(2)
  //  display.setCursor(2,3)
   //display.print(data.LX)
//  


}

  void draw(int Display) {
        u8g.firstPage();  
      do {
    switch (Display){
      case 0:
         u8g.drawBitmapP( 0, 36, 16 , 64, rook_bitmap);
      break;
      case 1: 
         u8g.drawBitmapP( 0, 24, 16 , 64, myBitmap1);   

Credits

ajonsson883

ajonsson883

0 projects • 0 followers

Comments