Showing posts with label electrics. Show all posts
Showing posts with label electrics. Show all posts

Wednesday, August 12, 2015

Concept: off-the-grid sensor module Part 2

Well over a year ago I wrote a bit about off-the-grid sensor modules. TL;DR: combining an ATmega328 with an nRF24L01+ and using low power mode makes battery powered sensor modules very feasible. Adding a small solar panel and a LiPo battery with charger circuit makes it awesome.

At that time it was just an idea that wasn't that high in my things-to-do-list, but in the past few weeks that idea has become more relevant. In our office I've got a bunch of plants. For those interested, we're trying to grow pepper and paprika plants here, which is a big step up from the indestructible spider plants that are infecting the office building :) I've got over a dozen plants, some of which are not in my room, but I'd still like to keep an eye on them. Now I could just walk into the other room, check on the plants daily and say hi to my colleagues while I'm at it, but where's the fun in that?

Instead of some physical and social labor, I'd rather just have a dashboard to monitor the soil humidity of my plants, because that's what any other sane person would want, right? Besides, I have a Raspberry Pi sitting on my desk that's just begging to be used for something useful.

I initially thought about having a single Arduino Uno connected to a bunch of sensors and to the RPi using SPI, but that's going to get messy with all the wires so I got rid of that idea pretty quickly. Instead I'd rather have tiny sensor modules. There's no need to integrate the nRF24L01+ and the sensor in the design; those can be bought separately for way less money than it would cost to integrate them. Instead the module should just have a socket to plug one of those cheap nRF boards in and a connector for a sensor. And we're going to need power of course. Using an ATmega would be overkill for this kind of project. An ATtiny would be a better choice since it's smaller, uses less current and is cheaper, plus I've got a few in my parts bin.

So what do we need?
  • connector for a nRF24L01+ module board (2x4 pins)
  • 3.3V power supply for the nRF
  • connector for an analog sensor (1x3 pins)
  • programming interface connector (ICSP, 2x3 pins)
Since the module needs to be as small as possible I would like to use an ATtiny in a soic-8 package, those are about 5x5mm in size and have eight pins. Two of those pins are for VCC and GND, and a third one is used for RESET (required if you ever want to (re)program it. So that leaves 5 pins for other uses. Here's a pin layout of the ATtiny I have lying around:
And here's the pin layout for an nRF module:
That's a lot of pins:
  1. GND
  2. VCC (3.3V)
  3. CE (Chip Enable), needs to be controlled
  4. CSN (Chip Select, SPI), needs to be controlled
  5. SCK (SPI Clock), needs to be controlled
  6. MOSI (SPI Master Out, Slave In), needs to be controlled
  7. MISO (SPI Master In, Slave Out), needs to be controlled
  8. IRQ, we're not going to use this.
So we're going to need 5 pins just to control the nRF, occupying all the available pins on the mcu. Fortunately, Nerd Ralph has a brilliant solution to this problem, using just a few off-the-shelf components to multiplex the CSN and SCK pins. This frees up one pin on the mcu which we can now use for other purposes. Ralph also uses an LED to drop the voltage from 5V to roughly 3.3V. That's not something I'm going to use since I also want to be able to power the module from a 6V solar panel or a 3.7V LiPo. Instead I'm going to use a LP2985-N voltage regulator. It has a very low dropout voltage of max 300 mV @ 150 mA, meaning it can deliver 3.3Vout with just 3.6Vin. At 50 mA the dropout voltage is even less than half of that, making it suitable for running off a LiPo battery. Other advantages are that it comes in a very small 5 pin SOT-23 package and costs about $0.25. The ATtiny will also be powered by this regulator since it can't handle the 6V a solar panel can deliver.

Another thing Ralph did was tie CE to VCC. However, this means the nRF can no longer transition between RX and TX mode without powering down.

So, fire up KiCad, throw in all components, wire them together and start laying out the board:

Neat eh? That's just 32 by 11 millimeters, or 1.25 by 0.45 inches. So it's even smaller than the nRF board to be plugged in. The IC1 pads and silk screen look a bit weird, that's because it actually are two footprints on top of each other. The ATtiny13A comes in two SOIC packages: a small one and an even smaller one. This board accommodates for both packages.

The ADC pin can be used as a digital or analog input, or you could use it as a digital output (for controlling a relay for example). The ICSP connector allows for changing the firmware (remember to unplug the sensor and nRF in case your programmer uses 5V).
The bare material cost per board is about $2.70, an nRF module costs around $0.80 and a three pin soil hygrometer costs $1.35. So for less than $5 you've got a wireless module to monitor your plant!

It still needs power though, but I'll leave that topic for a future post.

Wednesday, November 26, 2014

Reflow Toaster Oven - Part 11 - Rewiring

Finally found some time to replace the wiring of the oven. I yanked out the "controls" and redid the wiring. Installed two SSRs on heatsinks and three thermocouples. The result can be seen below.
I used some kapton tape to cover the bare 230V leads on the SSRs. I still need to fix their heatsinks to the bottom of the oven, for now gravity will do the job.
Please excuse the incorrect symbols...
I moved the thermal safety switch from the front to the back because the mains load wire isn't long enough... Mains L connects to the safety switch, so that power to the oven will be cut when the temperature gets too high. From there it goes to the SSRs. Each SSR is connected to one heater element (wires on the left of the photo, front of the oven). The other end of the heater elements are connected to mains null.
I also added three thermocouples in a more permanent setup. Each heater element has one thermocouple, the fiberglass sleeve of the thermocouple has been wrapped in some kapton, and I used a bit of iron wire to strap the kapton covered sleeve to the heater. The thermocouple's junction just presses to the heater. The floating thermocouple in the middle measures air temperature. It's held in place with, again, kapton tape.
I covered parts of the door with aluminium tape, hopefully that will reflect some of the heat.
The difference is noticable; the covered parts of the glass stay cool to the touch whereas the center gets warm. If this works well then I may just have to cover the entire inside of the oven with this stuff, but I'll have to check how well the glue on this tape holds up in the heat first. This is extremely sticky stuff by the way and very thin.

So with the cover back on I have a few wires poking out of the front panel: 3 thermocouple connectors and 2 times 2 wires for the SSRs. Looks like I didn't mess anything up. I didn't blow a fuse when I plugged it in, it didn't catch fire when I turned it on and it didn't kill me when I touched the metal cover. I'm almost disappointed :)