Showing posts with label Vehicle. Show all posts
Showing posts with label Vehicle. Show all posts

Sunday, 13 December 2015

Car Smoke Machine Pt 3

This is the final part of an on-going series of posts about a project to build and install a smoke machine in my car... for science or something...

If you missed the first two parts, they can be found here

So far we've got an e-Cigarette and an air pump wired together to produce a cloud of smoke. Now what we need is to find a way to control it and install it covertly in my car.

I don't want the trap to spring too early, I need to give them time to get comfortable in the car and get started, for it to be believable.

Also, the motor driver chip will need some logic control, so it makes sense to use a microcontroller to provide the logic and the timings.

As I mentioned in the previous post, left to it's own devices, the eCig's coil gets rather hot, so in order to counter that I wanted the microcontroller to only switch it on in 5 second bursts, then wait 5 seconds for it to cool down.

I used an ATTiny26, for no technical reason other than I have a lot of them spare.


Microcontroller code

 1 #define F_CPU 1000000UL
 2 
 3 #include <avr/io.h>
 4 #include <util/delay.h>
 5 
 6 #define CONTROL_PORT           PORTA
 7 #define output_low(port,pin)   port &= ~(1<<pin)
 8 #define output_high(port,pin)  port |= (1<<pin)
 9 #define delay(a)               _delay_ms(a)
10 #define smokeEnable            PA2
11 #define setInput(ddr,pin)      ddr &= ~(1 << pin)
12 #define isInputHigh(pinr,pin)  pinr & (1<<pin)
13 
14 int isRunning = 0;
15 int secCount = 0;
16 
17 int main(void) {
18     setup();
19     while (1) { loop(); }
20 }
21 
22 void setup() {
23     DDRA = 0xFF;  // all outputs
24     setInput(DDRB, PB6);
25 }
26 
27 void loop() {
28         if (isInputHigh(PINB, PA6)) {
29                 if (!isRunning) {
30                         delay(10000);
31                         output_high(CONTROL_PORT, smokeEnable);
32                         isRunning = 1;
33                 } else {
34                         secCount++;
35                         if (secCount > 5) {
36                                 output_low(CONTROL_PORT, smokeEnable);
37                                 delay(5000);
38                                 secCount = 0;
39                                 output_high(CONTROL_PORT, smokeEnable);
40                         }
41                 }
42         } else {
43                 output_low(CONTROL_PORT, smokeEnable);
44                 isRunning = 0;
45         }
46         delay(1000);
47 }
48 


The finished circuit
Click to enlarge
The Videos
I was hoping to use this to prank as many people as possible, and get some good video footage, but unfortunately only 2 of the videos were really usable. The first, is Craigs "We're all gonna die lads!" reaction, and the second, is Bethany's obliviousness to the cloud of smoke forming around her. Enjoy.





Saturday, 18 July 2015

In-car Bluetooth Stereo Mod

As the past few projects have been quite frivolous gadgets, this time I'm going to do something practical. It turns out this was actually one of the quicker projects I've done and makes a decent weekend project for anyone looking to make a quick upgrade to their cars audio system.

My car as an auxiliary audio input for connecting MP3 players etc. For this I purchased a bluetooth speaker adapter on Ebay for about a tenner.



It's a great device to connecting my phone for sat-nav, music etc, but there's a small annoyance in the fact that after getting in the car, it requires me to press and hold the power button for about 5 seconds before it'll turn on and connect to my phone. It's a bit of a first-world problem, granted, but it's kinda irritating, so I've been thinking about how to solve it.

Ideally, it should function like a built-in bluetooth adapter does in many new cars - as soon as the car is powered on, the bluetooth is powered on and connects to the phone.


After some experimenting with various approaches - microcontroller delays, 555 timers, I found the most functional circuit was a simple capacitor delay circuit, combined with a transistor NOT gate & optocoupler, so that the optocoupler is active, effectively holding down the adapter's power button, for 5 seconds, then switched off until the circuit loses power.


A rough schematic of the circuit I used



The completed circuit on top of the bluetooth adapter
Inside the bluetooth adapter.


Powering the circuit was simple enough - I already have a car 'cigarette lighter' to USB adapter with 2 USB ports - one powers the bluetooth adapter, and it powers on with the car ignition, so I added a USB plug to the timer circuit and used that.

Finally, I didn't want to leave exposed wires or circuit boards visible in the car - knowing my luck some paranoid idiot would freak and call the bomb squad or something, so I 3D printed a simple box enclosure which houses the adapter and the circuit nicely, the box itself nestling neatly in the centre console of my car.
The finished adapter in it's 3D printed box, ready to put in the car