Trenton L.James Page
Published © GPL3+

IOT Controlled RC Car via Particle Photon

In this project 2 Particle Photon's were used to control an RC Car in real time with the Internet of Things.

IntermediateFull instructions provided11 hours4,234

Things used in this project

Hardware components

Photon
Particle Photon
×2
RC Car 1/18 scale 4WD Off Road Short Truck
×1
Jumper wires (generic)
Jumper wires (generic)
×10
Android device
Android device
×1
OSEPP Motor Driver Module
×1
LED (generic)
LED (generic)
×16
Resistor 100 ohm
Resistor 100 ohm
×2
Breadboard (generic)
Breadboard (generic)
×1
Double sided Tape
×1
14 Gauge Wire
×1
18 Gauge Wire
×1
22 Gauge Single Strand Wire
×1
Heat Shrink (Various Sizes)
×1

Software apps and online services

Blynk
Blynk
Particle IDE

Hand tools and fabrication machines

Phillips Head Screwdriver PH1 1/4" 3mm
Wire Cutter/Stripper
Soldering iron (generic)
Soldering iron (generic)
Heat Gun
3/16" Drill Bit
Electric Drill

Story

Read more

Schematics

Circuit Diagram

This is a circuit diagram made in Fritzing. It is an free circuit drawing tool that had the Particle Photon and the L298N Motor Controller already in it's library of components. Note that I only show one led for each turn signal when in reality there are 8 for each side of the car. Also the onboard 9.6V Ni-Cd battery is represented by a 9V battery in this case.

Code

Subscribe Code

Arduino
This is the Subscribe Code, on the Second Photon to trigger the turn signals. For More Clarification on the Code in this project, see 29:25 of video linked in story for more info.
int led = D7;
int out = D0;
int out2 = D6;

void setup() {
    pinMode(led, OUTPUT);
    pinMode(out, OUTPUT);
    pinMode(out2, OUTPUT);
    digitalWrite(led,LOW);
    digitalWrite(out,LOW);
    digitalWrite(out2,LOW);
    
    
    Particle.subscribe("LEFT", responseLeft, "**************************");
    Particle.subscribe("RIGHT", responseRight, "************************");
    

}

void responseLeft(const char *event, const char *data){
    digitalWrite(led, HIGH);
    delay(100);
    digitalWrite(led,LOW);
    delay(100);
    digitalWrite(out,HIGH);
    delay(100);
    digitalWrite(out,LOW);
    delay(100);
}

void responseRight(const char *event, const char *data){
    digitalWrite(led, HIGH);
    delay(100);
    digitalWrite(led,LOW);
    delay(100);
    digitalWrite(out2,HIGH);
    delay(100);
    digitalWrite(out2,LOW);
    delay(100);
}

void loop() {
    

}

Publish

Arduino
This is the Publish Code, on the First Photon. For More Clarification on the Code in this project, see 29:25 of video linked in story for more info.
// This #include statement was automatically added by the Particle IDE.


int ledPinD5=D5;
int ledPinD4=D4;


unsigned long lastTime1 = 0;
unsigned long lastTime2 = 0;
const long interval =600;

#define BLYNK_PRINT Serial  
#include <blynk.h>


char auth[] = "*****************************";

void setup() 

{
	Serial.begin(9600);
	
	 delay(5000); // Allow board to settle

    Blynk.begin(auth);
	
}

void loop() {
    
    unsigned long now = millis();
    Blynk.run();
    
    
	
	if (((now - lastTime1) >= interval) && digitalRead(ledPinD5)==HIGH ){
	    
		lastTime1 = now;
		Particle.publish("LEFT","NASCAR",PUBLIC);
		
	}
	
	if (((now - lastTime2) >= interval) && digitalRead(ledPinD4)==HIGH ){
	    
		lastTime2 = now;
		Particle.publish("RIGHT","NOT-NASCAR",PUBLIC);
		
	}
	
	
	
}

Credits

Trenton L.

Trenton L.

1 project • 0 followers
MEGR 3171-001
James Page

James Page

1 project • 0 followers

Comments

Add projectSign up / Login