Graeme's Build Log

Hi all,

My electronics journey has taken many twists and turns over the years. It all started, like so many others, with an electronics kit in the mid 80’s. I gradually progressed to University and completed two years of E&EE but, like so many others, it didn’t click for me. I drifted between various IT jobs and then worked as a hydro-acoustic engineer for several years. I then became a technical training instructor for offshore process control, safety and automation systems (I found the Meta-Learning podcast particularly interesting). I am now handle special projects for a company in the hydro-acoustics domain again. This involves some PCB design work, mostly interfacing various systems using microcontrollers.

A reasonably complex, successful, project last year paid for my nice new (if small) lab. Everything I know about PCB design has been learnt from a vast array of different sources, along with a lot of trial and error. I figured it was time to try and consolidate this into one source and also brush up my electronics knowledge at the same time, so that is why I am here.

My last personal build was a ESP32 connected to a 4" Touchscreen TFT. I use it as my light switch and energy monitor for my lab. It works well, or at least it does after I figured out I had the auto-reset transistor pads back to front. Flipping the transistors upside down fixed that, but it’s that type of silly mistake I want to avoid, and by having to think less about design basics should increase the time I can spend checking and double checking everything. At least that’s what I’m hoping.

All my PCB design up to this point has been in Eagle. I’m keen to get to grips with KiCad since Eagle is effectively dead, and I don’t see the transition to Fusion being completely usable for some time yet.

I am currently awaiting delivery of my Getting to Blinky PCB and also another slightly more complex PCB (which had to be rushed for various reasons beyond my control). I’m fairly confident Getting to Blinky will work out of the box, the other one I think has a 30% chance of all sections of it working first time.

I have several projects in mind to complete hopefully before the year end, but I think the one I would like to complete at the end of the Contextual Electronics course is a breakout for my recently acquired GPSDO.



Welcome Graeme!

This sounds like a wonderful early project. It’s amazing the chips that are available these days and the projects they enable.

Update (Part 1)

Purpose: Follow CE video to create first PCB in KiCad.

First impression when I received the PCB was that it looked like expected and checking under the microscope didn’t reveal any obvious deviations from the original design.

Construction was straightforward and upon inserting the CR2030 the PCB worked as intended. No other testing was carried out,

Since this was a simple board to construct, with several different footprints to deal with, my partner constructed the second PCB (on the left). She had only ever added a few 0805 resistors to an old PCB, and has no other soldering experience. It took her slightly longer, but she got there in the end and did a remarkably good job. The most important part - the board worked first time.

All in all a successful first KiCad project.

1 Like

Update (Part 2)

Purpose: Multi-application project.
Application 1: Read remote NTC thermistor, output temperature over RS232 and USB. Temperature to be displayed on OLED. Ability to compensate for cable resistance in software. Powered via USB.
Application 2: Handheld device to read sensor battery status over RS232. The sensor islocated in extremely harsh environment, so utilises wireless charging in order to allow sealed enclosure to reduce the likelihood of damage to the electronics.

First STM32 based PCB.
Using MAX3250 for isolated RS232 communication
Not using a FT232/FT231 for USB communication
Using a rotary encoder in a real project
Wireless Charging
Using the TPS63020 for 3.3V boost/buck regulation
Using the MCP73833 for charging
Using MAX6682 to read NTC

First build of this PCB. Due to various reasons beyond my control the PCB was pushed to manufacture before a full validation of the schematic and layout. A case of how much is going to work, rather than expecting everything to be perfectly working.

Summary of Testing
Prior to delivery of the PCB, when I was ordering the rotary encoder, it became evident that I had two of the pins (B&C) reversed. Mistake #1.

Initial inspection, under the microscope, of the PCB showed no obvious deviations from intended design. Other than the holes for the OLED do not line up with PCB. Normally I 3D print the PCB to check fit but alas I relied on the datasheet. Mistake #2.

Power was connected to USB. No magic smoke. Output from voltage regulator showed, steady, clean 3.40V.

Programming STM32 was successful. PLL frequency set to 48MHz and master clock output enabled. Checking clock output on frequency counter showed 48000000.17Hz. Crystal loading circuitry would appear to be correct.

OLED added. Worked as expected.

MCP73833 Status pins read successfully.

Added battery with multimeter in series to read current. Battery charging at ~200mA as per design. No excess heat on PCB. TPS63020 showing no deviation in output under load.

Internal Battery ADC tested. Required increasing STM32 ADC samples but otherwise reading accurately.

USB communication failed to work. On checking data sheet for STM32 a 1.5K resistor should have been added to pull up the D+ to 3.3V. After adding a resistor USB communication worked as expected. Mistake #3.

