Feedback welcome: Raspberry Pi Add-on for MySensors Gateway


I’m building an add-on for the Raspberry Pi 4 (I can’t call it a Hat since I’m not implementing the full spec) that will enable it to act as a MySensors Gateway (I would link to it, but I’m only allowed to put 2 links and I figure the others are more useful - Googling for “mysensors raspberry pi gateway” should find it). I’ve got it working on a breadboard and am ready to make it more permanent. I’ve used KiCad to draw out the schematic and PCB layout, but since it’s the first time I’ve used KiCad or had a PCB printed, I’d appreciate any feedback before I try getting it manufactured!

Since I only need to connect to a few pins on the Pi’s GPIO header, I was planning to just use a 2x8 connector instead of the full 2x20 to keep the size of the board (and therefore cost) down. I appreciate this is probably considered cheating and I’ll have to be careful when assembling to make sure I put the connector over the right pins, but I can accept that.

The component labelled U1 is a NRF24L01 radio module (datasheet). It has pins in a 2x4 arrangement and it fits in a standard breadboard, but not across the central gap, so the gaps between each pin and row is 0.1"

As for things like spacing, track widths, gaps to the edge of the board etc, I’ve pretty much left settings at the default (I think!)/guessed. I’ll be hand soldering the components.

From within KiCad, I’ve done File --> Archive Project and put the resulting zip file on Dropbox (as a new user, I don’t think I’m allowed to upload files directly here): If there’s a better way to make the files available to review, please let me know.

Does it look sensible? Any suggestions or recommendations? As I say, the overall circuit design is not mine, so I’m not too worried about that, I’m mostly concerned with my implementation of it! :slight_smile:


You should be able to upload here now.

Thanks @hermit, project now uploaded here: (17.8 KB)

