Showing posts with label PCB. Show all posts
Showing posts with label PCB. Show all posts

2025-08-05

Trying 0201

I decided to take the step to move some of my PCB designs to using 0201 components.

This is basically accepting that I do not even try to solder these things now. A few years ago I started milling boards and hand soldering 0805, and then 0603. I can just manage 0402 if I am very careful. But no way I could do 0201s. These days I design boards and have them made and assembled and shipped. 

It seems JLCPCB can do 0201, so why not?

What's an 0201

Components have various size designations, sizes liked 0805, 0603, 0402, 0201, 01005 are used for standard chip type resistors and capacitors. An 0402 is 0.04" by 0.02" which is 1mm by 0.5mm. An 0201 is 0.6mm by 0.3mm which is tiny.

This picture gives you an idea - a ball point pen shown for stale (a banana would not fit), and the diagonal square things (LEDs) are 1mm by 1mm. You can see ten 0201 resistors and an 0201 capacitor.

So yes, grains of sand. The 01005 things (not doing those yet) are like dust, and there are some that are smaller!

Pros and cons

With 0402 it is possible to run a track under it, i.e. between the two pads, but with 0201, not so much. That said, I rarely ever do a track under an 0402 anyway. Sometimes larger components.

Obviously some components have to be bigger, and you end up with this crazy mix for capacitors - but that has always been the case - larger caps, higher voltages, mean physically bigger caps. But resistors are less of a problem usually - yes sometimes you need bigger ones, but mostly they can be 0201s.

The main advantage is the space saving - my PCBs are often nice and small, so this is handy.

Now, I know my colleagues doing PCB design also need 0201 caps for decoupling as they need to be physically small and close to components. Thankfully I am not doing stuff that high speed with my ESP32 modules, well, yet.

So far they are working - in that JLC seem more than capable of placing 0201.

Footprint

KiCAD has standard footprints, but interestingly I found this fun article, so trying their suggestions. Some test boards to make sure no production issues - surprisingly JLC has not specific recommendations.

2025-07-24

Updated regulator

I do a lot of circuits, and they all use the same basic design for power supply. OK, technically not quite, I have one for battery and one for USB+DC. But the latter is a basic buck regulator.

I revise the design from time to time and newer and better chips come out and as I learn more.

The latest design is using a TI buck regulator based design using a TPS562246. This is a big step up from the MD8942. The key difference is the old design was 600mA and the new design is 2A.

Do I need 2A?

For almost all of my boards the answer is no, the ESP32 can peak to 500mA with WiFi apparently. 600mA is close but enough. But some boards have other peripherals and you soon find you really want a supply rated over 600mA - even adding just 10 of the small WS2812 diodes can hit 100mA total when fully lit and some of my boards have more than that. Some have GPS modules and a lot more.

Why TI?

They are a well known and competent brand with good data sheets.

Will it make any difference?

The main difference is many of my designs would take a DC input 5V to 35V, and now 5V to 17V. I think for almost all cases this is not an issue. Being able to run off 12V DC or some 13.5V or similar battery based 12V, is what is needed (and I do all sorts of stuff at that level).

I think it will result is less ripple, and allow more peripherals within the power budget.

Fun?

As always, I am learning a lot - finding the right components, the inductor with low enough resistance, caps that work in the required temperature range, careful PCB layout. It has indeed been fun.

So, yes, many of my designs will undergo an upgrade over time.

2025-04-22

Faikin Remote

We have done a lot of small PCB designs over the years, but by far the most popular is my Faikin board. Reports are that even Daikin have recommended it to people wanting Home Assistant integration! It allows control of a lot of Daikin air conditioners over WiFi, MQTT, web, and Home Assistant. Constantly improving, and easy to use with local working not cloud based.

My latest design idea is a rework of a previous "environmental monitor", but specifically targeted at the Faikin users. The concept is that it can be a display and control for the Faikin. Whilst some ducted Daikin have a wall mount control, it is not cheap, so this would work with those and the more typical wall mount Daikin that do not support a wall mount display.

Key functions would be:

  • Display current state of air conditioning unit.
  • Allow change of key settings (power, mode, fan speed, target temp).
  • Remote temperature sensor to allow room temp to be referenced at the controller in "Faikin auto" mode.

But the idea is the board can work with no display as reference temperature or just an environmental monitor for Home Assistant without a Faikin involved.

This is the current board design.

The expensive CO₂ sensor would be optional as it adds over $20 to the cost. Both the tab for it, and the 5 way joystick button, could be snapped off for a purely display or monitoring application.

A Waveshare 2" display fits on the front. Full colour 240x320 pixel. It is designed to fit the header so it can be removed if needed to access WAGOs, etc. The display adds another $20 at least.

User interface

I want to make the user interface simple - anything beyond the basic controls for the aircon you have to do via web interface. That should make it easy to use.

The idea is a joystick allows change of target temp (up/down) or switch to other setting (left/right) and change of mode and fan speed, as well as simple push on/off.

Bluetooth

Whilst it can all work over WiFi and MQTT, my plan is to link to Faikin using BLE as well, both ways. So Faikin reports mode/status, and this advises control and current reference temperature. This should make it extra robust with no need for WiFi or internet to continue working. The plan is a simple announcement BLE, not a connection, much like the many cheap BLE temperature/humidity sensors that exist.

Sensors

