ESPHome: getting started with custom boards

Hi everybody,

do any of you have experience designing custom boards and would help me get started for my ESPhome project? I want to create my own multisensor fitting my needs. Below is a minimalistic version on a (some) breadboard(s). It contains

Obviously, this is just for testing purposes, so it doesn’t matter that it looks messy. However, I am currently trying to build a prototype that I can actually use, so it needs to

  • fit into a mounting box
  • be soldered to a board
  • give me the option to replace parts (see below)

What will be different compared to the device above?

  • additional reed sensor (as I want the states for two windows next to each other)
  • additional BME280 sensor for temperature, humidity, pressure
  • sensor being connected via MCP23017 I/O Expander so that I will have the option to connect more sensors without running out of PINs

In order to quickly be able to replace parts, both the nodeMCU v.1 and the MCP23017 are not soldered to the board itself, but rather plugged into fitting header pins that I previously soldered to the board.

This is what my board currently looks like; I know, it is awful! That’s why I started this thread.


This is my code; after flashing, I see this is the debug output (via serial), so I can assume that I soldered things okay… otherwise it wouldn’t detect the device at 0x20.

[13:33:02][C][i2c:028]: I2C Bus:
[13:33:02][C][i2c:029]:   SDA Pin: GPIO14
[13:33:02][C][i2c:030]:   SCL Pin: GPIO12
[13:33:02][C][i2c:031]:   Frequency: 50000 Hz
[13:33:02][I][i2c:033]: Scanning i2c bus for active devices...
[13:33:02][I][i2c:040]: Found i2c device at address 0x20

substitutions:
  devicename: flur_oben
  upper_devicename: Flur Oben


esphome:
  name: $devicename
  platform: ESP8266
  board: nodemcuv2

ota: 
  safe_mode: True
  password: much_secret
  port: very_port

api:

logger:
  level: debug

wifi:
  ssid: !secret wifi_name
  password: !secret wifi_password

web_server:
  port: 80
  auth:
    username: such_username
    password: very_secret_too

text_sensor:
  - platform: version
    name: "${upper_devicename} remote Version"
  - platform: wifi_info
    ip_address:
      name: "${upper_devicename} remote IP"
    ssid: 
      name: "${upper_devicename} remote SSID"
    bssid:
      name: "${upper_devicename} remote BSSID"

i2c:
  - id: bus_a
    sda: D5
    scl: D6
    scan: True

I could work with this, but I would prefer not to; my soldering job is embarrassing even for a hobbyist such as myself. Usually I’d say I can do at least a decent job soldering things, but these pins are too close to each other and that makes it very difficult for me. I will keep working on this, but just so that I see how well my prototype works. For the actual devices I’ll want to use (which will be quite a bunch as I need one per window / door; even though not all of them need all those sensors from above, at least one per room does).

I need >30 of these around the house, so it would be so much easier to work with a template board that doesn’t require me to solder all connections over and over again…

Have any of you got experience creating custom boards and would be willing to help me out?

The finished board would require

  • header pins for nodeMCU
  • header pins for MCP23017
  • connections between the two devices (what is currently done via those red, yellow, black and orange wires by me in the images above)
  • connections between the MCP23017 and a bunch of terminal screw headers and speaker terminals (for the reed sensors)

I currently only have two I/O terminal screw headers, but should probably just use those I pictured below, as the sensors usually require at least 3 pins (VCC, GND, DATA; or more). I am open to suggestions here as I don’t know what’s best practice.

grafik
grafik

I am using the free software Fritzing to create overviews of my projects (so that I’ll remember how to wire what without making mistakes when re-building things); this even has an option to show what the board would look like, but I have no idea how to go from there

My “overview” just to remember how to wire what

The supposed board

