Close

Electronics Design (Redux)

A project log for Squirco Smart Home System - Sensor Network

Hidden sensors in every light switch

stevenSteven 03/15/2015 at 05:190 Comments

Two project logs ago I posted pictures of what I called "final" hardware. That was a total lie.

I'm going to make up for it by detailing the evolution of the hardware through some of the major revisions, as well as the decisions that drove the design changes.

In all of the designs, I strictly followed seven guiding principles:

1. No batteries.

2. Software is everything, so design the hardware to bring out the maximum potential of software.

3. Form follows function. The PCB and components must fit inside the enclosure without major modifications

4. Only use off-the-shelf parts, and keep track of cost. It's very easy to keep adding parts or functions for those "just in case" scenarios, and have the project bloat. This is a good way to control feature creep.

5. Don't be afraid to throw things out. Every time I open up the schematics, the first thing I do is look over the parts and think: "what can I do differently here? Is there a different way do the same thing?" This forces me to attack the same problem at many different angles and not get too hung up on a potentially bad design.

6. Write down everything.

7. No batteries.

--

Prototype 2 v0.14

This version is the first custom PCB I designed for this project (and second PCB ever). There are some interesting facts about it:

- It is the only PCB revision not defined by the enclosure

- It is the only PCB revision to utilize both sides

- it is the only PCB revision to include ISP headers on-board. All subsequent designs needed a programming adapter board

- It is the only PCB revision to have one MCU instead of two

Here is the list of the major components:

- Atmega256RFR2 MCU + transceiver

- ATMAC24 MAC address chip (never used)

- WS2812b LEDs x4

- very tiny push button

- PIR and all related components

- Avago ambient light sensor

- NTC for measuring ambient temperature

There were plenty of things wrong with this design: thermal pad under the MCU didn't have holes, the ground vias made no sense. One plane was power and the other was ground. LDO bypass was grounded so ground was at the wrong potential. So on. However, this was also the proof of concept needed to get things rolling. I threw the RF portion on there and hoped that it would work (it worked on the first try).

The four LEDs were originally intended to light up the entire Big Button with a fresnel diffuser. The PIR lens was also intended to be etched onto the face plate. This, as I will find later on, would not work, as I was unable to find a material that could achieve what I wanted.

--

Prototype 3 v0.12

In this revision, I made some interesting decisions:

- The PIR and LEDs were moved to a second board, which would eventually become the power supply board

- The footprints were added for a second MCU, CC2541, to provide beacon functionality "just in case"

- Both layers are now ground planes, and ground vias actually serve a purpose.

- Chip antennas were replaced with trace antennas (designed by Texas Instruments)

- 0.05" headers were used for connections.

Prototype 3 gave shape to the layout used in the latest version, which saw the addition of a second MCU. The space taken up by the beacon, as well as grounding requirements for RF meant that some components had to be moved to a secondary board. There was more work involving mechanical design (how everything fits together) than electrical, as most of that work was done in Prototype 2. This was also the first time that a programming adaptor board had to be designed to accommodate the small headers and unusual layout. This theme would be kept up forever.

Interestingly, this revision didn't have mounting holes. I have absolutely no idea why.

--

Prototype 3.5 R0.5

Top: Logic board

Bottom: Programming adaptor + testing board

Prototype 4 saw very minor tweaks from Prototype 3, but the changes were quite significant in meaning. At this point, the enclosure design was becoming more detailed, so the changes to the PCB this time were mainly dictated by the enclosure design.

- The PIR was removed.

- The LEDs were removed from the spec

- An ATTINY85 was used to control the (eventual) relay, as the main MCU kept freezing for some reason. This was later discarded as it's a stupid idea that doesn't solve the root of the problem.

- The 3.3V LDO was moved to the second board

- Pin headers were repositioned

The biggest change in this version was the removal of the PIR motion sensor. On top of how many false triggers were detected during testing (on a warm summer night, the PIR was constantly triggered by breeze!) There just wasn't a material that was white, opaque in the visible spectrum, and transparent in the IR spectrum. The most commonly used lens was made of polyethylene (PE), which is translucent white at best (think milk jug). Not only that, the material had to be quite thin to achieve even 70% transmittance (< 0.3mm). Since the industrial design takes all priority over electronics design, the PIR was dumped and an alternate solution had to be found. For the same reason, the LED had to be abandoned from the spec as well, and were only left on the programming board for debugging reasons.

The little push button in Prototype 2 was replaced with a steel dome switch. This button produces a very tactile feedback and a very pleasant sound, which is exactly what I wanted. (For the record, Belkin's WeMo uses a micro switch identical to the one in a mouse. The feel and sound was so disgusting I nearly threw up).

The removal of the PIR meant that a different solution had to be found to detect activity. Luckly, microwaving milk at 3:00 AM somehow led me to a technique know as Microwave Tomography. Basically, because the transceivers are on the 2.45GHz frequency (which is microwave), and humans are > 60% water, when someone passes by a transmitting device (or receiving), the signal strength will be disturbed. By measuring and mapping these disturbances, we can figure out where people are. The only downside is that, in order for detection to work, a minimum of three devices are required (you can use two as a trip wire though, which is pretty cool). No problems here since the devices are light switches. Houses have many light switches. The upside is that the more dense the network is, the better it is at detection. This also shifted the detection method entirely to software. Win-win.

--

Open Edition v0.99 (or Prototype 5 v0.17e)

Top: Logic board

Bottom: power supply unit

The current revision, which is probably final (fingers crossed), had even more minor but major changes.

The biggest change is the replacement of pin headers with 4mm spring contacts. These are absolutely fantastic, for two reasons:

1. They take less work to assemble than through-hole pin headers

2. They are more tolerant to the spacing between the two boards. This is significant.

Unlike pin headers, which have a fixed height, the spring contacts have a range of operating heights. This means that the tolerances in the plastic enclosure and PCB height matter less, as long as a good nominal height is chosen. As you can tell from how many contacts I used on the boards, I went a little crazy. These are awesome.

The second, less obvious change was that everything was re-laid-out in metric. The reason for this is again, linked to the mechanical design of the enclosure. Imperial measurements were not precise enough for parts of the design, so the entire enclosure had to be re-designed in metric. To be consistent, the PCB was converted to metric as well.

The LED footprint was added back in, again due to a possible design tweak in the enclosure. I will write more details in the next build log.

--

Power supply

This board came very late into the game, partly because I didn't really need it early on (after all, it really just produces 5V for the logic board), partly because I was contemplating whether to use a PSU module or to design my own SMPS (module won). However, as the enclosure design neared its end, I had to have the power supply board designed and ready to go for fitting.

The SMPS is a 3W module made by Vigortronix. This will reliably convert universal voltage to 5VDC. Some cutouts were included for isolation, because it's better safe than sorry. Add a wire terminal and relay and the equation is complete.

You may notice a footprint for a micro USB port on the bottom of the board. This was included so that the unit can sit in its enclosure outside of a wall. It's very convenient for testing in different locations (tripod + usb power adaptor). The production version will leave the port unpopulated and the hole on the enclosure sealed, but the Open version will have it in tact.

--

The schematics and board layout will be released (along with everything else) when the post about firmware design is up, just in case any tweaks happen between now and then (there probably will). The next build log will be about the design of the enclosure.

Discussions