Zeeshan
Published

LeCar

This project is done to control a DIY car kit through BLE based hand glove.

AdvancedFull instructions provided10 hours941
LeCar

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
DIY Car Kit
×1
Gloves
×1

Software apps and online services

Notepad++
Raspberry Pi Raspbian Stretch Lite

Story

Read more

Schematics

Car Wiring

THis woring is only for reference. Follow the code for actual

Code

Gloves Code

C/C++
No preview (download only).

Car Code

Python
import bluepy.btle as btle
import RPi.GPIO as GPIO

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)

GPIO.setup(16,GPIO.OUT)
GPIO.setup(18,GPIO.OUT)
GPIO.setup(38,GPIO.OUT)
GPIO.setup(40,GPIO.OUT)
 
class ReadDelegate(btle.DefaultDelegate):
    def handleNotification(self, cHandle, data):
		if(data=="r"):
			GPIO.output(16,GPIO.HIGH)
			GPIO.output(18,GPIO.LOW)
			GPIO.output(38,GPIO.LOW)
			GPIO.output(40,GPIO.HIGH)
		elif(data=="l"):
			GPIO.output(16,GPIO.LOW)
			GPIO.output(18,GPIO.HIGH)
			GPIO.output(38,GPIO.HIGH)
			GPIO.output(40,GPIO.LOW)
		elif(data=="f"):
			GPIO.output(16,GPIO.HIGH)
			GPIO.output(18,GPIO.LOW)
			GPIO.output(38,GPIO.HIGH)
			GPIO.output(40,GPIO.LOW)
		elif(data=="b"):
			GPIO.output(16,GPIO.LOW)
			GPIO.output(18,GPIO.HIGH)
			GPIO.output(38,GPIO.LOW)
			GPIO.output(40,GPIO.HIGH)
		elif(data=="s"):
			GPIO.output(16,GPIO.LOW)
			GPIO.output(18,GPIO.LOW)
			GPIO.output(38,GPIO.LOW)
			GPIO.output(40,GPIO.LOW)
 
p = btle.Peripheral("9C:1D:58:1F:B8:18")
p.withDelegate(ReadDelegate())
 
while True:
	while p.waitForNotifications(0):
		pass

Credits

Zeeshan

Zeeshan

13 projects • 50 followers
Creative and destructive design master. Ability to use the brain waves for both construction and destruction

Comments