The current set of sensors include:

  • MCP9808 Ambient temperature sensor. This is highly regarded as a good temperature sensor.
  • VEML6040 Ambient light sensor (with a night mode to turn off display) including colour.
  • GZP6816D Atmospheric pressure sensor, and additional temp sensor.
  • SCD41 CO₂ sensor, with humidity, and another temp sensor. This would be optional.
  • DS18B20 connection 3 pin WAGO for more temperature sensors.
  • Detecting remote BLE temperature sensor.

All of these would report to Home Assistant as needed, and also report control and one reference temperature of choice to Faikin.

And yes, too many temp sensors, so system will allow a config of which are used and per sensor offset (to allow for heat via PCB). I may even allow averaging of multiple sensors. It will be interesting to see how this all works. DS18B20 are great for adding an "outdoor" sensor to report to HA as well. 

Generic signage

My existing EPD app which is general signage will be extended to handle the sensors as things to display so this can be simply used as a generic environmental display (and HA integration). Indeed this is likely to be the first code I do for these new boards, without a Faikin link.

Packaging

The basic board needs to be sold with and without the SCD41 CO₂ module. The board is likely $30 and the SCD41 adds at least $20 to that, probably more like $30. Not everyone wants CO₂ and humidity. The fluctuating value of the dollar is a pain in this all.

And then I may package with Waveshare 2" display, 8 way 0.1" pitch header, and extra M2 screws. This is likely another $20 or even $30.

Maybe even with DS18B20 sensor as an option. These are quite cheap.

I am not sure I want to do 3D case printing, but I plan a number of STL files.

Tindie makes such options simple, so that is likely the main sales channel initially. We'll see about Amazon as well. Those with A&A accounts will be able to order direct as always.

Update

The first boards (no button) have arrived. I have decided I'll try the TI TMP1075 as an alternative temperature sensor. In practice it seems a DS18B20 is best as it is separate from the board, closely followed by the SCD41. The MCP9808 (and presumably the TMP1075) suffers from some local heating from the PCB. The GZP6816D is close to the ESP32 and so not good at all for temperature (it is there for pressure). The T6793 CO2 sensor is not good, gives silly values (yes, I checked, and this is not a driver error), is bulky, needs 5V (does not work on 3.3V) and is actually not that much cheaper than the SCD41. The VEML6040 light sensor works well, but is a fun exercise for the casework.

Comments

All comments welcome.,

2025-02-09

IronMan

The IronMan project has been challenging...

Basically, we know someone that does IronMan for events and parties, along with others that do Spiderman, and so on.

But the suit he has is somewhat failing - the original electronics failed a long time ago, and the reworks (no idea who did) also failed.

So this is at least third, or more, refit for this, but we have taken it on with some serious dedication I think.

The helmet

The helmet has a servo, to lift the visor, and LEDs for the eyes. We actually replaced the electronics on this twice - initially a simple LED controller, and then a more custom board.

The eyes are now WS2812 LED strips. so way more flexible, even if normally just static cyan.

One of the challenges was the current spikes from the servo - it killed LEDs. Big capacitors is the main fix for this.

The suit

The suit was also a challenge, and really, the stuff in there was a mess. Again, two stages, firstly a simple LED controller for the "arc reactor", but now gutting it all and replacing with custom controller handling multiple LED strips, and speakers.

The previous electronics had several primary cells, a rechargeable battery, and speakers and LEDs. But the speakers never worked properly apparently.

The new build takes a lot less space, is rechargeable, and lasts all day.

The gloves

These were especially challenging. The helmet and suit could accommodate a decent USB battery pack. But the glove are too small, so needed a design that could handle a small LiPo, and charging.

The previous electronics were a simple LED torch fitting and 9V primary cell. This was bulky, and just "lit up".

The new design is a rechargeable LiPo, and 88 RGB LED rings with diffuser, button, and repulsor effect.

Overall

The end result is nothing short of as complete revamp.

Less space taken in helmet, gloves, and suit. Rechargeable batteries in all, all lasting 8 hours. BLE linking so sound effects link to repulsor in gloves and helmet sounds.

At this stage there is concern the LEDs for the arc reactor and gloves may be too bright, and the speakers too loud, both of which can easily be adjusted.

Speakers

One of my concerns was the speakers, and I found these were the best. I tried 5 different types.

From PiHut, and really good.

They are glued inside the suit but sound awesome.

My son should have a video on it all soon.

2025-01-07

Selling cool stuff

We sell loads of stuff, much of the small PCB stuff on Amazon, and even though Amazon as a fucking minefield, and charge a fortune, they still make sense for things like Faikin boards sold all over the world.

We sell very little of the small PCB stuff direct on the A&A web site - I mean we have tried, and many boards are listed and in stock at the office for staff to ship out - but the A&A site just does not have the clout of Amazon.

But I actually get quite a lot of other cool stuff that never makes it to Amazon, or the A&A site, that is mostly not quite a commercial product - it is a result of loads of R&D. We record when we scrap stuff as part of R&D work, but in some cases we make small run prototypes that work perfectly, but they have no good home to go to, and not worth listing on Amazon or the A&A site. In some cases staff get bits.

This can happen as part of trying to evaluate an idea, consider new technology, or on the road towards making a product we do sell on Amazon and the like. Some things are a dead end. Some things have different features along the way to a final product. One recent example was my audio recorder - as I added a speaker driver to the initial prototypes, which are on Amazon now, but dropped it as not sensible to include at the extra cost. Other times are devices that have fewer than the final features, or different devices or configurations (e.g. LED controllers with PDM microphones).

