2021-03-31

Selling a house

Why does it take so damn long?!

Anyway, some small progress last week, the buyer's solicitors had some questions. I really had tried hard to avoid questions, and made sure I had included all of the paperwork and everything, but no, they had questions.

All about the conservatory, which is a recent replacement of a conservatory put in probably 20 years ago. This means that even if the original conservatory did not meet planning exceptions, the fact it is over 4 years means that is moot, and the new conservatory is a like for like replacement so exempt anyway. But no, they wanted to check EVERY SINGLE RULE on it being a permitted development.

This included things like "Is it sited at ground level", and are the sides / roof mostly transparent. All the details but one could be confirmed just by looking at the estate agent pictures / details.

The only one that was not "obvious" was whether there was heating or not - seems it needs no heating or separately controlled heating. It has none.

Oh, and they asked if we had to pay anything for the "access way" to the house, when their searches should have confirmed that the house is directly on the public highway, so, d'uh!

I swear they only ask questions, especially ones to which they already have all the answers, just to justify their fees.

Fingers crossed that it won't take long now.

2021-03-26

Environmental sensors (now in colour)

I made these ages ago, but they have moved on a little. I may add more "air quality" type stuff in future, but for now they are temperature, humidity and CO₂. I have updated for a colour display.

The new house has coax cabling in place, which is no use to me, so I have redeployed as 12V DC supply so I can install these on existing single gang back boxes.

The main thing is that they are all on GitHub. This includes the code, PCB, and 3D case designs. This includes linux code to log the MQTT to a database. It also can send MQTT for controlling heating and ventilation based on temperature and CO₂ levels, which I am using with tasmota flashed relays (Shelly).

The PCB is now all KiCad, so easy to get printed properly.

The 3D case design has been fun - I made code to generate an SCAD model from the KiCad PCB layout so ensuring all connectors, and spacing for all components is always accurate. That was fun! I have included simple boxes with USB-C socket and also one gang face place boxes, with and without OLED or CO₂ sensor.

So have fun.

P.S. I have updated the repository Documentation to have detailed step by step instructions with pictures for building these.

2021-03-24

The trick to soldering these buggers (QFN16)

As I mentioned, I have been using an FT230X USB serial chip, and using it in the QFN16 package. There is an option of an SSOP20, which would be a lot easier to solder but takes more space. However, I think I have the trick of soldering the QFN16 sussed.

My first attempt was fine point soldering iron into the edge of the chip, that worked but is really fiddly.

My second attempt involved a hot air gun, a very hot one, in fact this Weller hot air gun.


Not cheap, but works well. It should not be hard to get one of these. Indeed, I got one a few weeks ago from RS - I ordered and as normal it arrived next day. Sadly, a week later it died (heat but no fan). So sent back.

Ordering another should have been as easy, and RS listed 32 in stock, but when I ordered nothing arrived. Indeed, my order showed as on back order for shipping 1st June. Yet the product page insisted 32 in stock for next working day delivery. WTF?

So cancelled RS and ordered from Farnell. Again, a normally very reliable supplier. They too had in stock for same day dispatch.

Again nothing arrived, and they contacted us and said they had cancelled the order, and refunded the card! Why? well as a "first order" and "the type of product" for "security reasons" they needed us to pay by bank transfer, not the Amex card I normally use, and ignoring that we have been buying from them for 12 years. WTF?

We paid by fast payment immediately, and they said accounts had gone home (this was 3pm Friday). They said they would ship Monday. Nothing. Finally arrived Wednesday even though the web site says not shipped at all.

What is wrong with people? "heat gun" is not a real "gun". Arrrg

Anyway, how to solder the QFN16...

Step 1: Tin the pads and the centre pad, being careful not to short any pins.

Step 2: Heat the board to melt the solder.

Step 3: Put a drop of liquid flux on the chip pads.

Step 4: Place chip on melted tinned pads and keep heating a bit - it should snap in to place nicely.

Step 5: It can be useful to do the USB-C connector at the same time thought that helps if you also tin the connector first.

That was it - works perfectly.

Note, whilst waiting for the Weller, I tried a more "normal" hot air gun and it blows way too hard and sent the chip flying long before any solder melted.

Obviously even better if you have a solder paste mask and solder paste, but this works too.

I have since redone the layout slightly to make the pads slightly longer, and make it a lot clearer when adjacent pins are joined together, as the track layout allows such tracks and vias to be very close to each other and so solder bridge easily (no solder resist on these boards) which looks bad until you realise they are joined under the chip! Making that clear outside the chip will help avoid problems.

2021-03-17

The MK Grid Plus rabbit hole

MK is a good brand of switches and sockets and they are always good quality and solid, so when looking fo some new light switches, they seem like a good choice, albeit not the cheapest.

But I want some switches that are "retractive", i.e. just push switches not rocker, as they control a Shelly / tasmota smart switch module and not directly connected to a light.

MK do some of these, and they actually do modular switches, so I can mix and match what I need and where. In some cases a "two way and off" retractive switch to work a dimmer is ideal, and others a single retractive switch, and in some cases one of each on the same face plate.

Sadly it seems that almost nobody has the whole range on their web site, and the whole range is huge. They have a load of styles. There are catalogues from MK that list just one style, for example. The problem is, at the start, you don't necessarily realise what is possible, nor what is available from suppliers. Just to be clear, Screwfix is first port of call as it is a 4 minute walk from my front door. As per comments, it seems https://www.gil-lec.co.uk/ stock a good range as do https://www.tradesparky.com/

  • K4885PWHI: A Grid plus retractive module, as sold by the likes of Screwfix, yay. It has "press" on it, but OK. Good start.
  • K3701 : A grid plus "frame" for it, single gang, one switch, also sold by Screwfix, yay.
  • K3631WHI: A Grid plus front plate, single gang, also sold by Screwfix.

This is a good start, I now have a working retractive light switch, and can confirm that in a deep back box there is space for the switch and a Shelly 2.5 and a Wago. Working nicely.

It proves the solution fits, and works, so now to consider if I want to change other light switches in the house, as I make things "smart". But I need to make small changes to the way things work - my wife is not going to allow me to change one switch at a time from the brushed steel light switches we have everywhere to a plain white switch like this. I am not even sure the "press" label is going to go down well.

  • K4885WHI: Ooh, they do a retractive that does not say "press". (they also do one with a door bell symbol, but no need for that).
  • K3491ALM: Oooh, they do a metal faceplate.

But hang on, the metal faceplate is an enamelled aluminium, somewhat "industrial" to pass the wife test...

  • K3431BSS: ooh, they do a brushed steel front plate. This is much closer to what we have now.

At this point I think I have something that may be close enough to what we have now. The switch is white, but no "press" on it, and the front plate is brushed steel. But not sure. If this is the best MK do it will do, so I ordered a few.

Then I discovered they have a range of other front plates, arrrg. And there are Grid plus, and Euro modules as well. Complicated. It looks like "Aspect" may be what I want... They are available in something like 13 different finishes, including brushed stainless steel. They are also screwless.

One of the best documents showing the different styles is a technical document from MK. Logic Plus is traditional plain white with visible screws, Aspect is rounded raised screwless in a wide variety of finishes, Edge is flush to wall - with screws - with a wide range of finishes, Albany is a heavier/thicker angled boarder and industrial looking with visible screws in a smaller variety of finishes, Metalclad Plus is white or enamelled grey metal - very industrial style. So, let's look at Aspect in Brushed Steel finish I think...

  • K24331BSS: A front plate - comes with frame - screwless, brushed stainless steel. Good.
  • K4885BSSB: A retractive switch, no "press", with black surround. (they also do white)

OK I think we may finally be getting there. It looks like I have found switches that are :-

  • Screwless.
  • Brushed stainless steel front plate finish.
  • Retractive.
  • Brushed stainless steel switch finish with black surround.

I think that will meet with approval and be close enough to what we have to allow changing one switch at a time without looking wrong. Fingers crossed.

Took a month to arrive, but wife approved :-)

What is also fun is that MK have a really big range of modules. Including coloured indicators and a buzzer module! No, I have yet to find a use for these. They have loads of switches with pre printed labels, so it you make up one of their large grids of switches, you can have them clearly labeled.

Downsides:-

  • Price.
  • Complexity of options.
  • The push switch takes noticeable force to press (though they do have two springs, and removing one makes them feel a lot more "normal", but probably not an approved modification).
  • The buzzer module is just high pitched and quite quiet - not good at all.

P.S. WARNING! other manufacturers make grid switches which are not interchangeable with these, and sometimes when searching the MK part number they come up, and "look" right - bastards!

And to add to the fun there are Euro modules, which are actually very simple 25mm x 50mm or 50mm x 50mm rectangular modules. I have seen these for networking before. For now. I'm going for MK Grid Plus.

2021-03-11

Hobby PCBs

Milling PCBs

As some of you may know, from previous blog posts, I got quite good at milling PCBs. Basically, if you want to make small circuits at home, one option is a milling machine.

It does have some key advantages - the main one being time. You can have an idea in the morning, and design a circuit, layout a PCB, mill it, and have it soldered and working by lunch time. You can do several iterations of a board during a day. Another advantage is the cost - just the cost of the copper clad board, and the occasional new drill bit.

However, there are limitations. The main issue is that is it single sided - whilst a double sided milled board can just about be done, it is hard to align and the holes are not plated, so need links. The accuracy is an issue too - using a USB-C connector was just at the limit of possible, mainly as I only needed to connect two of the smaller pins (CC1/CC2), and even then - the more detail you try and do, the harder it is to get right first time.

So, moving on - what else is there? What I am doing is not quite hobby, it is more R&D, so I need slightly better than just milled board. The answer is getting fast turnaround PCBs professionally made. The nice thing is that double sided and plated through hole now becomes the norm.

KiCad

But before I could get boards made, I needed a new way to design them. For milling boards I was using inkscape to lay out the milling path. That was not going to cut it when someone wants Gerber files. So I asked Twitter, and several people suggested KiCad - a free package that was available to run on my Mac.

It is nice, I have to say. It does the schematic, and then one button and you are in to PCB layout. It has design rule checks at each stage. The PCB layout is nice - I worked out that I prefer the "push" mode where running a new track which pushes the existing ones out of the way. It has limitations, but makes it easy. The other trick I did not realise initially is I can redraw an existing track in a new direction and it will remove the original part I have now bypassed, allowing more major track moves than "push" can handle, and making it easy to do cosmetic tidy up at the end.

It also does a lovely 3D view, and it seems that not only does its built in library have 3D models for lots of things, most components have them available as standard now. Even complex modules like the Pololu D24V5F3 regulator has one. I was able to add new parts at schematic, footprint, and 3D model without any real problems.

And, of course, it will simply make Gerber files and Excelon drill files, at the click of a button.

It is also rather nice being able to design for double sided with fine tracks - it makes it way easier to track boards and allows me to make a much smaller board.

PCBTrain

So, I sent the Gerbers to PCBTrain. And two days later, they arrive. they look good.


They look nice. They are their quick turnaround product, which is copper with silver, and no solder resist or silk screen, but they work.

I even got good at soldering things like the USB-C connector.


The trick was lots of flux, and a good soldering iron. Tinning the pads first and then just heating the pin to fix it. It takes a bit of practice :-)

Tiny ESP32-WROOM-32 board

My first project to test the whole process was a minimal usable ESP32-WROOM-32 board. The idea was a board with USB-C or DC power, several GPIO on a connector, and built in serial for programming. The challenge was to make a small as possible. I think it came out well.

The result is tiny. But with 5 GPIO pins it is very flexible for all sorts of IoT applications. There is no way I could have made this on a single sided or milled board.

I also made each GPIO have pads for a pull up resistor, or, if powering something from the connector, a zero ohm link. This works well for things like a DS18B20, but could be connected to all sorts of things like an RFID reader, a GPS module, or whatever. It has enough pins that this module could run my ASR33 teletype, and be a lot smaller and neater than the node-mcu board I am using now (so that may happen).

One nasty hack was the USB connector I am using is through hole - as that makes it a lot more robust (their is nothing more annoying with these than pulling the connector off the pads by mistake). To do this I ended up with holes going through 4 of the GPIO pads on the ESP32 module. But it has a lot of GPIO, and they default to input, so no problem, as long as the software knows not to use them. Obviously I had to tell the schematic that they were grounded too.

Another trick was the the Pololu module was not fitted using pins. I could use pins and clip them short, but as it happens, with the through plated holes, just solder down the holes secures it nicely. I only use 3 of the 4 pins, as that would have put a pin through the ESP module pads too, and not in a good way this time. I did have to remember to put a pad under the 4th pin else it ended up on a GND fill which would have been bad.

The end result really is quite small.

FTDI FT230X USB/Serial

The final new bit for me was building in serial for programming. Previously I had made designs using a 4 pin SPOX connector which connected to a serial/USB lead. This takes quite a bit of board space. So I investigated serial USB chips. FTDI seem to be the king of serial USB, and they do a small 16 pin QFN-16 package module, the FT320X. I checked some videos of people soldering QFN packages by hand, and figured I'd be able to.

It is a nice small chip, connects to USB, and provides serial with Tx, Rx, RTS, and CTS as well as 4 configurable CBUS pins. It even has a 3.3V regulator, though sadly not enough to run the ESP32 - that would have been awesome!

