- Capacitive proximity sensor
Inductive proximity sensor
- High temperature proximity sensor
- Low temperature proximity sensor
- ring proximity sensor
- Standard inductive proximity sensor
- Ultra Small inductive proximity sensor
- Long Distance Proximity Sensor
- Corrosion resistant proximity sensor
- metal face proximity sensor
- high pressure proximity sensor
- Analog proximity sensor
- namur proximity sensor
- Photoelectric sensor
- Safety light curtain
- Optical fiber sensor
- Speed Sensor
- Textile special sensor
- Limit switch
- Measuring sensor
- Wireless sensor
- Conveyor belt protection devices
- Sensor accessories
bike overtaking distance sensor
It seems to have a lot of room for them, but if I had to turn and miss a pot hole or iron mill on the road, I would be in trouble. 99.
9% of the vehicles are actually very careful, but for those 0.
I decided to make a overtaking sensor for my bike and 1% of people don\'t drive well.
The overtaking sensor uses the laser flight time distance sensor to see how far other vehicles are and uses the camera to record how the vehicle passes.
I need to record (
More importantly, retrieval)
The data is easy, so I decided to use Raspberry Pi Zero Wireless to manage the records and provide the results wirelessly.
Finally, I printed a case in 3D to fit it all.
The overtaking sensor uses an infrared laser for optical distance measurement.
The Vl53 l1x chip sends an eye-safe laser beam and measures the time required for reflection, enabling it to measure a distance of 40mm to 4 metres.
This lidar is fast to detect and can be measured 50 times per second
Ideal for recording fast moving vehicles.
The sensor data is captured by the Raspberry Pi, which also uses the camera to record the flow through.
The code overrides the distance measurement on the video so that the measurement and activity are always linked together.
Raspberry Pi uses the web interface to allow you to download files for later viewing.
All records and views are done with a simple python code.
Raspberry Pi, distance sensor and switch may not
So take your soldering iron out and start building.
First, the solder head pin on the Raspberry pi.
Next, buy some breadboard wires with the parent end, cut off anything at the other end, and weld the wires to vl53 l1x.
I did this for ease of testing and prototyping, but you can easily weld the wires directly to the Raspberry pi if you want
Since some Raspberry pi pins are dual use, do not do so now.
Then weld the LED.
Connect the resistor to the cathode-
The shorter side of the leg and the flat side.
Then Weld to the other end of the anode and resistance on the female breadboard connector.
To avoid exposed wires coming into contact with other components, I have added some thermostats to bypass the legs of the LED.
Finally, two switches are welded.
One of the switches will start and stop recording and power off the device.
The other is to turn the device on.
Select your switch color accordingly.
For the start and stop of the switch, just weld the two parent breadboard wires on the switch.
Turning on the switch, we need something more complicated.
Weld the female breadboard wire to one side.
On the other side, weld the male and female connectors.
Again, I used heat shrink around the connection.
We want Raspberry Pi to be headless (
No screen required)
So what we have to do is a bunch of things:1)
Use the installation guide on download page 3 to install the latest raspbian lite from the SD card)
Create an empty file named ssh in the root directory of the SD card 4)
Add a file named wpa_supply.
Conf to the root directory of the SD card.
Edit this file to add WiFi settings, E. G. g. 5)
Put the card into the Raspberry Pi and plug the power connector into it. 6)
After booting, look for the device named \"raspberrypi\" on the router.
Use a tool like putty, ssh it, and use the username pi and password raspberry. 7)
Update pi and install some software we need
Update the pi configuration to open the camera and I2C interface, then go to the interface option and enable the camera (option 1)
, And I2C interface (option 5)9)
Download the attachment, overtaking_sensor.
Zip, and use a tool like FileZilla to sftp it onto your Raspberry pi.
Decompress it so that the content is in the/home/pi/overtaking_sensor directory.
I will introduce the role of the code in the next step, but skip this step if you don\'t care. 10)
Create a file to control the service that calls/etc/init. d/overtaking. sh11)
Good news for making this file a service to start the code at startup-
You have basically done the hard work now and it is time to connect all the work.
First, connect the flight time sensor to the pi.
The connection is as follows; Pi Pin 2 (5V, top left)to VL53L1X 3-
6V pinPi pins 3 to vl53 l1x SDA pinPi pins 5 to vl53 l1x cl pinPi pins 6 to vl53 l1x GND pinNote, vl53
The one without resistance)
Pi pin 9 For LED pins with resistors. Pi Pin 37 (
From the second to the right of the bottom line)
To one side of the start/stop button pi Pin 39 (
Right hand side, bottom row)
To the other side of the start/stop button, now the complex bit-
Insert the single-line side of the boot button into Pi pin 14.
Unplug the vl53 l1x SDA pin from Pi pin 3 and insert the parent connector that guides the other side into the pin.
Insert the vl53 l1x SDA pin into the plug connector on the same side of the boot button.
What you are doing is still connecting the vl53 l1x SDA pin to pin 3 and allowing it to be shortened to ground by pressing the button.
Connect the camera to the Pi using the camera\'s ribbon connector and power the Pi on.
You should see your LED on in a minute.
If you don\'t, it\'s wrong.
Check the connector.
Next, the overtaking camera hosts a Web page where you can view the status of the recording and download the video.
To access the web page, go to the start video recording where you can click start on the web page, or press the start/stop hardware button.
The LED should start flashing.
When you record, try to get your hands closer and closer to the distance sensor, and you should see a change in distance on the web page.
Click the stop button on the web page to stop, or press the start/stop hardware button to stop.
The LED will stop flashing and you will see the video just recorded if you refresh the web page (
This can take a few seconds as it needs to convert the h264 format to mp4 format.
Press and hold the start/stop button for 5 seconds to turn off the Raspberry Pi.
Press the start button to start it again.
Note that if you press the start button when the device is on, you will mess up the I2C messaging and may need to restart the Raspberry Pi.
This is the most frustrating part of the build process.
Ideally I would like a button to do everything, but the Raspberry pi only allows you to start by shorting pin 3 to ground, while the I2C message only works on pin 3,
I can add a relay to change the function of the button depending on whether the device is on or off, but it seems a bit overkill.
I \'d love to know if anyone has a software solution.
You now have a bunch of electronics that work fine, but you can\'t stick them on your bike.
The next step is to print a beautiful box in 3D.
I designed a box for it.
You will find the attached slt file for you to print.
However, you may not want to print this box for three reasons; 1)
There is a block at the bottom of the box, which is the width of the gap in my rattan.
Depending on how you want to fix it on the bike, you will want to adjust it to your own size. 2)
When charging the battery, the holes on the side need to be placed in the right position, no matter what battery you buy. 3)
I live in the UK and everyone is driving on the left and I want to detect traffic on the right.
If you live in the country where you are driving on the right, you will want to move the hole of the camera to the left instead of the right.
You may be able to mirror it, but I haven\'t tested it yet.
I have provided the original tinkercad design here, so you can edit and adjust it to your own needs;
You have already printed the box and you can start to assemble everything.
When the camera was in the hole, I put some adhesive foam weather bars on the back of the Raspberry pi to press on the camera
This keeps it well.
Anything soft is OK.
Take some screws and screw the Raspberry pi into the box.
You will need to connect the 90 degree USB connector to the power input before this (
It is possible to add a regular USB connector, but it adds nearly 2 cm to the box size).
Next, fix the distance sensor to the hole on the side.
To make sure it\'s safe, I found it better to use some bolts with a diameter of 2mm
This is stronger than screwing on the plastic like anywhere else, let me install it closer to the edge.
Next, put the led into the hole and add some glue to keep it in place.
Screw the button onto the hole at the top.
I chose a battery with an input on the side and an output on the top.
This allows me to have a connector inside the Raspberry pi and a hole on the side of the box to charge it.
I just connected the battery and slid it into the box which was designed to cling to the battery.
Screw the lid on and you\'re done!
You might want to know what those hooks are doing outside the box.
That\'s how we connect the box to the underpants on your bike.
To do this, take a few elastic bands and tie the knot about 1 cm.
Then put some tape on the other end.
The tape will be used as a handle.
Place the knotted elastic band on one side of the distance sensor.
Then put the sensor on your underpants, pull the tape, and hang it on the hook on the other side.
Just choose the right elastic band length, which is very safe.
You\'re ready to go!
Just press the start button to start the Raspberry Pi and press the start/stop button to start recording.
Press it again when you finish stopping video recording.
You can skip this step, but for anyone interested in working inside the code, here is a version with comments.
In addition to this main code, there is also a web template to define the layout of the web page in the template. The code also uses the pimoroni library of the vl53 l1x sensor, and with allowing to detect changes in sensor accuracy, we only use sensor data if the sensor data is accurate enough.
When the sensor reading is inaccurate (e. g.
Too far away)
We don\'t update the display so you can only see the exact readings and timestamps on the screen.
If you are doing some improvements as well, you may consider them; 1)
The box is not waterproof.
A clear plastic screen can be added in front of the camera and distance sensor.
The distance sensor generates reflection from the plastic, which will affect the reading, but you can calibrate the sensor to explain this.
For instructions on this, search for the \"vl53 l1x API User Manual \".
You also need the plug for the USB charging port and add sealing materials around the switch. 2)
No real time clock for Raspberry pi.
Battery-powered RTC can be added so that the time is correct when turned on.
I use the wifi hotspot on my phone to allow it to connect to get the right time, but the RTC unit negates this. 3)
If you want to make it easier for windows to use video files, you can do it by running \"sudo apt-
Get install samba-common-
Then edit the file/etc/samba/smb.
Conf adds the following at the end of the file and then by typing \"sudo smbpasswd-
A pi \"and enter the password.
Finally restart the Samba server with \"sudo/etc/init.
D/samba restart \".
You can then browse to \\ aspberrypi \\ share in windows to view the file. 4)
Some people commented that it was all a bad driving record
This does not stop you from getting hurt.
This is true, the next step may be to print a larger box, place the words in the overtaking monitor with bright visible letters, and perhaps some flashing lights to attract attention.