Battery No. 1 fully charged and MCP73833 shutdown as expected.

Wireless charging coil connected. Wireless charging worked as expected.

Disaster #1: now unable to program STM32 (device not found). Regulator now showing 6.3V output.

Components added to PCB No.2 - completed above testing with same result. Did not connect wireless charging coil this time.

Low voltage shutdown (3V) detection working as expected.

MAX3250 RS232 transmit and receive tested OK up to 115200. Not expected to be used above 9600.

MAX3250 Shutdown and fault detection tested OK.

Checked isolation - extremely high resistance between VCC’s and GND’s as expected.

Button input - not connected to 3.3V plane as per design. Eagle has done something weird here. Connecting wire between button and 3.3V leads to expected behaviour. Mistake #4.

Checked communication with MAX6682. All tested OK. Checked linearity of reading using precision variable resistor. Calculated 7.1C offset correction needed. Excellent linearity between expected usage range of 0C and 10C. 1.2C drift at 25C. May add LUT of corrections.

Standby current measured. Unable to get current lower than 14mA. Checked by disconnecting various components and discovered that by measuring the state of the MAX3250 shutdown pin with the oscilloscope the current usage would drop to 230uA (without OLED). Connected 10K resistor between shutdown pin and gnd. Standby current now 230uA, and MAX3250 still working correctly in normal usage. Guessing that there is a very small amount of current leaking from the STM32 in standby mode therefore the signal needs to be actively pulled low. Mistake #5.

Rotary encoder hardwired to correct mistake #1. Works as expected.

Tested with actual real world sensors. Works as intended.

Application #2:


Overall I am happy with where I got to with this attempt. Apart from disaster #1 I have been able to test all the significant parts of the board and shown that it will meet the needs for both applications (and others). I still need to investigate what happened with the first PCB, however the second one has been working perfectly for the last almost two weeks. It may be that I add a second USB connector for the wireless coil to attach to with a zener diode to protect against transient spikes (my guess as to what happened) In the next revision other than the obvious mistakes to be fixed I think I’m going to add a FT232 or FT231. I’m not convinced by the STM32 VCP and would prefer to go with what I know. I need to add test points. I may look to add a FET to shutdown the MCP73833 in standby mode which has shown it would save another 30uA. I may remove the programming header in order to save space and use a pogo pin jig to program the board instead.

Comments welcome.

1 Like

This is a great mindset to have. “perfect is the enemy of the good” is a common hangup for people getting started in electronics. Heck, I still deal with that.

Bold move in the times of the chip shortage! :smiley: (STM32 are notoriously hard to find right now)

That display looks awesome! Amazing what a bit of graphics does to increase the look and feel of a project.

Sometimes I find it easier to give a part its own linear regulator and implement a shutdown via the “EN” pin. YMMV. Overall, I think it’s a great exercise to think about what you can turn on or off in super low power mode.

Thanks for your kind comments Chris - they are much appreciated.

There’s a shortage of STM32’s?

I estimate I have enough STM32’s for one year. I have equivalent quantity of all the other IC’s as well.

I like the linear regulator idea - a very simple and elegant way to control a device - a great little bit of knowledge for the toolbox. Thanks again!

Following on from my Ethernet recommendation post, I have a first attempt at a PCB.

The primary function is to take a message from another PC over ethernet, and decode it and output it to one of four other PCs via USB.

This PCB will be mounted inside a rack with the four PCs so there are no long USB cable runs. Microcontroller is a STM32G070RB and I am using the WIZ850io module for the ethernet communication.

Power is derived from the PC connected to the first USB port. 3.3V is supplied by a AMS1117-3.3 regulator. USB to TTL is handled by FT232’s, which, ports 2, 3, and 4 are isolated from each other and the Microcontroller via a ADUM3201ARZ.

PCB is 4 layer with ground pours on top and bottom, 3.3V and 5V layers on port one, and 5V on both internal layers of the isolated ports.

Feedback welcome :slight_smile:

1 Like

U301 has a missing via / airwire AFAICT.

1 Like

Thanks Simon - it was indeed a missing via - not quite sure where it run away to :grinning:

1 Like

Sorry if this I’m missing the underlying requirement or limitations of the parts but are you free to swap Rx/Tx4 and Rx/Tx1 to make routing tidier (avoiding having to via onto a different signal layer for Rx/Tx1)? There’s also another pair of UART lines that could be swapped (on mobile so can’t type with the images enlarged).

I also wondered if you really want a copper pour on your signal layers. If they have a ground pour on the nearest inner layer, you are probably better off omitting them from what I understand of Rick Hartley et al.

1 Like

Copper pours should be on GND and 3.3V interchangeable on all layers

1 Like

