Hey guys, back with another little project that I’ve been fiddling with for the past week. With kids around, every parent is thinking how to make their home safer for the little ones and for everybody in general. One of the most dangerous thing in the house can be the stove and since we have …

For a while now I’ve been planning to start on this little project but didn’t have either time or parts to actually see it through. Finally last week I decided to prioritize it and I can happily say that it turned out to be a very fun and engaging. So, in short, this is about …

Here is another tidbit that made me lose some sleep over the past few days. Well, not actually sleep, but a few good hours pulling my hairs and another hour on the phone with the Godaddy support. I have to admit that they are quite polite and nice to talk to.

Like many Canadians I was quite happy a while back when Amazon decided to amp up the canuck version of their store. Imagine that: all the US goodies, well, almost all, now available to Canadians too. And by goodies I’m not only talking about products, but also deals and general prices, not to mention great customer …

I’ve been looking all over the Internets for a simple straightforward way of adding a donate button to my ASP.NET page but all I could find were bloated plugins or simple GET forms. Since I had quite a huge parameter called “encrypted” in my PayPal button generated code, sending it in the URL might not …

Hey guys, back with another little project that I’ve been fiddling with for the past week. With kids around, every parent is thinking how to make their home safer for the little ones and for everybody in general. One of the most dangerous thing in the house can be the stove and since we have a gas-powered one, I always wondered why there are no simple gas detectors that can be used around the stove, just to alert instantly that gas may be leaking.

Well, that was the moment when I decided to build one of my own. Having a Particle (Spark) Photon lying around, I decided to use that as a foundation for the project. I like the fact that they are very small and cheap, and also can be flashed over the Wi-Fi. Having that settled, I needed the gas sensor and some kind of alerting system.

For the gas sensor I went for an
MQ-4 gas sensor because it can detect methane (CH4) as well as natural gas (CNG).
I found out later that it’s quite sensitive to CO2 as well, which turned out to be very useful while testing the setup. If you’re planning to use one in your projects and never used one before, remember that the gas sensors have a burn-in time when they are powered. That is to say that the sensor needs time to warm up (anywhere between 2 and 10 minutes). This is because the actual sensor has a heating element that helps detect these gases and while that is cold, it will give erroneous readings.

Now on to the alerts. Half of the alerting system was simple, add a beeper next to the sensor which would work perfectly when somebody is around. However I still had to sort out the second half, for the cases when somebody was not in the immediate vicinity. For that I wanted to have text/SMS alerts to my phone and possibly to a secondary phone, for example my wife’s phone. Now I realized that I should probably get one of our neighborhood FD guys phone number in there too. :)

Knowing that the Photon is not the most robust controller in terms of notifications (I know there’s the IFTTT or other alerting systems) but I wanted something small, reliable and really not depending on various 3rd parties in the cloud. So I made a small web app on my local web server that would send me specific text message when a URL is hit. Many cell carriers offer now the possibility to send somebody an email to a specific email address, and that email will be turned into an SMS and sent to the phone, so that turned out to be a good enough solution for me.

So the final sequence would be the following: gas sensor detects gas, starts beeping and at the same time triggers a URL which in turn sends an email that gets transformed by the carrier into a text message on my phone. The code that runs this will actually send an alert every 30 seconds while the gas sensor is being triggered. This way I know when the gas has dispersed. Here’s the photon firmware code:

For a while now I’ve been planning to start on this little project but didn’t have either time or parts to actually see it through. Finally last week I decided to prioritize it and I can happily say that it turned out to be a very fun and engaging.

So, in short, this is about having access to thousands of free radio stations online and streaming seamlessly to a home audio system. Since this was more of a trial for me, the audio system consisted of in-ceiling speakers for the kitchen.

To start off, I planned where I would place the speakers. Not knowing yet how big they will be, all I could do was more of getting an idea how the kitchen is laid out and where most of the activities will take place. Being a new house, I did not have all the furniture in place yet. Finally I decided on having two speakers, one over the fridge/stove/sink area and
the second closer to the formal dining area. The plan for the setup was to have a device capable of streaming online audio content, speakers and possibly an amplifier in between (depending on whether the speakers had it built-in or not). With that decided, I started shopping for speakers.

The Speakers:

I knew from the beginning that I will not use this for party style loud music but mostly ambient music or newscasts so after comparing models, specifications and prices I settled on the Polk TC80i. These are 8-inchers so they do pack a punch but my hopes were that the punch would actually go towards sound quality rather than quantity.
When they arrived I was again impressed by the Polk packaging and product quality. Very nicely packed with very much attention to protect all scratch-able surfaces. Well done Polk. The speaker specs can be found here in detail.

