Ok I’ll admit it I’m obsessed with making breathalyzers, I made my first one back in 2015 then I made an addon for the ElectroPet and another addon for the ZeroBootSystem. I wanted to make a slimmed down version I could take on a night out or to a beer festival. I start out designing it around a arduino pro mini but ended up using a attiny85, Join below to see how it turned out.
- Attiny85 sop8
- Latching switch
- SMD button
- 4x 7 segment display
- MQ3 alcohol sensor
- Male USB port
- M3 bolts x6
- Power bank
So after doing the tiny glow stick and using the power bank as the power source It got me thinking about using it in other projects. I needed a torch for work so I used that to prototype the idea of building something around the power bank.
I used a male USB port and design a 3d printed enclosure around it so it will hold it in place when joined to the front part with the LED strip on it. I also made a brace on the bottom that screws onto the it to stop it wobbling about on the power bank. I wanted it to be “hot swapable” so I could have 2 or more power banks and swap them out when one goes flat, Kinda like a power tool.
As I mentioned above I started with project using a arduino pro mini. I normally use these when I don’t need USB for HID or serial. I hammered all the code out, Basically used the code from Let’s get #atmega_drunk but stripped it back. It was while I was designing the board that I had the idea of using a attiny85, After a quick check of the pins I moved all the parts over to a new breadboard to see if it would work in the real world. The only thing I had to do was to modified the library for the 7 segment display because it had a Serial print in it
I’ve had this display kicking around my parts draw for awhile but I couldn’t find a decent library or a project that would be a good fit for it. The library I found was THIS ONE, It’s great because It lets you display letters which is nice. Obviously it can’t display the characters accurately but its enough to read. To use it with a attiny85 I had to modify because it had a Serial print in it. Other then that its really easy to use.
When I moved to using the attiny85 I used a USBtiny to both program it and to power it, When I moved the attiny85 to the PCB I noticed that the MQ-3 was able to draw more power since it was now pulling directly from the powerbank and not the USBtiny. I had to re-calibrate sensor because the way I coded it was I would let it warm up the sensor and settle down, Then I would take a base reading then add 300 to it, This would give me the bottom and top values. I got to the +300 by reading the seiral data from the sensor then waving it over a bottle of Jagermeister. Now that it was getting more power It was giving me different readings. The problem with this is I can’t program the attiny85 while it was on the PCB because of the pins I had used. So I had to de-solder the atttiny85 with a hot air work station and transfer it to programing board I had made, Flash the test code which just spat the readings from the sensor out to the 7 segment display. This allowed me to see the base value and then the value when I waved it over a bottle of Jagermeister. I had to de-solder the attiny85 again transfer it back to the programming board where I uploaded the now fixed code then transfer it back to the PCB.
To make this simple I used a power bank, For one I didn’t need to worry about designing that part of the built. But more importantly the battery wont be left in the project. Most of my project just go into my project draw and don’t get much use, With using a power bank it wont go to waste and run flat and can be used in other projects too
Designing the case
I designed this case around the idea I had to make a LED torch for work. I made it in 3 parts, First part holds the male USB port in place. Next I made the main body that I screw the PCB in to, then lastly I designed the clip that holds it all to the power bank and also has the tube to blow down. Its designed to slide over the power bank so its hot swappable for when the power bank goes flat.
To get the holes in the main body right I printed a quick template out after a bit of measuring then adjusted it for the proper print, This way you save time and PLA
I 3d printed a button that will sit on top of the SMD button and also a topper to put on of the latching switch to make it all match.