What I need is a way to sell some of these - even if only just above cost price. It is way better in many ways than scrapping or hoarding them. If low quantity I can do shipping myself, and so handle international shipping as well.

What is nice is that payment used to be a pain, but these days we have sold several things (like the ASR33 boards listed on the A&A site) directly with shipping to US, but paid by transfer to IBAN which was complete within hours. So I think it is sane to sell some things.

What I need to come up with is a site / forum to list what shit I have to sell.

The latest, as a good example, is some illuminated coasters. The idea came from making coasters for my Son's wedding, but he has used them in videos on the tok of tik, and people actually asked if they can buy. So I have 10 prototypes. One is staying under my glass here. It may be that when he posts some stuff on these they do sell, he may sell, even. But for now I have 9 more here.

The board, as you can see, if pretty neat, and has 124 LEDs, which could be used for compass type stuff even. Arranged as 4+8+16-32+64 LEDs in rings (yes, the code to make that in KiCAD was fun).

With two spacer boards, and a diffuser, you get a coaster. Of course it runs any ESP32 software like WLED, or ESPHome, etc. It has a microphone even (for sound based effects).

It is cool! I am really amazed with the overall solid disk construction. I'm adding some feet on the base tomorrow.

Now, I think we can sell for £30+postage. Obviously if we made 100s of these it would be somewhat cheaper, except once we list on Amazon and they take a cut.

But for now, I have a few, and it is just an example of some of the stuff I have.

So I am pondering a web site and maybe just an email address, but any other suggestions for how to list these things - low quantity, ad hoc, sales of things?

Suggestions welcome.

And just to be clear - if I can sell stuff (that works) even if around cost, I'll be more happy to keep making these things :-)

Update: Trying Tindie

2023-12-28

Ordering PCBs

Ordering PCBs and assembly is fun :-)

Well, not fun, and to be honest, one of the biggest challenges is the parts selection, what they have in stock or something equivalent, but designing the PCB is definitely fun (well, for me).

I export a gerber files that are the instructions to make the PCB tracking images, and also a BOM (bill of materials) and position file, for placing the parts.

I have done this many many times with several PCB manufacturers, and lately with JLCPCB, which seem to be surprisingly quick and sensibly priced (apart from the odd quirk). I'd love to find a UK company as cheap and easy to use, I'd use them.

The PCB printing has a few design constraints, the gaps between tracks, minimum track width, and so on, which relate to the optics of the process for printing and drilling the board itself. But apart from that the PCB is printed exactly as expected.

Well, until now.

This is what I ordered... (this is an image from their order history page)

And this is what arrived...

It took me ages to debug it - tracking down that the CPU was running way too hot (burned my finger) and not quite right. It turned out it was running on 4.5V not 3.3V. The shorts there short input to output on a regulator circuit and I was testing from 5V USB via a diode. If I had tested 12V it would have made smoke, I expect.

The thing is the order process involves a lot of steps, and each step show the PCB you are making.

  • When uploading the gerber files
  • When selecting assembly and it shows the bare PCB
  • When showing PCB with parts
  • When order complete and preview of PCB
  • When order complete and preview of assembly
  • On gerber viewer on the site from their order confirmation

At every stage they show the circuit correctly, but the final PCB was faulty.

I complained, and they advised: "We have reflected this issue to our engineering team and JLCCAM software team and they have found and fixed the issue just now, and there will be no the same issue next time, so don't worry about it."

They even provided an image of the error:

Next step - refund!

My view is simple.

  • They made an error in printing the PCB.
  • Arguably they made an error with the flying lead test of the PCB not spotting the printing error.
  • They then made the PCB with parts that cost money - either of the above errors not made would have avoided that.
  • It was not, in any way, my fault.
  • I did not get what I paid for.

It is simple. I should not only have a full refund, including shipping cost, but ideally I should be compensated for the hours of debug, the delay in getting working boards, and the cost of disposing of the WEEE (defunct PCBs and part).

I'll be happy for just a full refund, and either they pay for courier to return boards, or I dispose of them (at my cost). As I buy loads from them, I'd even allow for it to be a credit on my account rather than an actual refund.

I have a funny feeling they will try and weasel out of this - and then I may have to ask Amex to intervene. It is for two separate batches of boards (from 4 I ordered, 2 of which were fine) totalling over $470.

Watch this space - I'll update with news.

Update: They do seem to be trying to weasel out of out - that PCB manufacturer is separate from supplying parts and assembly - but the parts they supplied are useless to me as supplied, so not reasonable that I pay for them, surely? Indeed, I have offered to send the parts back to them (at their cost). We'll see how that goes.

They suggested I try and isolate the track, but this is cutting through soldered pads, so when I put the components back it will short again!

Update: They are being counter reasonable. I suggested I could maybe find someone to rework - they suggested I try, and get a quote. I may try and get a quote.

They also think just cleaning solder would be enough to avoid shorting with the component leads when cut like this...

Update: I have decided instead to offer a compromise on basis that on one board I can re-use the SCD41 sensors they have supplied. Pushing their offer $50 more on each set of boards. We'll see.

Update: We have credits now.

2023-11-28

No No-bell prize

I wanted to improve our doorbell... Yes, that is dull.

But the main change is not the bell (a nice, old style bell in the kitchen, which is driven by a Shelly, and the sitting room, and flashing lights in bedrooms and hot tub), or the bell push itself as such, but a sign on the door by the bell.

We used to have a simple brass "please ring the bell" sign, pointing to the bell push. Still, too many people knock instead.

Push the button

