Sharecar

by woutbl in Circuits > Raspberry Pi

210 Views, 0 Favorites, 0 Comments

Sharecar

20220619_232324.jpg

I have build this project because I had to share my car with my brother and we were always fighting who needs to pay for the fuel or for the speeding tickets. I wanted to build something so we would stop fighting.

I am going to school in Howest Kortrijk Belgium for the course of MCT. In this course we have a course called project 1. In this course we have to make a project of our choosing, so I thought this was the perfect opportunity to starting building the project I had already in mind.

I am building this project with a raspberry pi on where the database, backend and frontend will be running.

My project tracks the speed , RPM and the MAF (maximum airflow) of your car. It also has a RFID sensor so you can see who is driving at that moment. It has a accelerometer so you can see if the car is driving at this very moment and it has a temperature sensor to see if it doesn't get to hot inside of the project.

Tools + Supplies

breadboard_foto.jpg
kabels_foto.jpg
rfid_foto.jpg
MPU_foto.jpg
lcd_foto.jpg
Potentiometer_foto.jpg
temp_foto.jpg
button_foto.jpg
obd_elm327_foto.jpg
ledstrip_foto.jpg
3mm bout.jpg
3mm moer.jpg
3mm vijs.jpg
kleine scharnieren.jpg

Tools:

Software:

  • Visual Studio Code
  • SQL Workbench
  • Postman

Hardware:

  • Soldering iron
  • Tin
  • Lasercutter (you can use a public one at your library or school)
  • Screwdriver

Supplies:

electronics:

  • 1 x Breadboard (you can use 2 if you want to)
  • +/- 50 cables
  • 1 x RFID (RC522)
  • 1 x Accelerometer (MPU 6050)
  • 1 x LCD (1602F)
  • 1 x Potentiometer
  • 1 x Temperaturesensor (18B20)
  • 2 x Buttons
  • 1 x OBDll reader (elm327)
  • 1 x ledstrip (ws2812b)

Case:

  • 14 x bolts (3mm)
  • 14 x nuts (3mm)
  • 8 x screws (3mm)
  • 2 x hinges (small)
  • 1 x MDF wood plate (600 x 450(lasercutter preferences))

(See the images for extra info)

Putting Electronics Together

Project1_BreadBoard_WoutBlomme_1MCT3.png
Project1_ElektronicaSchema_WoutBlomme_1MCT3.png

To begin we will put the electroincs together.

We need to put 7 parts on the raspberry pi.

Lets start by putting the 3V from the pi to one side of the breadboard and 5V from the pi to the otherside. After that put the Ground of the pi on the ground of the breadboard on both sides.

RFID sensor:

  • vcc ==> 3V
  • rs ==> GPIO27
  • GND ==> GND
  • MOSI ==> SPIMOSI pin
  • MISO ==> SPIMISO pin
  • sck ==> SPIsck pin
  • NSS ==> SPICE0 pin

Accelerometer:

  • vcc ==> 3V
  • GND ==> GND
  • SCL ==> SCL pin
  • SDA ==> SDA pin

Temperaturesensor:

  • GND ==> GND
  • VDD ==> 3V
  • DQ ==> GPIO 4 + extra resistor (4.5kohm) to 3V

Button 1:

To GPIO 21 with a resistor (470 ohm)

Button 2:

To GPIO 5 with a resistor (470 ohm)

LCD:

  • LED- ==> GND
  • LED+ ==> 5V
  • DB7 ==> GPIO 13
  • DB6 ==> GPIO 19
  • DB5 ==> GPIO 26
  • DB4 ==> GPIO 23
  • DB3 ==> GPIO 24
  • DB2 ==> GPIO 25
  • DB1 ==> GPIO 12
  • DB0 ==> GPIO 16
  • E ==> GPIO 17
  • RW ==> GND
  • RS ==> GPIO 27
  • VD ==> potentiometer middle pin
  • VDD ==> 5V
  • VSS ==> GND

Potentiometer:

  • Left pin GND
  • Right pin 5V

Ledstrip:

  • DIN ==> GPIO 18
  • GND 1 ==> GND breadboard
  • VCC and GND 2 need to be connected to a different powersupply, you can get this with a usb cable. You need to cut it and look for the ground and the 5V cables and solder them together with the VCC and GND2.

Code

You will need to install 7 librarys:

  • smbus library
  • rpi_ws281x library
  • obd library
  • mfrc522 library
  • threading library
  • os librarys
  • flask library

but these are all defined in the code wich you can find with this link:

Github ShareCar project

https://github.com/howest-mct/2021-2022-projectone-WoutBl/tree/master

Making the Case

20220619_232001.jpg
20220619_232019.jpg
20220619_232320.jpg
20220619_232337.jpg
20220619_232419.jpg
20220619_232435.jpg
20220619_232442.jpg

First off all we need to lasercut the wood. so take the pdf take it to your lasercutter and normally the colors would be okay. The lines need to be full red (RGB(255.0.0)) for cuttin and full blue (RGB(0.0.255)) for engraving in the case.

After the case has been cut you take all the pieces and glue them together except for the top piece.

Once this is done you will need to drill a hole in the back of the case with a diameter of 16 mm so the cables can get through.

You will also need to make 2 holes in the side for your buttons. Make sure you sand the hole so it becomes a square zo your buttons fit.

Placing the Electronics

20220619_232053.jpg
20220619_232044.jpg

For this step you need to be carefull so you dont break any electronics or rip out any cables.

first carefully place breadboard in the case, if you have the same breadboard (17cm) as me it should perfectly fit.

Make 4 holes for the rfid and put 4 bolts through it so it stays there. Then put the LCD in it place, you may need to sand around it a bit so it fits. Put 4 bolts through it so it stays there.

Then you will need to put your buttons through their holes and if you have a glue gun put som glue on it so they wont move.

After all that we will put the lid on. We will do this by putting hinges on the back of the so we can easily open and close it. Do this by putting screws in the hinges.

Now we can place the raspberry pi and the accelerometer on the top of the lid. Put 4 bolts on the raspberry pi and 2 bolts for the accelerometer.

Normally after all this your case should close. If this is not the case you can put a small piece of wood on the front of your lid with 2 holes in it and 2 holes in the front of your case so you can put 2 extra bolts through those holes so the lid will stick.

Now you only need to place your case in your car and connect all the cables.

Dont forget to put the data pin and GND1 off your ledstrip in your case and on you breadboard.

Enjoy!!

Now you can drive and keep track off your speed and rpm.

Thank you for reading and possibly making my project!

If you have any question, make sure to comment!