(

This is not a finished version of the multisensor I want to build as the MCP23017 is not included in the sketch. I just added it today and didn’t create a new file for it yet. Will work on that now. But how do I go from here?

Thank you in advance for any ideas :slight_smile:

Hello prankousky. I just read your post and thought I can tell you what I did. After i see “€” in your pictures, I assume that you are from Europe. So far I have created one board by myself. So my experience is relatively little, but better than nothing. I also created a “multi-sensor” (inspired by “BRUH” (thanks to Ben for that)). I use a Wemos D1 mini for my multi-sensor, here I can connect:
1x brightness sensor (BH1750)
1x PIR sensor
1x temp sensor (DHT22)
1x reed contact
1x button
1x capacitive soil moisture sensor

The whole thing runs naturally via ESPHome (thanks Otto Winter). I first connected the sensors to the Wemos D1 via a “breadboard” and created and checked the functionality of the hardware and software. Then I created the board with EasyEDA, which was very easy, there are a lot of tutorials on Youtube. Then I sent the files to AISLER and had 3 boards created. This is more expensive than the chinese suppliers, but it is much faster and there are no problems with import duties (this seems to be common in Germany!). I created my housing for 3D printing with FreeCAD which is also relatively easy. The Wemos D1 mini is powered by an old smartphone charger.
The integration in HA is ingenious thanks to ESPHome and the system is also stable. The DHT22 sensor was originally housed in the housing, but since the temperature is not exactly measured here, I mounted it on the housing. The moisture sensor is provided by the connections, but is not yet in use.
Here some more pictures…
The circuit board …


The housing …


The housing from the inside…

For info, the DHT22, the BH1750 and the PIR sensor are soldered directly to the board, you can not see that in the pictures …

The project was a lot of fun for me and I learned a lot. I also wish you lots of fun and success with your project!
Maybe I could help you a little …

2 Likes

The wemos d1 mini has a lot of hats or addon boards or shields or whatever the hell they are calling them this week. The simply stack on top of each other. You can supply power through the mini’s usb port, making power supplies easy to implement. There is also a power shield that you can supply anything between 7 to 24 VDC. See https://wiki.wemos.cc/products:d1_mini_shields

It is probably not as cheap as buying individual sensors, soldering them badly and sellotaping them to the side of a project box, but they are tidy and you know they should be compatible. I am presently building a garage door opener from a D1 mini, a power shield and a relay shield.

Itead (the sonoff people) make a dev system using grove connectors to join it all up. If you want to be able to plug/unplug/reassign components, grove connectors are great. See https://www.itead.cc/smart-home/sonoff-dev.html. itead aren’t the only firm who use grove connectors, so there is a degree of interoperability.

If you do want to create PCBs so as to make the thing as neat and tidy as possible then there great pieces of CAD software that will do it all for you, including ordering the finished PCB. There are also services that will solder your parts on the board for you. The hard part is learning what the hell they do and how the hell to tell them what you want. I have seen some great howtos on youtube.

1 Like

That is correct. Conversely, seeing your username I assume that you are from Germany as well? :wink:

I took a look at those links you provided… it looks like fritzing is actually quite capable of doing everything I need for creating a PCB. Also watched some YouTube videos and I believe I know what to do now… First, create all items (nodeMCU v.1, MCP23017, all sensors) in fritzing, then switch to Leiterplattt and wire all components accordingly; then I can export RS-724X files, zip them, and upload them to, for example, AISLER.

~30 EUR for three boards seems rather expensive, but I assume they’ll deliver much faster than, for example, iTead, so I will give it a try. If I actually created the PCBs correctly, I can order larger numbers from China :slight_smile: Your PCB looks cool - mine will only be square shaped as I will fit it into a regular “Verteilerbox” for now.

Things like MAGNET, BUTTON, Made by vopaka… are those related to Silkscreen or Copper? Fritzing allows either, so I am not sure which to use. I assume it is silkscreen, as they seem to be printed onto the board rather than etched into it, but I should be sure before ordering anything…

I love your finished product and it is another push towards finally buying a 3D printer. Thank you for your help so far :slight_smile:

The wemos d1 mini has a lot of hats or addon boards or shields or whatever the hell they are calling them this week.

@nickrout thank you. I am aware of those, however, am not sure whether they are a good idea in this specific scenario. I realized I even forgot some parts when listing everything my final device should have (namely IR receiver, IR transmitter, and perhaps 433 RF receiver so each room will be covered); that would require a lot of shields, which will technically cost me twice, as I already own (most of) those parts I need.

I have watched some YouTube videos and will do more research. Then when I am more or less sure I’ll know what I’m doing, I’ll order a small batch from a local (European or German) company. If they actually do work, I’ll order a larger batch from further away, that will provide a less expensive deal (i.e. iTead). While working with those shields might be the much more comfortable way, I’ll go the other route and hopefully learn how to do this on the way. If you build a particular thing (in your case, garage door opener) this might be a good alternative. I want to unite as many sensors as possible (and needed for my particular setup!) in a device as small as possible.

Thank you. That’s right, the prices at AISLER are very high, I think for prototypes and for beginners, as I am, but that’s fine, because there is always something to improve … The white font is in EasyEDA as “Obere Beschriftungslage” displayed at " Non Copper ", see screenshot …


I bought my sensors and the Wemos D1 through AZ-Delivery. Yes and a 3D printer is actually a hobby in itself, I have a small Anycubic and I am quite happy with it. The printer is of course connected to HA via Octoprint !!!
Have fun and success