It’s a very simple project, so there is not much to comment about, but I’ll do my best to comment on anything I can find…

  • There are some areas in the schematic with text over text. A personal dislike for me. Especially when you want to make paper printouts of the schematic. Example:

  • Nordic goofed up in many ways with their chip, including (but not limited to) it’s type number. nRF24L01 and nRF24L01+ are different chips and are (If I remember well) incompatible. It’s also got a contorted way of operation. the “6-pipe model” they use is just nuts, and they make you jump through silly hoops just to get this chip going. HopeRF69 seems to be a much better board to use. (but it is slightly more expensive).

  • You put the power flags in the left top of the schematic and a buffer cap on the right of the schematic. I prefer to have power related stuff close together on the schematic.

  • You connected only one of the 3 GND pins of the Raspi connector. Normally these are all paralleled image

  • 620Ohm is not in E12, and for non critical stuff such as this I prefer to use E12 resistors, which are usually (or used to ) be cheaper then E24 (Which tend to come in lower tolerances etc. I like that you choose a relatively high resistor value for your Led’s and 3V3 power supply. (I do not like bright leds). Voltage drop over LED’s depend on color, you may want to use different resistors for different LED’s.

The PCB…
In your first post you wrote you wanted to keep size and therefore cost of the board down. Yet you have a lot of empty room on the PCB. The PCB could easily be shrunk to about a quarter of the size it is now.

You may consider putting the connector nearer the edge of the board. If you then have a longer connector in your junk bin you can also stick it in the PCB and just leave the extra pins.

I would not even design a PCB for this, but solder it on a piece of vero board. A method I use is to first mark the location of connectors on the vero board, then take short pieces of 0.2mm enameled wire and stick them through the right holes and then put the connectors also through the holes and solder wires, connectors and pads together.

Range of nRF24L01+ is not very good, and combined with the very mediocre layout of the breakout boards it gets worse. Apparently it helps to solder the buffer cap directly on the nRF24L01+ board instead of on your intermediate board.

Just out of habit I would also place a ceramic 100nF cap on the board near the nRF24L01+ connector.

As a general rule, always try to keep your GND plane uninterrupted, and keep interruptions small. Compare your board with this:

I’ve put C1 closer to the nRF24L01 and in such a way that you can fold it flat to the PCB.

I have also set the clearance of the zone to 10mil. That should still be plenty for having the board manufactured, and the zone sneaking in between most pins lowers impedance. For this board it is mostly useless though as it’s all relatively low frequency stuff. The big continuous GND plane may improve the RF performance of the nRF24L01+ a bit. but it’s probably negligible.

I also made a pentagon out of your zone outline. This lets KiCad clip the zone a set distance from the board edge (You can change that by changing the line width of the board outline lines. A weird shape as a pentagon gives an instant warning if anything goes wrongduring creation of Gerber files. Taking the actutal edges of the zone away from the board outline also makes it easier to select the zone for editing with e.

I’ve added a SMT ceramic cap of the same size as your resistors, and rotated the electrolytic cap so you can fold it flat between the 2 connectors. This may help a bit against mechanical damage.

I also noted that you used a very small grid for the PCB. As a habit I always put 0.1" connectors on a 0.1" grid. This prevents *&^%$#@! as with the “arduino” boards, and often helps when making modifications. A grid that is not finer then needed also helps a bit with routing the board when stuff gets denser. I usually use a grid of around 10mil (0.254mm)

I also deleted the “-resque” files. This is not something you can do blindly, but in your particular case they seemed to be unused. Some left over wich was later modified out after a revision I guess.

So here is what I made of it. I also included the directory of the project itself into the .ZIP, so you do not have to create an empty directory first to extract the files into. (17.4 KB)

You are of course completely free to do whatever you want with your project. It’s your project. :slight_smile:

1 Like

Thank you for giving such detailed feedback, I really appreciate it.

I fully agree - carelessness on my part :slight_smile:

Good point, I hadn’t realised this. What I’ve got seems to be working, but will look into it in a bit more detail. MySensors talk about both the NRF24L01+ and RFM69. Being new to all this the NRF24 sounded like it might be easier to get working (although as you say, potentially not as good). I’m only needing short range so figured I’d try this as v1 and look at the RFM69 for v2 if it wasn’t working out!

I’ve learnt something here - I’d never heard of the E series before! Now I’ve read about them, it makes sense (resistor values had always seemed a bit arbitrary!). I’ve never really known what resistors to put with LED’s - I think I did try using an online calculator when I came up with these, but wasn’t really sure what I was doing to be fair

Generally speaking, how close can you put pads/tracks/silk screen etc to the edge of the board?

Yeah, it is a bit overkill. I did look at doing a vero board, but I suppose I’m going this route “because I can” :smile:

I couldn’t really decide the best way to manage the grid - or even the units! :frowning: I naturally lean towards metric, but with the connectors being 0.1" I started using that grid. Then it looked like some of the other footprints I was trying to use were metric so they didn’t seem to line up on that grid very well… In the end, I suppose kinda gave up with it and just set it really small. What’s the best way to deal with this? I suppose picking all footprints with the same measurement system?

Thank you very much again, you’ve been most helpful :star2:

The board manufacturer has some copper/edge limit. Check from them. Leaving 0.5mm between copper and edge is usually more than enough if the board edge is routed.

Silk doesn’t matter - the whole silkscreen may have pretty large registration error, for example even 0.5mm, but they just print it and when they cut the board edges the silk under the milling bit or the v-cut gets cut away.

Mask doesn’t matter, either.

I don’t know what your workflow was, but this shouldn’t be a problem at all. Just pick one grid, e.g. 0.1…1mm, depending on how tight design you need, and stick to it. KiCad can automatically snap the tracks to pads which aren’t on the grid. The pads don’t need to be on the grid.

To calculate Resistor values for LED’s, you take your supply voltage, subtract the forward voltage of the LED, (e.g. 1.8V for some red LEDS), then divide that by how much current you want through it, rule of thumb, 1mA is dim enough to only notice when you look at it, ~8mA is “hey pay attention”, and ~20mA is “goodby retinas”

You can have your connector practically to the edge of the board, main thing is making sure the copper is not closer than the manufacturer requires.

For the grid, I tend to choose metric, as usually with the 0.1" headers your aligning things in known steps, when you do need things to be precisely placed, you can open up the first footprints position and do something like 22.45mm + 0.4in in the second one to have it dead on the mark, not the most documented feature, but makes things so much easier

From where paul left it, It can certainly be shrunk down quite a lot if you want it to, rotate the LED resistors 90 degrees, and move them up closer to the other connectors, that 4.7uF cap could easily be surface mount in the package size your using, to mean the rest of your board is pretty flat.

Many thanks everyone for all the help and information, I appreciate it - gold stars all round! :star2: :slight_smile: