The beginning of Camille
Okay what is this? Let me take you a bit back in time…
Long ago I started creating a home automation system based on Arduino and cheap RF modules. The system worked fine’ish, but about 10-15% of the messages got lost because of the cheap RF modules and “dead spots” at different places in my house, but it was still possible to work with and use for every day use. The problems I later ran into was getting more and more annoying, because when I found a bug, I had to go around, connect each of the nodes (the devices sitting inside my garage/fan/lamp/…) and update the sketch in them. Basing the new system on Electric Imp solve that. The next problem I had after trying Electric Imp was that it always just returned “OK” no matter if the command went through or not, but after they released “agents” it is now possible to get more control over the response, and also have a more flexible system to handle the different values passed on by it.
This weekend I then finally decided it was time to make something proper, instead of having a bunch of wires on a breadboard. So I fired up Eagle and started putting components on and quickly it started to take shape.. As things went on and I started to show pictures to some friends it turned out some actually needed something close to what I needed, and even more components was put on…
After more hours of work it really started to look like an actual thing, and I then decided to start writing this… But what to call it? It must have a name! After staring at the title line for this post for a while without writing anything, I decided to get help. Google then helped me with this page http://www.behindthename.com/ and I then started to cycle through names in a furious F5 frenzy. After reading through 40-50 names I started to notice a pattern… Camille, Tóu, Kayden, Camille, Chun, Simcha, Fedelmid, Camille, Katlego… So either this is a very porpular name, or someone is trying to tell me something… I decide to believe it is some generous and kind force trying to speak to me, so Camille it is!
What do we need?
If we take a step back once again, I had to first figure out what I actually needed. On the Electric Imp we got 6 legs all with PWM and ADC capability, so which pin is doing what isn’t so important for what it is going to be used for.
- Mains power
- Easy to assemble
- Easy to program
- Easy component availability
Then after talking to a friend a few more things came up
- 12V capability
- Fan control
Let’s design a PCB!
Now when we got some ideas they should be put together in something simple, compact and awesome.
And before it gets all too boring, let me put a picture in.
Now beware, the next 500 pages can get a bit dry…
The most important thing here is the controller itself. For this I decided to use the Electric Imp, combined with their April board. With the Electric Imp it is easy to modify the code without having to connect a wire to it, change memory, or something completely different. Just log on to their web site and use the IDE to write the new code and send it directly to the Imp.
The April board got a ID chip on which identifies the Imp with their cloud, so even if you put another Imp in it, it will still do exactly the same as the old one.
When I started working on this I quickly scrapped the idea of making the relay board myself, simply because they are so wide available on eBay, and because I can’t make them at the price they are sold at there either.
The relay board I decided on is a 4 channel, 5v version. This means it got 4 relays, which needs to be supplied with 5v to pull the relay. (eBay search)
If you want to use the adapter pcb I design, you need to pay attention to which variant you get. The one I made this for look like this.
Make sure yours look like that too, otherwise it might not align up as it should with the holes and pins.
After measuring a bit on the relay board I could lay out the holes in eagle, and make a cut out so it would be possible to still get to the screw terminals with the adapter on top.
To activate/pull one of the relays, you need to supply it with GND on one of the IN[1-4] pins. However, the pins on the Electric Imp are not strong enough to do that on their own, so I had to add a transistor between the Imp and relay board (Q1-Q4). To further limit the current I added a 10k ohm resistor between the transistor and the Imp too.
For the temperature sensor I use a TMP36 which just outputs a linear voltage depending on the temperature, from that voltage you can then calculate the temperature.
If you want to read more about how that is calculated, you can head over to this post where some code can be found for it.
The next problem to tackle was the PWM. My friend wanted to use this to control some fans, depending on temperature, and since we got 6 pins, and only 5 in use, there was still one pin left to control the mosfet. But was it that easy? Of course not! Because he did not want one PWM output, he wanted two separate, now I was suddenly lacking one pin instead. To get multiple free pins, I could have used a shift register to handle the relays, but that would make coding it more complicated, which is against what I wanted to do with this, so I scrapped that idea pretty fast.
To be able to keep it simple, but still make it flexible, I decided to make a MODE switch, with this it possible to change between having 4 relays and 1 mosfet output, or 3 relays and 2 mosfet outputs. When mode is toggled, pin7 is either driving a relay, or the separate mosfet channel.
My first plan was to just use a 5V switch mode power supply to power it all, but with the mosfet output and the plan to drive a 12V fan with it, I also had to add a 7805 voltage regulator, and another jumper switch to switch between 5V and 12V supplied input.
Before I wrap this first post about Camille up, it is time to see what kind of total size we can expect.
This is the layout of the components, Electronic Imp April board on top of the adapter board, which goes on top of the relays with spacers. To connect the relays to the adapter board you can use the extended female pin headers that are commonly used for arduino shields.
This assembly will be just around 120mm wide, 85mm deep, and will be around 35-40mm tall.
Cool, whats next?
The next thing I need to do is to get a hand full of the PCB’s made and do some testing. I can already now warn you about more posts about this subject when that happens, and hopefully they will contain more pictures and less text than this post.