I wish I could swap Rx/Tx4 and Rx/Tx1, however, in the STM32G070 bootloading application note it only mentions being able to boot from USART1, USART2, and USART3. Since I’m powering from Port 1, and the unit needs to be field reprogrammable the simplest solution for the end engineer was that they could plug their laptop into Port 1, with nothing else connected and upload the firmware. That meant either using vias or doing some funky routing; I opted for the vias. Even juggling the other ports I still ended up needing to ‘jump’ at some point.

As for the copper pours on the signal layer, I hold my hands up and admit I have no idea :slight_smile: Time to hit YouTube I think.

Thanks for your comments - I really value you taking the time to respond.

1 Like

I think Klaus means “on alternating layers”. The idea is to reduce PDN impedance and increase capacitance by adding stitched copper pours such that the pours produce Supply-GND “layer pairs”, albeit obviously pairs not covering the full board area. This also has the effect of bringing the supply closer (in the Z axis) to consuming devices, reducing CM noise thanks to shorter via length/inductance, especially as many popular stackups have the power plane buried deeply inside, meaning longer, more inductive, vias.

This approach has been championed by Rick Hartley, who’s shown some pretty dramatic improvement to a problematic 6-layer board. Rick tends to deal with very high-speed designs, so YMMV in less critical applications.


Regarding the SPI lines to the WIZ850, it looks like the spacing between the signals is about 2-3x the trace width but it looks like you can afford to go a little wider. Particularly in proximity to the clock signal, that should improve signal integrity.

BTW, do your connections have to be in that particular order? Ethernet on the left, usb master and then the isolated USB ports to the right?

1 Like

Yes, thanks, Julia. English is not my first language
Alternate layers, with power signals plugged directly to planes with a via. Then the decoupling cap can be placed away from the IC if necessary. WIth planes, and a single 4.7uF cap, C201 and C203 is not needed (modern ceramic caps has low ESL even in big case sizes)


PDN impedance can be measured. But best is to mount a UFN connector and measure the quality of the VCC supply in the application to check that ripple is low

1 Like

Yep, no reason not to increase the spacing of the SPI signals, so consider it done :slight_smile:

Other than it seemed like a logical layout, the connector order could be altered, although they would all need to be at one side of the PCB. What did you have in mind?

So I have spent the day watching Mr Hartley and lots of memories of lectures 20+ years ago started coming back. I’m probably still as confused now as I was then :slight_smile:

My current thinking is this: the isolated areas have top layer signal only to avoid chopping up the ground plane putting the traces on an inside layer. 2nd layer GND to minimise return paths, 3rd layer 5V and 4th layer GND again to minimise return paths on the power side.

For the Master Port the thinking is the same except the third layer would be 3.3V and the 4th layer would be GND and signal. I would then move the 5V section of the Master Port to an island, since it is contained in a relatively small area, with the same stack up.

The alternative would be to do 2 layer (it’s not a complex PCB after all), and route power and signals on the top layer, and a GND plane on the bottom. The downside I see here is that the distance between power and GND, and signal and GND are greater. Cost isn’t really a factor so I don’t see any intrinsic problem with using a 4 layer board.

From a signal integrity point of view I don’t think there would be any issues regardless of the stack up since all the signals are low speed. EMI of course is a different story.

Hopefully that makes sense?

This is obviously quite a bit of extra rework for potentially little gain and because I haven’t done the design nor have it in front of me to play with, it may not work out. However, I was wondering if you could rotate the stm32 180° and shorten the SPI lines, as well as perhaps only a couple of them needing to use bottom copper. Then have UART3 on the left of the ethernet connector as your master (and boot) USB. Then UART 2, 1, 4 in whatever pin order they come in to the left of the master USB connector. Would this free you from having to cross the UART lines over on bottom layer? I realise this doesn’t make things tidier in firmware, so perhaps not worth it as I’m sure your current design will be fine.

A new observation - did you make your UART traces as differential pairs? I’m not sure that’s needed and they may benefit from the greater spacing (moving the test points closer / elsewhere to accommodate), like the SPI lines.

1 Like

That would indeed work, one of the other potential advantages would be that the crystal would be further away from the SPI lines. I think though I’m going to chance it on this one, and if all goes wrong you have provided plan B and and tell me I told you so :slight_smile:

The serial lines are not routed in differential pairs (I don’t believe it is a requirement for UART pairs provided there isn’t a significant difference in length) and could certainly be opened up a bit. I’m not overly concerned with them since for this project there are only a handful of bytes being sent infrequently at 9600bps. Of course, I’m hoping we can reuse this somewhere else so I think I will increase the spacing since you never know what the next project might require.

Thanks again for your comments and time.

1 Like