2023-09-27

Dialling the gate

People will know I am a slight Stargate fan (!), and I like making PCBs. So, well... Latest is...

LEDs

First off, the LEDs. There is a very popular LED format, a WS2812B chip and RGB LEDs in a package. These use a serial daisy chained control channel allowing 256 colours of each of Red, Green, and Blue, to be loaded individually to a whole chain of LEDs. This design has 372 LEDs.

There are standard libraries to drive these, but I have discovered the ESP32 S3 is better as it uses DMA for the "remote control" hardware that is used to drive the data for these LEDs.

You can get these on tapes, and rings, and so on, usually 5mm x 5mm, or 4mm by 4mm, and I had even seen some 2mm x 2mm, but was surprised to find they are now available in these tiny 1mm x 1mm format. This ring design has a 100mm diameter centre hole.

They also usually need 5V power, but amazingly these small 1mm x 1mm modules work on 3.3V (or 5V), which is impressive (Blue is usually the voltage hog).

They are also very cheap. Part XL-1010RGBC-WS2812B, LCSC Part C5349953.

Alignment

My first mistake with the LEDs was making the layout simple, so a grid of these LEDs were one way up on one row, and the other way up on the next row. This allowed GND to be between two rows, then VCC between two rows, and so on. I put caps at the ends of the rows (which works well). This allowed me to pack them at 1.6mm spacing.

This was impressive, but I missed the (apparently well know) issue that the LEDs are placed within the 1mm x 1mm space, so for example Red is one side, and hence an all grid red looks like this, not evenly spaced.

They have to all be the same way around to avoid such issues.

Diamonds

I tried doing the same way and really a pain to track. The trick is to actually place them at 45 degrees, diamond style. This makes tracking really simple.

This allows a track at the top for GND, and at the bottom for VCC, and a link from LED to LED corner to corner for the daisy chained data line. Shown here I have vias for extra power. With thin tracks between the pads of the capacitors (expected to be one per LED) it makes for a really neat layout.

Grids

Grids were easy, and grids of LEDs like this are simple, with 2mm spacing (no caps), which is not bad. Caps added at end of row or column.

Apart from tracks joining VCC and GND top and bottom, or side and side, I actually created zone fills to make for thicker overall power tracks.

The latest design at 2mm spacing is 10mm x 18mm for a 5x7 grid, and allows them to be placed next to each other for a whole row at 2mm spacing, LEDs at the top and bottom of each column.

Rings

The other thing to do was rings of LEDs.

The principle is pretty simple, tracks (this time arcs) for GND, data, and VCC. Some zone fill for VCC and GND, again arcs (well polygons and lots of points).

Adding vias is fun, and I ended up with code that puts them off to one side if diodes and caps too close together (as above image) or in line in the GND/VCC tracks when enough space.

A simple ring with evenly spaces LEDs and caps is easy, but then I decided I needed some grouping of LEDs together with specific tighter spacing (the chevrons in the top image).

I also had to cater for the fact that power vias from one ring could clash with some of the next ring, and so omit some that were too close.

C code

If you have tried doing this in KiCad, it is far from easy - even with the grid locking and simple spacing like 2mm, it is hard, and making a ring with 39 LEDs, i.e. 4.6153846 degrees between LED and cap and LED, is, well, totally impossible. No chance doing it manually at all.

So, obviously, I ended up making C code, parsing in the PCB file, and moving LEDs and caps and making tracks and vias and fill zones. I have code for grid layout and ring layout now.

The gate

Working out the exact animation for the gate will need a bit of trial and error I expect - I cannot actually spin the symbols, so some poetic licence involved, but easy to "spin" the rings of 117 LEDs.

