<p dir="auto">I recently added a roof box on to my "Micro Camper" for a camping trip, to store all the various things that obscure my rear windows when we are on the move such as bedding etc. However, Having never driven a 'tall' vehicle, I was concerned that I may end up driving into some height restricted carparks or entrances forgetting I had the roof box on. Normally these things are around 2 meters, and my car is now 2.4mtr.
<p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmaEdk3zbP246kiRkRUh8v3fREqsF15vqXeFF2WoQrvVhg/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmaEdk3zbP246kiRkRUh8v3fREqsF15vqXeFF2WoQrvVhg/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmaEdk3zbP246kiRkRUh8v3fREqsF15vqXeFF2WoQrvVhg/image.png 2x" />
<p dir="auto">I had a stack of old Minimus AVR 32k that I had lying around that I bought many many years ago from Leeds HackSpace, and didn't want to use an ESP8266 or Arduino for a permanent installation, as these Minimus were cheap.. Only a few GBP each. I found that that you could burn the arduino bootloader to them and use them pretty much like an Arduino, thanks to a repo by pbrook;
<p dir="auto"><a href="https://github.com/pbrook/minimus-arduino/wiki" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/pbrook/minimus-arduino/wiki
<p dir="auto">So I used an 'Arduino as ISP' to burn the bootloader following his instructions, connecting up the MISO, MOSI, SCK, VCC and GND.. Firstly uploading the ISP sketch to the Arduino, and then selecting the board and burning the bootloader
<p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmcU223ez9rukbVAWi55LN5ZeYntTfEhsvecCH7CgwRg33/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmcU223ez9rukbVAWi55LN5ZeYntTfEhsvecCH7CgwRg33/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmcU223ez9rukbVAWi55LN5ZeYntTfEhsvecCH7CgwRg33/image.png 2x" />
<p dir="auto">Once this was done, the board can be used almost like an Arduino.
<p dir="auto">I had some of these ultrasonic waterproof surface mountable sensors, like that's used in parking sensors (From alibaba)
<p dir="auto">I connected up the ultrasonic sensor, and a piezo alarm buzzer (Beeps when supplied 5v) <img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmZfoLizkWgdPDQ4dzxeP9EKPNaY22fsNGgF33QdoPrFUr/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmZfoLizkWgdPDQ4dzxeP9EKPNaY22fsNGgF33QdoPrFUr/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmZfoLizkWgdPDQ4dzxeP9EKPNaY22fsNGgF33QdoPrFUr/image.png 2x" />
<pre><code>/*
* Proximity Alarm
*
*/
const int buzzerPin = 0;
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
digitalWrite(buzzerPin, LOW);
Serial.begin(9600);
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
Serial.print("Distance: ");
Serial.println(distance);
if(distance < 100) {
digitalWrite(buzzerPin, HIGH);
delay(1000);
}
else
{
digitalWrite(buzzerPin, LOW);
}
}
<p dir="auto">So anything that comes within a meter of the top of the box, the alarm sounds.. Gives me enough time to hit the brakes!
<p dir="auto">I then boxed it up in an old printer cartridge box and drilled a hole for the sensor. Connected it all up, and it works!!
<p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmU55TyNZ6s1VM6PX69xY3Zwdpkz8YQ88r27GJDGfx6vMi/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmU55TyNZ6s1VM6PX69xY3Zwdpkz8YQ88r27GJDGfx6vMi/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmU55TyNZ6s1VM6PX69xY3Zwdpkz8YQ88r27GJDGfx6vMi/image.png 2x" />
<p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmaKZxPn2m7LZ5ygMnadXZz8hfjv7aLr2NDKvp848dwXQT/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmaKZxPn2m7LZ5ygMnadXZz8hfjv7aLr2NDKvp848dwXQT/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmaKZxPn2m7LZ5ygMnadXZz8hfjv7aLr2NDKvp848dwXQT/image.png 2x" />
<p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmcd4hsaMT6V81xjKJtG7WodchgWwAoS1GTABgDtWwFqBA/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmcd4hsaMT6V81xjKJtG7WodchgWwAoS1GTABgDtWwFqBA/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmcd4hsaMT6V81xjKJtG7WodchgWwAoS1GTABgDtWwFqBA/image.png 2x" />
<p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmXUtQ21Hac8xysDb2JUw9S36gqf16DjU1cNVV9ZBKn4LA/image.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmXUtQ21Hac8xysDb2JUw9S36gqf16DjU1cNVV9ZBKn4LA/image.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmXUtQ21Hac8xysDb2JUw9S36gqf16DjU1cNVV9ZBKn4LA/image.png 2x" />
Congratulations @applicationist! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Vote for @Steemitboard as a witness to get one more award and increased upvotes!