So the idea is a sign, and additional bell push right by it, on the actual door. The sign has the house name and number and road name - that itself may help as we get parcels for the same number in the next road often, and they get ours. But a sign saying ring the bell with a hand pointing to the bell push right by the sign.

The magic happens when they push the bell (either the new or old bell push) - the sign lights LEDs on the back and changes. The basic option is like this...

I included a barcode with date time and postcode for photos when leaving a parcel.

Seasons greetings

I also decided it may be a fun idea to change the message, add Christmas tree for now, and so on, but even regionalise the message...


The idle message can be updated and made seasonal, I may even automate based on date, but also the message shown when you press the button can vary depending on circumstances. This saves me putting a sign on the door when we are out - which is a notice to everyone that we are, well, out. The message for when we are out ("leave parcels behind the double gates") is only shown when someone pushes the bell. Indeed other messages can be set if needed.

Let there be light

The main way it decides what to show is based on lights. Yes, that seems crazy, but is incredibly simple when almost all lights are Shelly running tasmota and reporting to MQTT. I can track light states. I have a stairs light which only gets turned off when the alarm is set (we are out). I also track the hall light, which is an easy way I can indicate "we are busy, leave by the door" for when I am in the hot tub, etc. Indeed, if I change a light when the message shown updates in real time, so if in the hot tub I can remote turn off the hall light from my phone when the bell rings.

I also have Mastodon DMs for the bell, with exact time stamps to make easy to find in CCTV.

It also means control of the status display is something my wife can also easily understand and change if she wants, just using light switches.

Making a board

Obviously I designed my own circuit board for this. It works with a waveshare 7.5" e-paper display.


It sticks to the back of the board, has an ESP32-S3 with wifi, USB connectors, and big solder tabs for wires for power and the bell itself. It was designed so it could be set in resin even (though that seems to break the e-paper, possibly by getting in the FPC connector). So a bare board with acrylic spray for now.

No-bell prize

It did not work. The screen did not update properly. I was disappointed to say the least.

Old
New

The fix was to change the inductor and make it work, yay, no no-bell prize for me now.

So, finally, it works!

Update: The only reason this board is this size is because it has LEDs (one in each corner) do fits the 7.5" e-paper. If not then it could use a much smaller board, which I have also designed. But the new version of this larger board now has 24 LEDs, given that the LEDs are the only reason for the larger board this makes sense, but it may be a slight power issue as they are 10mA when white, so some testing may be necessary.

Update: I love the fact I have been accused of "nerd sniping" Bloor. He got one of these 7.5" panels with the waveshare HAT, and somehow he totally messed up the simple task of the FPC connectors, so much he broke several of them, and then managed to crack the display trying to get one working, and threw it all away. I come in and not only have no problem with the connectors, but then I don't just use the 7.5" panel and HAT with no problem, but make my own better PCB, and a new smaller PCB, and a version 2 of both boards, and a working door sign, and now even listing on Amazon! Is that "nerd sniping", or am I bad?

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-06-29

Pipelining

I am reminded of years gone by when "compiling" would take a long time, even hours in some cases.

This lead to a "pipelined" debugging and development cycle. By the time what you did was compiled you already had fixed a load of bugs and added a load of new features that needed testing. So you had to test things from the compilation as they were when you started. Sometimes you just knew the compilation would create something broken, but some other aspects would be things you need to test, so you let it run anyway to test them. You had to make code that would include things you need to test in the best way possible.

I am sort of doing that with PCBs over the last week or so - getting a new PCB takes slightly over one week from China.

I have been working on a load of small changes to various designs.

  • New 5 pin pad for programming - I made a larger set of holes as the ones on my last batch were annoyingly small and have to be held in place while programming. This is one I finally have back prototypes and my new design is too big and loose, FFS.
  • New New 5 pin pad for programming, staggered more than last time to allow pins and hold them whilst programming - waiting - works perfectly
  • New voltage regulator - waiting - and I really hope it is right as I have several in the pipeline with no fallback - one version works nicely (the cheaper one), the other (tantalum cap) does not work.
  • New USB UART - got a board, discovered I cocked up - but was able to rework some and test the correct design - some boards were able to be used anyway
  • New New USB UART - fixed layout/design issue - waiting - working
  • New RGB LED - waiting, but already spotted that I have cocked up and got G and B swapped, FFS. This means the resistors will be wrong for the colours as well. May be able to rework when this arrives.
  • New New RGB LED - waiting on revised, but still not been able to check if resistors right - waiting - working
  • New panel design - i.e. making part in a 70x70 panel instead of JLC doing it, and if a barcode is clean in silkscreen - waiting - looks nice but JLC being a pain
  • New Tx on Faikin, open drain output - waiting - working
  • New Rx pull to 3V3 on Faikin, detect loopback - waiting

The whole thing is frustrating. I have had to scrap one set of boards sadly because of the CH340X issue. Others I was able to rework, or remove and use a 5 pin programming header instead. One trick is making a new board that you can "fall back" if the new bit does not work.

The RGB LED is a pain - I used one (side mounted) that worked nicely because they did not have the simple one I got from Mouser and used for my hand soldered boards. But JLC places it badly (over 10% of boards needed rework). And I found they had an equivalent simple front facing RGB LED with low enough voltage on the blue for 3.3V working. The issue is the resistors - you can work out values - as I had originally but then find green is way too bright. For my manual working I had changed resistors and so am trying those values to start with. But until I get them, and get the G and B right, I will not be sure I have the right resistors even if I have the right colours. I may have to rework some 0402 resistors to test when they arrive.

On top of it, DHL, who have managed around 2 days from China with no VAT issues, have suddenly made it 3 or 4 days and not doing proper VAT with postponed VAT accounting - that will be a fun argument as I am planning to refuse to pay and insist they re-do as PVA. We will see.

Also JLC being odd on rules, insisting multiple designs on a board even if only in solder resist. Still not resolved. Even if I end up making panels with no extra silkscreen, at least making as panels myself, instead of leaving JLC to do it, lets me make cleaner slots and edges on the designs.

I have to test if the barcode in silkscreen works, and is acceptable (inside a nearly clear, slightly pink, anti static bag) with Amazon - so avoiding having stickers.

So a very frustrating week, and another such week to come.

2023-06-28

JLCPCB and fun rules

I am using JLCPCB for my small boards. There are other places, but they seem reasonably sensibly priced, have a good automated ordering process, and are quite quick.

However, I have been trying to do something clever, and that is always a bad idea.

If I have a small circuit board, and want assembly, they will make it in to a small panel, e.g. 70x70m, with "rails" top and bottom, and V-cuts. This means when you get it, it snaps out of the 70x70mm PCB. The rails have some holes and fiducials.

As it happens, I am shipping (to Amazon) as a 70x70mm panel. This is partly because it fits better in a small anti-static bag, and partly to make clear it is sold as a component, an assembled PCB, and not a final product with UKCA/CE, etc. As it happens the main module is CE marked, with a RF can, and the only extra bits are normally just a small voltage regulator, so getting UKCA/CE marked should not be too hard one day, but for now, these are hobbyist projects.

Anyway, the 70x70mm panel has loads of wasted space. JLC add an order number (unless you pay them extra not to), but other than that, just unused blank PCB, a few holes, and fiducials.

So I decided to try and make use of it - make the 70x70mm panel myself. They allow this and have instructions for where to put fiducials. They also seem to want some holes and instructions seem to be lacking for those, but I copied what they did. However, this created a few challenges :-)

V-Cuts

The first problem is the V-cuts are cuts in to the board at the last stage, and always go right across the board (they explain this), but can go any direction (well, at least up/down or left/right). These allow the small PCBs to be snapped out. Some extra milling around bits of the PCB that are not simple straight edges allows other shapes, so works well.

For example, this is what they did when ordered simply as a tiny PCB. Four V-cuts to snap out.

KiCad

Firstly, how to tell KiCad. I cannot simply put these on the Edge.Cuts later as it would break the board outline - KiCad would fail DRC and not show the board on the 3D view and so on. So simple answer is a separate layer, easy enough.

But then KiCad does not know, for example, that tracks and copper fill should not get too close to these V Cuts. It knows for edge cuts, and so one can have milled slots for non rectangular edges, but the V cuts are not seen.

My solution was to make a footprint that is a 70mm V-cut.

  • 70mm line on User.1 layer as the actual V-Cut
  • Line on User.Comments and Fab layers to more visible
  • A courtyard for 1mm above the V cut on one side
  • An exclude for 0.2mm either side, front and back

The exclude keeps tracks and pads and so on away, just like Edge.Cuts.

The courtyard works on the basis that you have to bend the PCB to snap it, and that could be up or down. I have parts that hang over the edge (the antenna of the ESP32 module, etc), but by adding a courtyard one side I ensure I cannot accidentally have things hanging over the edge both sides. I have to flip the V-cut footprint to fit, but it allows a sane DRC.

Telling JLCPCB

This took a few attempts to get right.

For a start, I updated the JLC-Plugin to export an extra file for V.Cuts - I just added to the config file, and it exported. The problem though is that, even as a file called V_Cuts, it shows as a User.1 layer when viewed, and apparently this would mean adding a note to the order so they don't miss it. I don't trust myself to add a note.

However, after a few emails back and forth, I found that what they really wanted was V Cuts simply included in the Edge.Cuts file. It breaks some of the preview stuff as not a joined up border, but it is understood by their people it seems, and won't be missed.

I have done a MR on the plugin to include the User.1 in the Edge.Cuts file as part of the export, so I don't have to think about it.

Extra artwork on the panel

Adding extra artwork to the panel was pretty simple - just more silk screen. What took slightly more work is I wanted a barcode, and so made a tool to create a KiCad barcode module.

Then I ordered.

They I got a "we want $50 more" response. They said it was 3 designs. Actually, by their rules it was 5.

FFS

So, the rule is, if you have parts that detach, and they have any traces or silkscreen, they are treated as additional "designs" on the same order, and there is a surcharge for each extra design. So even a "design" that is just text on silk screen has a surcharge.

Simpler

A simple step was only silk screen on one of the unused parts, that made it 2 designs. So progress.

The problem is that the surcharge, whilst only $2 on the PCB manufacturer, they also surcharge the assembly, by around $30. Now I have queried as, even if there are 2 designs, I only want one assembled - the one with components on it.

It may be possible to order PCB as 2 designs and then order assembly as 1, but I cannot see any way to actually do that, sadly.

Solder resist

Another trick may be to avoid the multiple designs by following the rules. The rules cover tracks and silkscreen. Well, it seems we can do solder resist. Using this on an FR4 board with black solder resist may well have enough contrast. Even more so if copper fill and ENIG finish.

It needs more testing to see what resolution and contrast is achievable.

The latest attempt...

This is 2 designs because of the silk screen. But testing they agree with that by having the solder resist at the top as well.

