CuPID MEGA Remote : Killer Controller

Last we met, we built a prototype temperature wireless RF temperature controller. We got some good ideas and a Beer Fridge monitor out of the deal. We also realized, however, that we were flying pretty close to the sun in terms of the available memory we had to work with. Considering we weren’t concerned about power consumption, wanted to make our IO as flexible as possible (for example more interrupts and UARTs), we decided that a more powerful micro is in order. Enter the Moteino MEGA. Take a Moteino R4 and swap out the ATMEGA328P for a 1284P, add a reset button, and you get the Moteino MEGA. Fantastic idea. It’s a slightly larger footprint, but all progress has a price, right?

Now since last time, when we realized soldering was going to be a chore with all of our itty-bitties on one board, we had a couple PCBs made. Since we wanted to use the same enclosure and still use all hand-solderable DIP components, we ended up needing two PCBs stacked. We left the headers for our Moteino exposed, however, so we can still get to them easily. Shown below are the boards with all of the components (some optional) that we can jam onto it.

 

Components for our MEGA controller
Components for our MEGA controller

The other great part about stacking boards is that it will put our displays high enough that we won’t need to attempt to fix them to the inside of the enclosure. This helps for taking it apart and service, and also eliminates the need for the messy silicone arrangement we were attempting on the last build. Here are a few photos after it’s all assembled. You’ll notice the switch mode power supply is not used here, as we’re controlling a thermostat, which has a 24VAC contact. We put this on the mechanical relay, an advantage for when you need to handle things like AC voltage.

Our board and components, assembled, with a demo fit into our box.
Our board and components, assembled, with a demo fit into our box.

The astute reader will note that the board has been modestly pruned in a few locations where my CAD skills and attention to detail were a bit, um, unfocused. This is why we prototype! Here are a few more pics that show the fit, including the height of the displays:

Profiles of our controller, all assembled.
Profiles of our controller, all assembled. The displays are nicely elevated for viewing

Finally, we need to attach our encoder for user input, as well as the remainder of our IO. Here, we’re going to use a waterproof 1Wire temperature sensor, and close a relay contact for 24VAC that runs the house furnace. We’ll power it on a USB power supply and feed that in. We’ll also need to drill holes for the cable glands. We won’t bore you with those details. Here are a few pictures from during assembly:

Getting all the IO into the box. In this case, we've got 5V USB power in, a 24VAC furnace run contact, and a 1Wire temperature sensor.
Getting all the IO into the box. In this case, we’ve got 5V USB power in, a 24VAC furnace run contact, and a 1Wire temperature sensor.

And finally, here is the end product:

All wired up! Everything sealed up and in its place.
All wired up! Everything sealed up and in its place.

Now on to the installation and programming. In our next post, we build this guy into a home thermostat using a Raspberry Pi in our CuPID base unit as our control/sensor gateway.

Reference

The above makes use of the open source libraries available on github, including sketches, python and all web libraries:

Explanation and installation here:

 

UniMote MEGA : Templated Control for Moteino MEGA (UniMote MEGA)

Alright, so we’re super into the modular controller idea (see here for original post on the 328P version), and really like this new MEGA unit offered by LowPowerLab, the Moteino MEGA. It’s got tons of room for our programs, routines, and who doesn’t want MOAR? Anyhow, we’ll have to redesign our memory map based on the scads of IO now available. Here is what our available io map looks like:

UniMote Pin Label Name Function
0 0 PB0
1 1 PB1
2 3 PD0
3 8 PD1
4 9 PD2
5 10 PD3
6 11 PD4
7 12 PD5
8 13 PD6
9 14 PD7
10 16 PC0
11 17 PC1
12 18 PC2
13 19 PC3
14 20 PC4
15 21 PC5
16 22 PC6
17 24 PA0
18 25 PA1
19 26 PA2
20 27 PA3
21 28 PA4
22 29 PA5
23 30 PA6
24 31 PA7

Here’s our EEPROM map:

Item Bytes EEPROM Beg EEPROM End
NodeID 1 0 0
NetworkID 1 1 1
GatewayID 1 2 2
Encryption Key 16 3 18
iomode 25 19 43
ioenabled 25 44 68
ioreadfreq 25 69 93
loopperiod 1 94 94
sleepmode 1 95 95
sleepdelay 1 96 96
chanenabled 8 97 104
chanmode 8 105 112
chanposfdbk 8 113 120
channegfdbk 8 121 128
chandeadband 8 129 136
chanpvindex 8 137 144
chansv 8 145 152

With all this space, we’ve also added a load of other features. We’ll detail those here shortly.