Author Topic: Schematic/PCB Review  (Read 1298 times)

0 Members and 1 Guest are viewing this topic.

Offline LotharTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Schematic/PCB Review
« on: July 27, 2021, 12:28:42 pm »
Hello Everyone!

This is my first post on the forum, I hope it is in the correct place.

I have designed a payload board for a high altitude balloon project, centered around an STM32F207 MCU. It has a GPS module, a GSM module and a 434MHz FM transmitter for tracking purposes, as well as a DCMI interface for a camera module to record footage and save it on an SD card. It is a 4 layer board with the inner 2 layers being 3V3 and GND planes.

Schematic: http://www.keepandshare.com/doc4/view.php?id=123102&da=y

PCB layers: https://www.docdroid.net/44SZ9ZK/pcb-all-layers-pdf

3D board view (front):


3D board view: (back):



I would really appreciate if I got some general feedback before I order the board. I also have some specific concerns:

1. Do I need ground traces/vias to shield the RF chips and tracks?
2. Are my decoupling capacitors and vias laid out correctly?
3. The SIM800C datasheet says the SIM card should be far away from RF traces and antennas, but close to the module. To me this seems mutually exclusive, is it acceptable where I put it?
4. I am confused about impedance matching. The GPS module's datasheet only mentions impedance matching for passive antennas (I am using an active antenna), and the GSM module's datasheet says the impedance matching circuit is normally a 0 ohm resistor and 2 caps "normally not connected". What's the point? Am I missing something?
5. DCMI is a parallel interface, do I need to worry about trace length matching?



Thank you in advance.
 

Offline teletypeguy

  • Contributor
  • Posts: 13
  • Country: us
Re: Schematic/PCB Review
« Reply #1 on: July 29, 2021, 09:35:15 pm »
I have sent up a few balloons, and got to 108,000 feet with one -- got a hankerin' to go up again as time permits.  The last couple I did were disposable floaters that went to the next state, and the rest were for recovery.  I started humbly with a cheesy arduino mega, moved on to a pic, and now I am an arm fan and mostly use the stm family.  I used an stm32f051 for the latest balloons, as the f0 family is pretty decent on power compared to the f3 I use for most other projects (I have not used an f2, nor have I dug into the L families since std-periph lib is not avail).

Some thoughts off the top of my head:
Regarding your pcb:  it looks like a clean layout, but yes, add some ground.  Even on a 2-layer board, you can flood-fill unused space with ground plane top and/or bottom.  Tie together with a generous batch of vias and don't leave a floating island of copper.  Use ground planes on every board -- it provides a low impedance return for power and signal currents, and keeps emi radiation/susceptibility controlled.  If you only have minimal ground traces, you have giant loop antennas that radiate and pick up crapola, and can distort signals.  Ground return current flows through the path of least impedance.  Say you have a solid ground plane on bottom, and an S-shaped signal trace on top, with one end driven by a signal and the other end terminated by a resistor.  What path does the return current take in the ground plane?  It does not flow in the shortest straight line -- it is right under the trace, as that is the lowest impedance path.  The electromagnetic field is between the trace and the plane and all is well.  Note that power rails are also a good rf ground. 

While 2 layers can work for many designs, moving to 4 layers lets you put most traces on top, a solid ground plane on the second layer, a power/misc plane below that (short signal jumpers here only when absolutely needed), and the rest of the traces below that on the bottom layer.  The power plane is rf ground for the bottom traces!  Since the thickness between traces and plane is thinner on 4-layer (eg: 9-mil vs 62-mil), it is nicer to route controlled-impedance runs when needed.  But I wouldn't worry much about impedance on this board.

Decoupling caps should be right next to chip pins as much as is practical.  0.1 parts all over, with bulk of 10uF or more back at the power supply.  Speaking of power, use Energizer Ultimate Lithium AA batts -- great capacity and rated to -40C.  I have used four or six AA batts in series feeding an efficient buck reg, like the little modules from oki or traco that drop into a 3-pin to220 footprint.  You can get long run times and suck the batteries dry.  You might not have a long flight, but you want it running on the ground so you can rdf on it if you don't have a good gps fix just before landing.