I have actually gone for a number of rings...

  • 117 inner rings, this is 3 per gate symbol, so makes for a nice "1 in 3" spin effect and allows the inner to be lit up and made sparkly for the gate open.
  • 39 gate symbol ring, so I can light individual symbols during dialling (seeing as they don't spin).
  • 18 ring for bottom of engaged chevrons (9 chevrons, so 2 per chevron).
  • 117 outer ring, again for spinning, but also can be two for chevron when engaged, and 3 for chevron end when not.
  • Two 18 rings for chevrons getting wider.
  • A 45 ring, so 5 per chevron, for the lights at the edge of the gate when selected.

I think making it dial will be cool. PCBs ordered, so a week or so (maybe more, some holiday in China), and I can post video of the real thing.

Open source

This is all open source, PCB designs and code, but if you want to buy one of these, and a driver, let me know. I have 5 on order.

2023-09-03

Setting the temperature

My air-con can have a temperature set and aim for it.

  • It has a wide range of ± a few degrees which I don't like.
  • It is not setting temperature by me, it is basing it on some sensor it has.

To fix this I have used an environmental sensor - on my desk, and for my bedroom, on my bed head. I then control the air-con - telling it I want it higher or lower than it thinks things are, so as to aim for the right temperature by me. It works well most of the time and keeps the temperature very close.

That is my bedroom, last night (cooling), units in ℃, so maybe ±0.2 ℃ at most. Good.

I also have radiators for the winter, and they have the same fun, driving the valve on the radiator with some prediction.

Which to use for heating? air-con (heat pump) or radiator... Bearing in mind some of the house does not have air-con, so has radiators anyway. I don't actually know which is most cost effective / efficient. But I can choose. Have systems in place to make sure they are never fighting each other :-)

Per room radiator control

One of the key things is per-room controls - this means a temperature sensor in the room, and a radiator control, and some way to tell the boiler that one of the rooms needs heat. We have two heating loops (up and down), my daughter has two (left and right!). But for each radiator there is one boiler control that is needed.

The hard way

So, the hard way, I have my fancy environmental monitors with a display. They have a config for temp targets throughout the day. I have systems to override for empty rooms. Using the light switch marks a room in use for the day :-)

They talk MQTT to a Shelly running Tasmota that controls the radiator. So needs an MQTT broker.

The Shelly talks MQTT to a FireBrick to say radiator is on/off.

The FireBrick has a set of profiles, and any one in each loop will cause a message to another Shelly running Tasmota to operate the heating loop valve.

This triggers the boiler as needed.

It works.

It is not cheap or simple - the env sensors cost, the FireBrick costs a lot.

The easy way - maybe

So I am working on an easy way - my daughter happens to have a FireBrick, but even so I am trying to make a really easy way to do this. Not all of my kids have one (?!).

The first step is the reference temperature. A sensor that can be placed sensibly, e.g. by a bed.


I had found some nice industrial (BlueCoinT) ones at €31, but now have found, thanks to a recommendation, some stupidly cheap ones on Amazon. They are only £9, and even cheaper on AliExpress. They can be refreshed with sensible code.

The next step is controlling the radiator, and something like a Shelly Plus Mini would be ideal. Not sure of price yet, but the normal Shelly Plus 1 is £16.49. Whoa, they used to be less than that! Interesting. The Mini may be less. We'll see. But up to under £26. The radiator control itself is something like this, £19.63

So yes, we are up to £45 per room. A few more £s for back box and fused spur box for the Shelly mini by the radiator. And one Shelly at the boiler.

The comms can all be BLE. Sensor to Shelly, and Shelly to boiler control Shelly. Just needs a bit of software.

Not ideal, but £50 per room for exact per room heating control is probably quickly worth it. Simple web interface (or maybe even HomeKit) for unoccupied rooms, and controls for times of day and target temperatures via a web page. This can quickly save on heating costs and make things more comfortable.

It always amazed me people ran their house with one thermostat on the wall in the hall.

The power of eSIMs

I was always skeptical of eSIMs. The idea you have a mobile identity in a physical SIM that you control seems a sensible approach. An eSIM i...