Streaming:

Another piece of the puzzle that was decided pretty early on, was the streaming device. Being quite familiar with micro-controllers and having tinkered on other projects containing bare-bone PCs and other miniaturized systems, I decided that the Raspberry PI Model B would be a perfect fit for this one. Model A would work too, but in this case I wanted to invest a bit more, in case I will re-purpose the PI in the future. At the time of writing the Model A was retailing for about $20 on Amazon.com whereas Model B was around $45. Still very cheap for a credit card sized computer. While at it, I also got a wireless adapter for it (it does not have wireless capabilities built-in) and a nice clear case for it. The wireless dongle was one of the most popular ones used by the PI community: the Edimax EW-7811Un 150Mbps 11n Wi-Fi USB Adapter.

When it comes to streaming software it was quite easy. A while ago I came across a DIY Internet radio forum that mentioned PI MusicBox as a good streaming source. I gave it a try and found out that it was exactly what I needed for this project. It’s extremely easy to install on the Raspberry PI on a micro SD card. Basically you need to format a micro SD, install the MusicBox image and plug it into the Raspberry PI. That’s it. The official PI MusicBox website has the detailed steps for that, so I won’t list them here.

The Amplifier:

Having the speakers and streaming device sorted out it was time to shop for the final piece that would tie these together. That is the amplifier. The main criteria for the amplifier was that it needs to be very small, low profile and just enough to drive the two speakers. The place where this would spend it’s amplifying days was on top of a kitchen cupboard, so a remote control was also not in the plan. I initially started looking for one that would be smart enough to detect when the audio-in connection becomes active and turn on by itself, but then I was advised that even if it’s on all the time, it makes a very small difference since the
consumption on most recent amplifiers is close to zero when not in use.That being said I went for the SMSL SA50 50Wx2 TDA7492 Class D Amplifier which retailed for about $65. This is a 50W continuous average power little powerhouse that has received outstanding reviews since it was released. In my case the speakers are 8 Ohms 125W max so I realistically expect about 30W per channel to be delivered at peak levels to the speakers at a reasonable ambient volume.

Here is a connection diagram for the entire layout

Installation:

Time to start the installation. I knew from the beginning that the speakers would be the most challenging. Not only because I had to cut these big 8-inch holes in the brand new ceiling but also because wires and studs usually don’t go well together, especially when they don’t come up at the same time. Using a good stud finder I mapped all joists inside the kitchen ceiling and based on the orientation, I chose a cupboard where I would place the amplifier and the Raspberry PI so that the wires to the speakers would run along the joists and not perpendicular. These two components are small enough to go inside the cupboard but since I have a small gap between the cupboard and the ceiling, I placed them on top, well hidden from the view. Armed with the templates that came with the speakers and the having the joists outlined, I marked the two placements for the speakers exactly in between joists.Making the holes was fairly easy using a drywall saw and I had them made in a matter of a minutes. After these were done, I made small holes in the ceiling on top of the cupboard very close to the wall where they would not be visible. These small holes were in line between the same set of joists between which the speakers were placed.
With a wire fishing line I ran the speaker wires from each small opening to the speaker location, connected and mounted the speakers.

Once the speakers were connected to the amplifier, it was time to find a power source location from where to power the PI and the amplifier. The PI requires a 5V power supply and it only needs about 750mA at peak usage so I simply used an iPhone charger since it’s very small and rated for more than enough amps. The amplifier came with its own power supply, which was a bit big for my taste, but since it was hidden, I decided to keep it.

Initially I was planning to run a low profile extension cord from the counter top-level outlets through the cupboard, however, I realized that the hood fan was very close to the location so I simply added a three-way power splitter inside the hood fan and ran a cord to the top of the cupboard from there. This was hidden in a white wire conduit. Another good location is the microwave power outlet which is usually behind the microwave if you have one located at cupboard level.

After running some calibration tests, in order to set the correct volume on the amplifier, I turned the software volume in MusicBox up as much as I could where no distortion would be noticeable and considered that as the loudest volume I want to have. To my surprise the amplifier had to be turned to only about 1/3 of its full range. Why is that good? Because that means the amplifier does not need to do a lot of work to have a reasonable sound level, which in turns means less power consumption and less heating.
All in all a good and fun little project. Now I am looking to expand this setup to multiple rooms in the house.

Here is another tidbit that made me lose some sleep over the past few days. Well, not actually sleep, but a few good hours pulling my hairs and another hour on the phone with the Godaddy support. I have to admit that they are quite polite and nice to talk to.