6 posts tagged

arduino

Smoke and Temperature Sensor for my 3D-printer

Smoke and Temperature Sensor Assembly

Sometime ago I bought an IKEA smoke sensor. It lived some time in the kitchen as expected, but then I put next to my 3D-printer that was located in the garage.

But then, it doesn’t make a lot of sense if it only fires an alarm in case of smoke, since I maybe away, so I decided to hack it into something IoT.

There are a couple of useful blog (this and that) posts that I started from.

It took quite a while to just follow the advice given there and to solder properly ground connection to the CS2105G0-S12 chip (that people suggest is actually MC145012). Anyway my project is a bit simpler in a way – the wi-fi module (Wemos D1 mini) is constantly powered with USB and feeds data every second to Blynk.

One other issue I had was that smoke sensor IC is using 9V for power and signals, so it had to be stepped down. With invaluable help from my former colleague Mich, I did it using an NPN transistor and it works pretty smoothly.

Printed a special case for it to fit all the components.

In case of smoke the Blynk app will send me a notification. Later on, it will also turn off the smart socket that the printer is powered with.

Arduino source is on Github. I will try to put some more details and the scheme later.

I have no illusions that this thingy is pretty weak in terms of safety and reliability – there are too many things to break in case of a real fire – but it was an important learning project for me.

 No comments   2021   3dprinter   arduino   DIY   hacking   IKEA   IoT   smoke-sensor

Completed a learning course in Arduino

Finally a 3-month online course in Arduino from robo.house came to an end.

The course covered basic electronics, components, sensors, motors and some other bits.

It was pretty fun to go over it together with other people.

The final task was to assemble a smart home model, using most of the sensors. I integrated the gas sensor, temperature/humidity, RFID to open the gate with a servo-motor, 2-line LCD screen, ultrasonic sensor, and that’s about it.

Can’t say I have learnt a big deal from it, I have already covered this basic level myself by trying to do stuff. Still it was very nice to connect with other people in this field, also got some details about how actual components work inside, which I did not bother to learn before.

Here is a gate opening on reading a correct RFID token:

 No comments   2021   arduino   DIY   learning

March 2021 Links

Some more links I found interesting this month:

Videos

Cool project with transparent LED displays:

Great drone piloting around bowling club:

 No comments   2021   arduino   DIY   links

Arduino Bluetooth Car Controller

Arduino 4WD Car Kit

My wife has recently presented me an Arduino 4WD Car Kit.

The kit is great, produced by keyestudio, and based on l298n motor driver.

It took me a while to assemble and make it work, but I got so much fun in the process.

The app

The kit producer provides an Android app, but it’s quite buggy, so I looked for alternatives.

I found a simple app code by Boldi Zopcsak and tweaked a little bit tot include the MAC address input field which was hard-coded before.

Also the app now tries to connect to Bluetooth device on start.

What I’m especially happy is that I set up the Github Action to build the app on every commit. It also stores the app builds, very handy.

Check out Repo on Github.

Builds: Android CI

 No comments   2020   android   arduino   bluetooth   DIY   projects

Toy Traffic Light with Arduino and Lego Duplo

Demoing this to my son

Here is my small project that I made for my son’s 2nd birthday.

He is very fond of trains and cars, so I thought that a working traffic light would not hurt. I know there are some commercially produced toys, but I wanted to do something myself.

If you have religious feelings about Lego, proceed with caution – some damaging images ahead.

Concept

I just looked at a 2x4 regular Duplo block and thought that its bottom tubes resembled the traffic light tubes (kind of).

Those tubes also large and deep enough to accomodate regular 5mm LEDs.

However to place the Arduino and have some space for the wiring, I had to cut almost entirely the two and a half tubes with a Dremmel rotary bit. Even after this the block still has some rigidity:

Videos

How not to solder:

Almost ready:

Complete:

Parts

Project is based on Arduino Nano which fits pretty well inside the regular Duplo block.

  • Arduino Nano V3
  • Red, Green, Yellow LEDs
  • 220 Ohm resistor (3x, for the LEDs)
  • Pushbutton
  • Battery block

Power

One can use pretty much anything to power Arduino Nano with some LEDs. I had some CR2032s, 9v crown, Li-Ion 18650 and an 3xAAA battery block lying around.

Initially I wanted to go with CR2032 in order to reduce weight and complexity, but the ones that I had did not produce enough current.

18650 is a good choice, but would require more block processing to fit the battery.

So I went with a noname 3xAAA battery pack.

Coding

I started off with a python sketch, aiming to use ESP32 with micropython to allow over-the-air traffic pattern updates.

For some reason I had issues with ESP32 on my laptop (could not properly connect over serial, even with that bespoke UART driver).

So I went really simple, with a regular Arduino and C.

Wiring

Assembly

Soldering is really messy, but also the space was limited:

I’m as surprised as you are with my soldering:

Some drilling had to be applied:

Complete with some hot glue:

 No comments   2020   arduino   DIY   family   hardware   lego   projects   source-code   toy

diPlayer – Raspberry Pi-based player for DI.FM

diPlayer assembly

This is a desktop player for DI.FM that I made for the 20-year anniversary.

I gathered a lof of experience during this proejct:

  • learned how to solder (again)
  • familliarised myself with Python
  • wrote and debugged firmware for an Arduino Nano
  • learned to model in Fusion 360
  • found out that 3-d printing don’t happen right on the first time

Details

Desktop player based on Raspberry Pi, that can play DI.FM channels (IceCast streams to be exact).

It is controlled with photoslides frames that have NFC-stickers on them, the stickers point to certain channels.