You won't need an active gps antenna, and even a 1x1 inch patch is overkill and heavy -- I use cheap little patches that are about 1x0.3" which are easy to find.  I have had great luck with the older neo-6 gps units (though then need to be configured for high-alt operation).  Don't worry about a nice 50-ohm trace to the antenna jack if the trace is short.

I don't know anything about the camera interface.  I used mobius cameras for 1080p vid and extracting still frames. 

I also don't know anything about gsm, as we use the 2m aprs tracking system here in the US..  That 0-ohm-resistor/two-dni-caps is a placeholder so you can add a pi filter (the resistor becomes an inductor).  Maybe needed to keep spurs down and match to the antenna's impedance for max power transfer, but likely not a big deal.  You can add the pads just in case (maybe 0603 caps and 0805 coil).  Filter calculators are online and LTspice is great for checking response.

I measure temperature internal/external, humidity, pressure, and sometimes more, and store a log on sd card timestamped with gps coords.  I have sent up a geiger counter an particulate counter as well.  It is oodles of fun!

Some of my early HAB adventures are here going back to when I started it for my high-school kid's project:
http://surlee.com/high-altitude-ballooning/

attached is the last board I made for hab.

gil,  AF7EZ
 
The following users thanked this post: Lothar

Offline mon2

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: ca
Re: Schematic/PCB Review
« Reply #2 on: July 31, 2021, 02:46:05 pm »
Hi. Please review carefully on how you will program the internal flash for this blank CPU after it is soldered onto your PCB.

You will need to work with the BOOT0 pin on the CPU and likely use the UART interface to upload your firmware with the ST tools. Be sure that you have this support.

https://scienceprog.com/flashing-programs-to-stm32-embedded-bootloader/
 

Offline LotharTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: Schematic/PCB Review
« Reply #3 on: August 01, 2021, 08:38:29 pm »
I think there was a bit of misunderstanding with regards to ground, I do have an internal ground plane but I was wondering if I need any ground tracks on the signal layer for reducing noise. Thanks for the other suggestions, I will look into how to adapt the board for passive antennas. So if I understand correctly, as long as the traces are short, I shouldn't worry about impedance matching, right? Also thanks for linking your previous projects, it helps a lot to be able to see the boards and what equipment others have used before. I got most of my info from https://ukhas.org.uk/ before I posted here, but I haven't found much on making dedicated PCBs as most people use arduinos and loose cables to connect things. This is really a project I picked up to learn PCB design, and I though HAB sounds like a cool thing to do! It's difficult to motivate myself with projects that aren't interesting and just for the sake of making PCBs.

About programming the MCU - I was under the impression that the JTAG/SWD interface is sufficient for programming through an ST link, and it does not require the bootloader to be accessed through the BOOT0 pin. Please correct me if I'm wrong.
« Last Edit: August 01, 2021, 08:41:08 pm by Lothar »
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Schematic/PCB Review
« Reply #4 on: August 02, 2021, 01:10:40 am »
3D board renders aren't very helpful if you want other people to look at it, they obscure a lot of the detail, almost all of it in fact, and they way you have posted it that is what we see - it takes a while to also spot the links to two other sites that people have to then chase down. The more work you ask people to do, the harder you make it to find information, the less likely it is that they will review the design.

Screenshots of the board in layout, perhaps with the layer transparency tweaked to  make as much visible as possible, are much more digestible. Also just a simple (high resolution) image will do, linking offsite to Imgur is a bad idea, it just adds more to break where a simple jpeg or png uploaded directly will do the job fine. In general, files uploaded here will get more scrutiny if people don't have to go off-site to view tham where they also have to endure crap like this:



Your JTAG/SWD port would be a lot more obvious to the whole world, not just mon2, if the top silkscreen had "JTAG/SWD" next to the connector. Same for J4/5/6/7 - what do they do? A question that would be answered very quickly by putting a functional label next to them.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline teletypeguy

  • Contributor
  • Posts: 13
  • Country: us
Re: Schematic/PCB Review
« Reply #5 on: August 02, 2021, 05:09:04 am »
Hmm.  Tough room
Lothar:  I totally missed that you had a 4 layer board and internal planes -- pardon the rant.  Anyway, it does look like a decent layout.  As for adding grounds on top in addition to the plane below, you can add guard grounds around sensitive (or noisy) signals to keep some crosstalk down.  It can help if you have circuitry jammed tightly together on the board, but your board is pretty spacious, so I wouldn't worry too much. .  Adjacent grounds can change impedance of microstrips if too close. 