Update: They magically decided this was 5 designs so I have challenged as "solder mask/resist" is not something they list as creating extra designs. We'll see...

Update: They seem to be doubling down on the "5 designs" still. I asked if the rules have changed?


Update: They are sticking to their rules, but making up bullshit for them, saying that they have to "load two programmes" if it is two designs. This is clearly bullshit, but I have challenged on basis that they do put their order number on silkscreen on one of the snap of panels, so extra silkscreen on that panel will be no more work, will it, as they are "loading two programmes" already, for their order number. We'll see.

2023-04-14

Industry standards

There are many industries that have various industry standards. These are often relevant to the internal workings of the industry, not something customers see, and help then industry work smoothly as a whole. This is particularly important when various parts of the industry need to interact with a range of suppliers and clients. Sometimes the standards are based on standards bodies or even a regulator, sometimes industry bodies, sometimes simply the de facto standard of the major player.

But sometimes when you get under the hood you can be shocked to find a lack of industry standard where clearly one would be both obvious and simple.

Now, when I explain this latest craziness, I know, for sure, someone will come out of the woodwork and say "but there is standard X". The problem is that whatever standard here may be it is clearly not widely used in the industry as yet.

Also, when I explain this latest craziness, someone will say, "Why not just make a standard then?". Well, see xkcd/927. Obviously I could propose a standard - this is a very simple matter, but there is no way I could get it adopted. I'd go for all in one JSON file to be honest.

PCB Assembly files

The issue is PCB assembly files. I am (personally) quite new to this, and discussing with my colleagues that do this for a living they are "Oh, yeh, it is crap, there is no standard".

What is needed...

When making a printed circuit board, and adding components (assembled PCB), you need a few things.

  • The actual artwork for the printed circuit board - several bits, such as the copper layers, the solder resist, solder paste, the silk screen, the edge cuts, the drill file.
  • The details of the components you need placing on the board
  • The details of exactly where those components are to go on the board

There are actually a load of other things, some of which are fabricator specific, like PCB thickness (and number of layers, and material), solder resist colour, silk screen colour, copper thickness and finish, and various production options. If an extensible standard existed (e.g. JSON or even XML) it could include a load of "common" attributes and allow for custom attributes, and so allow ordering a PCB to be literally loading one file. I have been caught out forgetting one of the many options before now and managed to get a board the wrong thickness. My PCB package knows the thickness but has no way to include that in the production files.

Artwork

The first part does seem to be pretty standard, though it sort of evolved, but now is quite good - GERBER files and drill files all in a zip file. There are several options and versions, but in general these really "just work". Even details like whether coordinates are based on inches of millimetres are standard headers in the file now. It seems a variety of de facto / proprietary standards have congealed in to something pretty common at last.

Picking components

Picking the components is the area I would expect to be complicated, but I was quite surprised. My experience here is of two PCB fabrication companies, one in UK and one in China. To my surprise, in both cases, they were able to track down components quite easily.

The basic parameters of "Manufacturer name" and "Manufacturer part number" seem to cover it very well, but even without these - even something simple like calling a component "5k1" and stating a package of "0603" will get you a standard tolerance 0603 package 5.1 kΩ resistor. Indeed, on one occasion whilst trying to find the part for an inductor, I totally failed to find it on the parts site, but it turned out that simply putting the value and package "4x4" found one that I failed to find.

Comma Separated Value

One of the issues is the file format, something obvious for standardisation, seems totally arbitrary. The only common factor seems to be the use of CSV files.

In one case the web site allowed me to load the CSVs from the PCB drawing package, display it spreadsheet style, and then let me select which rows are which things (Bill of Materials, and Positions), and then select which columns in those rows are things like "Manufacturer name", "Part number", and so on, with some level of pre-guessing in place. This is a total faff as every time you load the files you have to go through this process.

In another case the fabricator specify the exact set of columns to use for each file. This has the advantage that if you can make a script to make the files, you don't have to fettle them when using them. But the exact layout is unique to that fabricator, not standard.

Position

This is the one that really gets me. The Bill of Materials has the details for what parts you have, as I explain, but then you need to say where they go. There are not many details for each component.

  • Side (top/bottom)
  • X / Y position on the PCB
  • Rotation

The side is usually text "top" / "bottom", so simple enough.

The position is, it seems, usually, "as viewed from top", but could be in millimetres or based on inches, and will have an origin somewhere. It could also be Y going up or Y going down, even! It seems obvious it should actually use the same origin and units and direction as the GERBER file, but does it?

The good news is that this does generally seem to work, the actual position does not seem to go wrong, though there have been cases where negative values break things. It also seems that fabricators can work out your origin and units based on how components hit solder paste / pads. But if there was a proper standard this would a be lot simpler.

It seems rotation is more complex, and whilst it seems "degrees" are a standard I found that whether it is "as viewed from top", or "as viewed from above the component" is a thing. I use a plug-in for KiCad (PCB design package) to make the files for JLCPCB. The fact a plug-in is needed just highlights the problem - why is there not a simple common standard for this! The problem is, I have now found, that the plug-in uses rotation "as viewed from top", which is what KiCad uses, but JLCPCB seem to need it to be "as viewed from above the component". I have had to fix the plug-in.