The player can also play other sources like Spotify, Google Play Music, Soma.fm thanks to MusicBox software.

It has a physical Play/Pause button, volume knob and a small screen that displays current track. Sound output is through audiojack or HDMI (Raspberry Pi standard).

Inspiration

Last year I saw these tweets:

And some comments had a link to the PlasticPlayer project.

It’s a small device based on Espruino with NFC-sensor and a screen. Upon detecting NFC-chip it gets its reference track from the database and sends the link to it to the Raspberry Pi that sits on the same network.

The author, Brendan Dawes, released all the source code and models for 3-d printing on Github, which helped me a lot.

My Attempt

I started to work on the project in June 2019.

It was around the time I just received a couple fresh ESP32 from China. I did reflashed one of them with Espruino, but even simplified code from the Brendan’s repo didn’t run.

Also I didn’t like that in such a simple project there will be two separate wi-fi connected devices, and I deemed suboptimal Arduino getting track data from the remote server in the face of Raspberry Pi power and possibilities.

So I rewrote and remodeled everything from scratch.

I just forked the repo and dove into unraveling all the upcoming issues.

Mistakes and Experience

On the breadboard

NFC PN532

This is a very popular Arduino NFC-module. It took me only one a half months of unstable work (!) for me to read to the original manual.

One of the keys issues here was that the wire management – the wires should go under the antenna turning in 90°.

The wires should go under the antenna turning in 90°

NFC-module is very susceptible to electromagnetic noise from other devices and wires.

Encoder

I also decided to replace the “Next Track” button with the volume knob.

On the first iteration I tried to use encoder with Arduino.

Encoder is a knob you must be familiar with from a wide range of electronics. It uses two rings inside and a cursor to determine if it goes forward or backward.

On a separate breadboard and an Arduino with only the encoder connected everything worked smoothly.

But whenever I tried to use it with my main board, together with NFC-module, screen and a couple of buttons, the volume was unstable at all, and I couldn’t use it.

I couldn’t discover why it happened. Maybe it was due to some regular voltage spikes that I could measure. Some tutorials stated that encoder needed hardware interruptions to work, and so maybe I used the wrong Arduino pins.

After some struggling, I almost gave up on the project and decided to try potentiometer.

Potentiometer

It’s a more traditional knob, based on the resistance change inside itself.

It didn’t come out easily as well. Looked like the NFC-module emitted a lot of noise, and potentiometer readings bounced by 10% either side all the time. 10% is quite a span, which is to easy to smooth out.

At some point, I got an advice on an Arduino forum, to connect the potentiometer physically closer to the power source. It did help, just until the final assembly.

Case

In the original Brendan’s repo (above) there is a case 3-d model. But it appeared I need more height due to the fact that I wanted to squeeze both Raspberry and Arduino inside, and also I wanted a different type of wiring on the back side.

I tried to model it at first in Blender – from my knowledge it was a popular program to make Counter-Strike skins 15 years ago.

I did a case model from scratch using the relative units. In a day the printing guys sent me a picture of a bottom lid with the Raspberry mounting holes spaced apart too much. They suggested me redoing the model in Fusion 360.

I never tried parametric modeling before and it worked like a charm. Fusion is an awesome and fast peace of software, and it took me only a complete Sunday to learn the program and model the case with exact measurements.

This time printing went smoothly in terms of dimensions. However the surface quality appeared to be poor in some places, and I couldn’t fix it afterwards.

The case before painting

I tried to sand it and apply different Dremmel rigs, but it didn’t really help. In the end I coated it multiple times with acrylic paint which made it look a little better.

Final Assembly

I had only two weeks left to the deadline (a trip to Croatia to meet my colleagues), so I was calm thinking that I have a lot of time.

By this time I got desperate a couple of times and was close to abandoning the project due to unexpected issues. Now, remembering those moments, I can’t understand why it scared me that much. My wife really helped in those moments, encouraging me to continue.

One of the first surprises was the fact that the USB-cable that I used to connect Raspberry Pi and Arduino did not fit into the case. So I soldered a shorter version of USB-A — mini-USB.

Soldering mini-USB plug

Then I soldered all the components and headers onto the circuit board, and potentiometer started to report incorrect readings again. I got some more advices on the forum, tried to put a capacitor.

In the end I replaced the potentiometer with the encoder, but this time plugged it into the Raspberry Pi. I added another small class to read the encoder readings in my Python program and it was good.

One of the iterations of my expansion boards for Raspberry Pi
One of the iterations of my expansion boards for Raspberry Pi

It was only three days before the flight, and I had more plans for the firmware updates, Raspberry Pi suddenly stopped working.

It looked very strange – I could connect via ssh, but the Musicbox web-interface was not available. The solution was too straightforward – reinstalling Raspberry Pi. Later I discovered the sd-card got corrupted due to multiple hard power-offs.

At some point it all worked together, but I didn’t have any emotions left to rejoice.

It took me about two months of almost every evening (after my main work), which came with some exhaustion.

Final layout of the player

I still did some programming right until the flight, and also had to make Python program autostart when I was in Croatia.

Cutting the NFC-cards covers, night of the flight

Presentation

Ari, Andrew, me, Mich

It was a good one, despite the device looks.

Links

P.S. Want to say thanks to my wife who cheered me up many times during this project, helping me to go forward. Thank you 😘

P.S.S. I had a couple people asking me when I’m going to make the ones for sale and I started thinking about it. Let me know using this form if you are interested.

Originally published in my older blog in Russian in October 2019.

 No comments   2020   arduino   DI.FM   DIY   hardware   projects   raspberry pi