Depending on the circuitry on the board, adding judicious gaps in the ground/power planes can provide separate return and power paths for the noisy digital/micro circuity and sensitive analog areas.  That is, the gap separates the two sections, and the two planes connect together back at the power supply.  You don't want top/inner signals crossing that gap though, as that signal's return path gets broken and you are back to loop antenna problems.  Plane gaps are more important when you have really sensitive things like adc/preamps... but keeping noisy power returns away from your gps and gsm might not be a bad plan.  Looks like you maybe have a radiometrix can or similar for tracking tx -- might keep that higher-current stuff separated a bit as well.  PM me if I can maybe answer a specific question or two.  See an attached pic of a (simple 2-layer hatched bottom) ground plane broken into three sections, connecting together at one point where the ldo lives.

Yes, bringing the swd pins out to a cortex 10-pin (like you have), or even a tagconnect if space is tight, is all you need to program it, though uart0 can be used by pulling the boot pin, as mon2 pointed out.  I always have a connector for uart0 for debug messages, and if boot0 has a pull-down resistor you can pull it high for uart0 programming.  The ST-Link is handy, but the jlink mini edu is a great deal for non-commercial use for only 18 bucks:  https://www.mouser.com/ProductDetail/Segger-Microcontroller/80891?qs=sGAEpiMZZMu3sxpa5v1qrl%2FCvv%2FAKsiqz2V3YOhWPBg%3D

I would not sweat the impedance on those short antenna traces.  To use a passive antenna on your gps, just optionally leave out the L2 choke that provides dc down the center conductor for an active antenna.  It probably won't bother a passive ant if you leave it, but I would remove it.  Also, many little gps patch antennas use uFL connectors;  tiny little buggers, but small and light: https://www.sparkfun.com/products/9144.  I also like sma edge connectors, like these (they are avail for different pcb thicknesses): https://www.adafruit.com/product/1865

UKHAS has some great info -- their http://habhub.org/ tools, especially the landing predictor and burst calculator, are indispensable.
gil

 

Offline teletypeguy

  • Contributor
  • Posts: 13
  • Country: us
Re: Schematic/PCB Review
« Reply #6 on: August 02, 2021, 05:11:59 am »
oops, attached
 

Offline LotharTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: Schematic/PCB Review
« Reply #7 on: August 04, 2021, 12:55:33 pm »
Apologies about the external links, I pretty much copied this post from my post in the r/printedcircuitboard subreddit where the rules state that the attachments need to be in pdf format and uploaded to a public server. I got no replies there, probably for similar reasons mentioned by Cerebus. I will make sure to post them as jeg/png attachments next time.Thanks for the suggestion to make my silkscreen more clear, I will make sure it is more readable. Like I said I'm kind of a beginner here so I missed these things.

Gil - I will split the GND plane on the board. Also, would you suggest I use an LNA with the passive antenna?
 

Offline teletypeguy

  • Contributor
  • Posts: 13
  • Country: us
Re: Schematic/PCB Review
« Reply #8 on: August 04, 2021, 09:18:24 pm »
Lothar:

I don't think you need to split the ground/power planes on this board -- I don't really see a good place to do it without existing crossing signals needing a bit of re-routing.  If the gps had been in the lower-left, it would have had a clean path back to power supply even without a split.  You can think about that on future boards though, when you are deciding where sections will be placed.

I also would not worry about adding an lna to a passive gps antenna -- that is what an active antenna is anyway!  The gps noise floor will only be affected by circuitry on your board and where you place the little patch antenna (which must face up, btw).

A couple of other pcb observations:

You have some thick traces going directly to smt pads -- these will be difficult to solder (reflow or by hand) as the trace is a giant heatsink.  Come out of the pads with traces no wider than about 12 or 15 mils for a little bit, and then connect to the thick traces.  This is also why there is a "thermal pad" option for pads going into planes.  You can have vias solidly in a plane, but if you will be soldering a through-hole part, that pad needs to have those little traces to the plane, or you will have a heck of a time soldering.  Especially those sma jacks.

