Project showcase
DIY RC Car

DIY RC Car © GPL3+

Web-based car control with PHPoC Shield for Arduino.

  • 5,977 views
  • 0 comments
  • 18 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Phpoc shield for arduino per pztifwjlwk
PHPoC Shield for Arduino
×1
2A Motor Shield For Arduino
×1
RC Car kit
×1
9V Battery Holder
×1

About this project

Items

  • Arduino Uno
  • PHPoC Shield for Arduino
  • 2A Motor Shield for Arduino
  • 9V Battery Holder
  • DIY RC Car kit

Installation

How it works

  • Connect PHPoC Shield for Arduino on your Arduino.
  • Connect USB wireless LAN dongle to the shield for using WLAN.
  • Access to the shield's web page and control your RC car in "Web Remote Control / Slide" application.

Demo Video

Code

RC_Car.inoC/C++
#include "SPI.h"
#include "Phpoc.h"

PhpocServer server(80);

char slideName;
int slideValue;

int pwm_a = 5;
int pwm_b = 6;
int dir_a = 4;
int dir_b = 7;

void setup() {
  
  pinMode(pwm_a, OUTPUT);  //Set control pins to be outputs
  pinMode(pwm_b, OUTPUT);
  pinMode(dir_a, OUTPUT);
  pinMode(dir_b, OUTPUT);
  
  analogWrite(pwm_a, 0);  //set both motors to run at (100/255 = 39)% duty cycle (slow)
  analogWrite(pwm_b, 0);  
  
  Serial.begin(9600);
  while(!Serial)
    ;

  Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
  //Phpoc.begin();

  server.beginWebSocket("remote_slide");

  Serial.print("WebSocket server address : ");
  Serial.println(Phpoc.localIP());  
}

void loop() {
  // wait for a new client:
 PhpocClient client = server.available();

  if (client) {
    String slideStr = client.readLine();

    if(slideStr)
    {
      slideName = slideStr.charAt(0);
      slideValue = slideStr.substring(1).toInt();

      Serial.print(slideName);
      Serial.print('/');
      Serial.println(slideValue);
      
     if(slideName == 'A'){
        
          Serial.println(slideValue);
          
          if(slideValue < 0) {
            digitalWrite(dir_a, HIGH);            
            slideValue = slideValue * -1 * 255 / 100;
          } else {
            digitalWrite(dir_a, LOW);    
             slideValue = slideValue * 255 / 100;      
          }
              Serial.println(slideValue);          
              analogWrite(pwm_a, slideValue);          
      }    
      
     if(slideName == 'B'){
        
          Serial.println(slideValue);
          
          if(slideValue < 0) {
            digitalWrite(dir_b, HIGH);            
            slideValue = slideValue * -1 * 255 / 100;
          } else {
            digitalWrite(dir_b, LOW);    
             slideValue = slideValue * 255 / 100;      
          }          
             Serial.println(slideValue);          
             analogWrite(pwm_b, slideValue);            
      }    
    }
  } 

}

Comments

Similar projects you might like

Turn your RC Car to Bluetooth RC car

Project tutorial by Prajjwal Nag

  • 11,968 views
  • 1 comment
  • 11 respects

Hacking A RC Car To Control It Using An Android Device

Project tutorial by MJRoBot

  • 21,012 views
  • 0 comments
  • 39 respects

DIY RC Plane 4 Channel Transmitter – Receiver Using Arduino

Project showcase by Team RootSaid

  • 11,983 views
  • 0 comments
  • 22 respects

How to Make a Smart RC Car with Steering Wheel Remote

Project showcase by Aritra_B

  • 1,395 views
  • 0 comments
  • 4 respects

Android Arduino RC Car

Project tutorial by RAFI RASHEED T C

  • 15,340 views
  • 2 comments
  • 38 respects

RC Porsche Car (Arduino Project)

Project tutorial by MEGA DAS

  • 9,980 views
  • 5 comments
  • 26 respects
Add projectSign up / Login