You may wonder how this could happen? Surely it would be noticed. Well actually it is not that simple. A rotation of 0 or 180 will be correct on the bottom layer anyway. A rotation of 90 or 270 will simply reverse the component, which, for many, does not matter. Other rotations are less common. The ones that do matter, like diodes, and ICs with a pin 1, have to be manually fettled anyway, so it is not obvious they should not have needed this just because they are on the bottom. This is such a common issue that JLCPCB even have a standard service to check pin 1 is correct and propose corrections.

A good example is something so simple it needs no adjustment, a resistor. This is two resistors at 10 degrees rotation (as viewed from top), and sent to JLDPCB with a value of "10" in the rotation.




No standard within components

You may wonder why you may have to fettle the positions anyway, hence not noticing the bug. Well the reason is that there is, apparently, no standard for how components are "placed". Even though data sheets for components normally have detailed technical drawings showing the exact dimensions and outline, and even 3D models these days, there is no convention for component manufacturers providing an "origin" on their drawings, or even a "mid point", though "mid point" is at least something you may be able to work out on many. There is also no standard for which way is the "un-rotated" orientation of the component.

What is even more fun is that a component usually has three possible origins for its positioning, and some fabricators use different basis. Some may even use Mid and Pin 1 to define orientation, which is fine until pin 1 is in the centre of the device?

  • Origin - some point on the technical drawing as a reference point, e.g. bottom left.
  • Mid point - this at least is likely to be something you can work out for most components
  • Pin 1 location - this is less simple - is it the mid point of the recommended SMD pad for pin 1 maybe? Or maybe the centre of the dot on the package marking pin 1?

This means that each fabricator makes up their own rules, on a per component basis. So you need a way to mark an offset X/Y and rotation on each component to match the fabricators rules. They are not even consistent - you would think a standard package, such as a small 8 pin IC, would always be the same orientation, but even that is not the case, even within one fabricator, it seems.

The big clue that the plug-in was wrong was that moving a correctly adjusted component from top to bottom broke it. By correcting the rotation on the bottom, it is now possible to make these "adjustments" part of the footprint for the component, so that whenever you use it, it will be placed correctly.

P.S. Don't get me started on poor quality technical drawings - i.e. those that are dimensioned with just slightly too few dimensions to work out all necessary points.

P.P.S. Don't get me started on poor quality 3D models. They look good, and many are stunningly accurate, and very useful, but they have an origin and orientation - this too is arbitrary, and often does not even have Z axis as "in/out of PCB when placed" - using these means manual fettling every damn time. If all components had a defined reference origin and orientation it could use that for the 3D model as well. Oh, and I have seen lovely detailed 3D models that actually do not match the footprint so look wrong!

2023-01-19

Assembled PCBs from China

I have been using JLCPCB to make PCBs for a while. This is for some of the smaller PCB projects at A&A (here), rather than the big projects we do for FireBrick. It means I am learning a lot.

This month I decided to try and have some "assembled" PCBs done. They have a quite nice ordering page allowing you to view the assembled board. This is important as it seems components have no standard for the reference point, nor rotation, and it varies from PCB manufacturer to PCB manufacturer. The tool I found for KiCad is excellent (here), but I did have to make from the GitHub page, rather than using the library/plug-in manager, as that was out of date. Importantly it allows me to add "offset" and "rotation" adjustments needed for placement of parts. That way I can make working production files in one click, which is amazing.

The big challenge in updating various designs was finding parts - the parts they have available readily, without ordering in, are all very similar to what I am using, but often I have to hunt down the right part number. In one case I found that an inductor was not available in the same package, only to find it was if I did not add a part number. Somehow their search found it even though I failed to. The bigger annoyance was the RGB LED I am using, which is low enough voltage to work from 3.3V. They had a load that are the same footprint even but not the low power and low voltage. I ended up using a different part, different footprint, and even sideways mounting, meaning changes to layout, albeit minor.

I still have to work out how to handle some missing parts - the SCD41, for example, around £30, but they (a) have no stock, and (b) list as $150. So that would not be fitted, and I would have to fit. I am wondering if I can put on the soldered pads with some flux and run through the oven I have. I'll have to test that.

However, for the first board to test the process I ordered the simple Shelly Tasmotizer (here). It does not have a processor, but does have two hand soldered connectors, which was also a good test. They ended up costing £19+VAT each, for a 10 off run, including shipping and assembly and parts. They get a lot cheaper if you order more, of course.

They arrived, and, well, just work. They look really neat. I am impressed.



2022-06-29

The round one

As previously blogged, I created an NFC RFID reader based on the PN532 NFC chip.

It works well, and includes red/amber/green LEDs and tamper switch and even contacts for a "door bell". This makes it ideal for access control.

But I decided some cases may look better with a round modules. So I wrote code to measure track lengths in KiCad PCB files, and then code to make a spiral track, which I made the same length, and then made a round version of the same thing.

It works. It worked first time. Indeed, the solder paste and cook worked first time - no re-work - no glitches - just worked. I am really pleased.

One of the small tweaks was around the reverse mount LEDs which used to tombstone in the oven - that is all fixed nicely now.

Other changes are that the connectors are all SMD now to make the other side "clean".

Which leaves me wondering if I should add a logo or something on that side. I am really not sure. I also think purple solder resist may be nicer. The main thing is I want a distinctive appearance / brand that can compete with elechouse on Amazon. Suggestions welcome.

Of course, what is super frustrating is that these are all prototypes - I cannot really make commercially until the global component shortages are sorted and I can actually order 100 of the PN532 or indeed anything else! Once sorted, I plan to put these on Amazon.

2022-05-19

Not using solder paste?

I made the mistake of ordering a board and not ordering the solder paste stencil.