As mentioned before, lots of info on the silkscreen is easy and free. 

Also, think about how you will hack on the board later and add spare pads to micro pins for soldering jumpers later (even an 0.025 smt pad is better than trying to tack to a pin), or even route to a header or fpc connector for getting at some signals later.  Unused spi, i2c, uart, and misc gpio pins are great candidates for spare pads.  This is also free at this point, and you have oodles of space.

You can also plan on a way to add a daughterboard later if you need, especially for sensors.  Maybe as simple as a 4-pad sip header with i2c and power and a mounting hole for a #2 nylon screw support on the other end. Takes little board space and straddles existing circuitry.

The MS5611 is a nice little pressure sensor, but a cheaper and same-footprint part is the 5607 (slightly lower resolution).  The MS5637 is another option that covers the pressure range down to near vacuum.  The now-aging BMP280 is also nice, and the newer BME280 adds humidity also.  All of these parts have nasty numerical code to convert raw sensor data to something usable, but sample code is given.  I had problems with the bosch bme280 64-bit version, but the code using 32-bit ints worked.

Look at the ublox MAX-M8Q gps docs to find the "dynamic platform."  I use the ublox older neo-6, and the default is limited to 12000m (about 39,000 ft) which is no good for a balloon.  You need to write some code for UBX protocol in addition to the basic NMEA stuff, but then you can command the unit at boot time to provide higher altitudes, like I did here:

Code: [Select]
//------------------------------------------------------------------------------
/**
    Sends CFG-NAV5 cmd to set dynamic-platform-model to 7 (airborne <2g).
    This allows up to 164000 feet altitude (default is 39000 ft).
    For u-blox neo-6/7.
    @param  void
    @return void
*/
void ubx_send_altitude_set_cmd(void) {
    ubx_class_g = 0x06;                         // message-class
    ubx_id_g = 0x24;                            // message-id
    ubx_len_ls_g = 0x24;                        // length lsb
    ubx_len_ms_g = 0x00;                        // length lsb
    ubx_buf_init();                             // clears buffer and checksums
    ubx_buf_g[0] = 0x01;                        // bitfield mask
    ubx_buf_g[2] = 0x07;                        // dynamic model (airborne <2g)
    ubx_buf_g[3] = 0x03;                        // fix mode (auto 2d/3d)
    ubx_send_cmd();
}

I presume you hacked together some sort of prototype with a nucleo or something to get your code started.  Even an ugly proto is a way to get started, and you may find things you will change on the pcb before you commit to fab.  Lately I have been loving https://www.pcbway.com/  I have done many, many 2- to 6-layer boards with them, from dozens to hundreds at a pop, and never had an issue.  Don't just get 2 boards when 15 is a tiny amount more.  The quote calculator is right on the home page -- no account required to play with the numbers.  I have had delays with fedex shipping, but never with dhl.

gil
 

Offline LotharTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: Schematic/PCB Review
« Reply #9 on: August 05, 2021, 11:47:17 am »
The truth is, I think I will have to re-route anyway, keeping in mind things suggested here (split ground plane, thinner traces going to pads, etc) and other stuff I found in YouTube vids. I have decided to change my MCU to a different model from the same family, partly because I realised I don't need a 144-pin one so I will use a 100-pin one (that's the smallest they get if I still want a camera interface), but also because the one I chose seems to be out of stock. I've been browsing electronics suppliers and some of these chips have 50+ week lead times...

The reason I was asking about the active antenna and LNA is because the Ublox datasheet really suggests to use an active antenna, or a passive + LNA and SAW filter. I also found another project (https://www.cusf.co.uk/wombat/) that uses an LNA. But since you've done this before, I trust your experience and will go with a passive antenna for simplicity. There is also an application note that suggests an antenna with gain greater than 4dBi. Is this also not necessary for HAB? I'm guessing GNSS signals are better at high altitudes due to line of sight? I found this antenna which I thought would be suitable: https://uk.farnell.com/molex/204286-0001/omni-antenna-1-597-1-607ghz-5/dp/2855755?st=gnss%20antenna

Interesting idea about daughterboards and bringing out spare pads for hacking later. I did not think of this! You are also right about the pressure sensor, the 5607 is literally half the price! I was also thinking of adding a magnetometer to measure orientation but I know my board would generate lots of noise, so maybe it wouldn't work so well. Satellites and space probes use really long booms to extend their magnetometers so they can measure the field without interference, although their measurements have to be extremely precise. Perhaps I should still fit one on the board and see how it goes.

With regards to programming the ublox module - I actually have a large portion of the code working and sending/receiving UBX protocol packets. The original plan was to use a Raspberry Pi so I did most of the software on that, but as I was adding more components I realised the Pi was really not suitable for this. I was going to make a custom board for a compute module, but I ran out of UART ports and encountered an apparently well known and documented bug on the Pi's SoC where I2C clock stretching causes corrupt data to be read. So here I am with the STM32! I will of course need to port the code with HAL calls and whatnot but the core logic is mostly done.

I really appreciate the tips and suggestions, thank you so much :)
 