There is one small downside - it needs a few passives. That is a pain on a small hand soldered board, and where I am trying to make it tiny (just for fun), so I built without the passives. This will mean the USB is not properly impedance matched. But it is good enough for programming in my tests, and that is all the serial lead is actually for. So what the hell? OK, yes, it annoys me to cut corners even on a fun board and I may try to at least squeeze the 27R series resistors at some point. I am not normally one to cut corners.

However, the small size, and passives, were not the only issue. I decided to connect RTS to the EN (reset) pin on the ESP32. This is a common trick and the tools, like the ESP IDF flash tool, pull RTS low and then high to reset. It is risky in a way as a "normal" serial port will make RTS low when ready for the ESP to send data, but it seems the common tools do not, so it works. What I was unsure of until I tested is that this pin stays high when otherwise idle, and when connected just to power and not a USB driver, and so on. It does. It works. Yay!

However, to program an ESP you need to put in to boot mode, and this means pulling GPIO0 low during reset. Most boards have a button for this which you have to hold when programming. Apparently some do a trick with DTR, including the ESP IDF flashing tools.

Snag! There is no DTR on the FT230X. What is extra weird is that DTR is not one of the CBUS pin modes, so you can't even create a DTR. This seems an oversight as other FTDi chips have DTR, DSR, DCD, and RI, so why are they not options on CBUS pins? Why does this matter? - well a normal serial driver will be able to control RTS and DTR as they are standard pins. To control special pins like CBUS on the FTDI needs code written specifically for the FTDI, not just any serial connection. So not using DTR makes it "special".

I considered just adding a button, but a bit more research has led me to use CBUS0. The problem then is how do you use CBUS0? It has multiple functions (not DTR, sadly), which can be configured.

FTDI EEPOM

The answer is that you programme the EEPROM in the FTDI chip. This lets you set a manufacturer, description, serial number, PID/VID, and a load of settings. One such setting is what each CBUS pin does. One of the options is a GPIO. So that is all I have to do - zap the EEPROM with the right data.

Snag! There is a tool, ftdi_eeprom, that is simple to install on a Mac. But it only lets you set a few things from a config file, and not CBUS functions. And even though it will read the EEPROM to file, it won't just write a file to the EEPROM - it insists on "building" it from your config, even bits you might have deliberately set in the file, like CBUS functions. Arrrg!

So I ended up making a tools, ftdizap, which allows me to simpley set certain (well, any) settings in the EEPROM. I also made it work the CBUS pins when set to GPIPO mode so it can control the output on the CBUS pins directly as a command line tool.

This means I can flash by using ftdizap to set CBUS0 low, then running make flash, then setting CBUS0 high and resetting with RTS low/high. It works on my Mac and on my linux machine. So, simples. A minor tweak to the make file, and I can simple make and flash new code in one go - no button pressing. The make monitor also works, leaving RTS high, allowing debug.

I also set the other CBUS pins to various modes and connected to GPIO on the ESP32. This allows the code to tell if in a "charger" mode, or if simply "not connected to a USB host", or if "put in to USB sleep mode". All of which could be useful in some circumstances.

What next

I already have another board design - this one slightly more useful. It is a small board the same size as a 1.5" RGB OLED display modules (commonly on Amazon). It fits all the necessary components between the board and the display, including a USB-C socket, and the FT230X. It has an 8 way SPOX socket so providing 7 GPIO pins. It has pads for DC power alternative to USB power. It also has pads to allow an SCD30 CO₂ module to be fitted to the back to make a complete environmental monitor. The pull up resistors on the GPIO allow it to be set up for a DS18B20, and the choice of SPOX sockets allows for a 3 pin SPOX plug connected to a DS18B20 to go in to the 8 pin SPOX socket nicely. It should make for a very flexible board.

As you can see KiCad does a nice rendering of what it will look like.

Published?

Yes, the code, and the boards, are all on my GitHub. Just bear in mind that they are likely to have several updates over the next few days.

2021-03-05

Selling a house (week 1).

I had planned to post more details of the house itself here. It has taken a month with workmen doing a lot more than I had planned to make the place perfect (including new lawn, new kitchen floor, several new carpets, and lots of generic decorating). The end result is rather nice.

It went on the market on Sunday, and within hours we had viewing requests. Viewings on Tuesday and an offer on Wednesday, so just waiting for estate agent and solicitors to do their thing now.

Of course there is no guarantee that this will not fall through somehow, so do take a look :-)

https://www.duncanyeardley.co.uk/property-details/jet_duy-BRC210165/binfield/bracknell

At this point it is all down to how quickly solicitors, mortgage lenders, surveyors, and so on, can act. Unlike when I was buying a place, I ensured my solicitor had all of the necessary paperwork right away. I am trying to ensure we are in no way the critical path here. We'll see how long it takes.