So what to do - well, not a complex board, I tinned the pads and applied some flux as it is a bit sticky...


Then I applied the components. Now this is where I wish I had applied less solder to make it flatter as they did not stay put very well.

Getting flux on the tweezers was also an issue, so lots of cleaning.


Then I cooked in the oven the same as if I had solder paste.


To my utter amazement, it worked perfectly. I did put in a sonic cleaner, which did not help much in cleaning it up...


However, a nylon brush and some IPA, and bingo..


But the damn board works!

So there you have it - an option when you have no stencil!

2022-01-30

More on KICad 6 and PCBs

I have been updating all my PCB designs to allow for using the more commonly available LMR16006 with variable voltage, rather than the fixed 3.3V regulator. All done now.

But I have also made a couple more boards.

For a start, an ESP32-WROOM-32 board with more GPIOs. The previous generic board was this.

It has 6 pins, GND plus 5xGPIO with some links. I have updated the silkscreen to have GPIO numbers all over the place as it is a pain to find them on older boards if not printed on the board!

But I decided a more powerful generic design may be in order, so did this new one today...

This is a tad bigger, but 16 GPIO pins. Yes, one each side is pre-linked to GND, but can be cut. And options to link to DC supply or 3.3V are always useful. Again, an RGB LED on board. And I have labelled all the GPIO numbers. This should be useful.

But this has been a busy weekend, and I have also made this...

Now this is a fun board, an interface for an ASR33 using 20mA current loop. It uses some simple ICs that are aimed at providing fixed current driver for LEDs, but seem ideal for this use. For avoidance of doubt this is not the same as 4-20mA current loop used for some control systems (an analogue signal level), but a simple make/break on 20mA, and used for teletypes 50+ years ago.

All of these will be a little over a week to arrive, so fun to test when they get here. I'll post more, specifically on the ASR33 board, once I have them.

To be honest I am amazed how easy KiCad makes it to just knock out a circuit design, do PCB layout, and be all ready to order actual boards.

2022-01-04

KiCad 6

I am using KiCad for PCB design, and it is pretty impressive, but KiCad version 6 has just been released.

There are lots of small changes, but all good. So I checked all my designs. Some tweaks were needed.

One of the nice things is I decided to look in to was making curvy tracks - mainly for the RF board I have - the PN532 NFC/RFID reader. RF is still voodoo, so no idea just yet if this is going to be an improvement or not. Hopefully the changed boards work just as well, if not better.

PCBs are like works of art, and a bit like coding, they can be tinkered with and fine tuned over and over again. KiCad caused me to start this again.

One issue was my antenna design - a simple loop. Previously I could fudge a "line" in copper on a footprint, and as long as the line did not cross the centre point of a pad it was not spotted by the DRC. The new KiCad does spot this, and so spots the antenna is a loop that shorts things. Well, antennas do that! I have yet to work out a way to tell it that this is a special case. So I worked around it.

What I did was make the 0603 links to the antenna part of its footprint. This means the loop can be a pad design with no pin name/number, and the other end 0603 pads (usually a 0R link) are the connection to the antenna footprint. That way it can pass DRC.

But the tinkering continued...

  • Removed the separate 0.1" connection pads as they fit in the 2.5mm pads and it means less copper near the antenna.
  • Re-tracking with curvy tracks and moving some away from antenna.
  • Changing layout so the RF Rx line is "cleaner" in that it has more space around it leading in to the PN532 and no ground plane under it.
  • Changed silkscreen - cleaner - indeed the "face" has no text. Removed the component designators as they are just clutter. Various tidying. Trying to make it look "distinctive" - did it work?
  • Changed LEDs so instead of abusing normal SMD LEDs and fitting backwards (face down) I have actual "reverse mount" LEDs instead. This should mean it is possible to use in a pick and place machine.
  • Cleaning up the BOM so I can actually get a quote for sourcing and assembly.
  • I hope you like the "eyes" :-)

We know these boards work well, and all of these tweaks should do no harm, and may even improve it.

So what next?

Well, I have the reverse mount LEDs coming Thursday, so I can work out the right resistors as they are higher current - also making sure the PN532 can drive them OK. I will then get some PCBs made to test all these changes - probably an express order PCBTrain to arrive Friday.

Once I have the PCBs I'll know if the new layout works as well as before, and if the LEDs work properly and so on. The 3D case design does not even need to change!

This leave the real next step - I have a BOM that loads OK on PCBTrain quoting tool, and gives pricing. I need to talk to them as it seems more for components that direct from Mouser, but I am sure that can be sorted. As with most components there is a shit lead time, especially for the PN532 chip. It does look like it will be not as cheap as I would like, around £30 a board assembled on small ish quantities (100), maybe £20 for 1000 off. So I am interested in if people want this. My plan for now is make some and sell at cost on Amazon.

They are a cool device for any hobby project and unlike some of the other PN532 boards they are designed to be used for access control, with tamper switch button and traffic light LEDs built in, and a small 40x40 size. Also, unlike a lot of others, they have BAV99 diodes to provide more ESD protection of the pins and LEDs.


Update: Parts came Wednesday - the new reverse mount LEDs work nicely, as does replacement crystal (as one we were using is not in stock). So new board design has been ordered to test the RF side, expected Friday.

Update: The new board works nicely, so proper boards with solder resist and silk screen are due in a few weeks.

QR abuse...

I'm known for QR code stuff, and my library, but I have done some abuse of them for fun - I did round pixels  rather than rectangular, f...