Offline teletypeguy

  • Contributor
  • Posts: 13
  • Country: us
Re: Schematic/PCB Review
« Reply #10 on: August 05, 2021, 03:53:15 pm »
Well the rf reception game is all about signal-to-noise ratio (snr).  Boost the signal with a low-noise-amp (lna), and it boosts the signal, and, duh, has low noise to boot, so snr goes up.  It can't boost the signal so high that it overdrives the receiver front end, of course.  Typical lna gets dc power through the coax center conductor, fed through a choke inductor (hi-z at rf freqs) at the receiver end.  The lna also has a choke to get the dc off the cable, and a cap to couple the amplified rf back onto the cable.

I use neo-6 daughterboards from ebay, which have a uFL connector, and also have the dc choke to power an active antenna, should one be connected.  Attached pic shows patch stuck to top of neo-6 board with double-sided foam pad and uFL connected.  I have amplified gps puck antennas with sma connectors (they are usually sma, not uFL) like this https://www.adafruit.com/product/960, and sma-to-uFL adapter cables like this https://www.adafruit.com/product/851.  Don't get a reversed-polarity sma -- those goofy things were a work-around so router manufacturers could use an "external" antenna that was not a "common" connector so users could not easily change to a high-gain yagi or such and violate their fcc/ce/ce testing.  Patch antennas usually have a uFL and that is a good option for your board (and leave the choke circuitry so you can power an amplified antenna).  Remember that if you solder a patch to the board, it must face up, but an antenna with a bit of wire allows your pcb to be mounted however you want.

So I start testing with the amplified puck, in my electromagnetically-noisy lab, with a roof attenuating the signal, and see low long it takes to lock and get up to four or more sats in view.  If I put the puck on the window ledge, it'll lock faster.  Faster still outside.  Then try the little passive patch.  Longer lock, but after a few minutes inside it seems quite good, and outside, no problem.  So try some tests with your proto.  If it works in the backyard it will only get better at altitude.  Mouser UK has these molex parts, with some nice little peel-n-stick antennas https://www.mouser.co.uk/Search/Refine?Ntk=P_MarCom&Ntt=102571498

If you want something outside the payload (magnetometer...) you can put it on a boom or hang it above on the string that goes up to the chute (a hassle if it is i2c or such that needs care with long runs) but it will be in bitter cold so get a part spec'd to -40C if you can.  It might hit -60C or lower out there.
 Crystals are easily found to -25C (inside the insulated payload will be warmer).

I hang my tracking tx antennas (three 2m dipoles on a wood dowel jack) below the payload.

I lost an expensive payload once since I only had one gps/track-tx, and I now always have two systems (separate batteries/gps/tx/antenna).  Keeping the tracker simple/small/light/low-power is nice.  That's why I use an stmF0 part.  You might want to offload camera stuff to a separate board.  I like these mobius cameras and have had three facing different up/down/sideways https://www.mobius-actioncam.com/.  Then if one craps out (it has) I still have video.  If one tracker dies I have a backup.  And some fox-tx sort of signal to rdf with a yagi if the final gps coords are not super close.

I have use ST's standard-peripheral library for F0/F3/F4, which they stopped developing, so I have not tried any L parts.  I don't use HAL or that goofy cube bloat.  Yes, parts have been impossible to find for a year, and are still looking bad.  Sometimes you need to take a chance on an ebay or amazon seller, but watch for china counterfeits.

Ahh, must get to work, sigh.



 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf