Using Templates
You plan to design a BLE sensor of room temperature. The device shall be coin-cell powered and as simple as possible.
The enclosure must mechanically protect the device, but it must be nice looking and vented with reasonably dimensioned openings.
Step One - Choosing the right Template
Open the Templates section from the main menu.
There are two candidates for the job. The Round sensor node type A and the Medium sensor node, as highlighted in green.
The rounded shape is better, in my opinion. Let us go for the Round sensor node type A.
The enclosure dimension is ∅ 45 mm, as stated in the Template details. This Template will perfectly cover the CR2032 coin-cell holder and a BLE communication module.
Step Two - Schematic creation
The schematic creation is a task hardware design engineers do regularly. For example, the following schematic shall work perfectly for this BLE sensor job.
Step Three - PCB Layout
You can buy Hardware Design Templates here for both KiCAD and Altium Designer. The open-source KiCAD can be a better platform for this demo project. The Template contains the verified PCB project that can be used simply by renaming and copying the .kicad_pcb file into your working project folder.
The particular PCB layout job results in the following outputs:
Step Four - Manufacturing
I chose the regular stencil/paste process for semi-automated reflow soldering for the SME environment.
The hardest to solder is the Raytac MDBT50Q-1M module. This fact i that the side with the module will be soldered in an oven while the other side will be assembled manually.
Step Five - Hardware check
The first step is to check the hardware. A careful optical check is always a must. The DC resistance check follows the optical check. I usually measure the DC resistance between power supply lines and the ground. Two tactile switches are very easy to check with the DC resistance method. Especially small tactile switches could be short-circuited by the solder as an unwanted result of manual soldering.
The DC power supply current from the laboratory DC power supply was about 3 mA from a 3.0 V output connected to +BAT and GND.
Step Six - Programming
CircuitPython needs two-stage programming. In the first stage, the bootloader must be flashed with a JTAG programmer. I use my J-Link by Segger. I believe every J-Link-compatible programmer does a good job here.
The flashing command is here:
The second stage is the CircuitPython package uploading into the FEATHRPY device. Just drag and drop the package file. I uploaded the following file:
The rest is pure programming in CircuitPython. If you are rather newbies (as I am), I recommend these information sources:
- https://learn.adafruit.com/circuitpython-essentials/circuitpython-i2c
- https://learn.adafruit.com/adafruit-pct2075-temperature-sensor/python-circuitpython
- https://learn.adafruit.com/deep-sleep-with-circuitpython/alarms-and-sleep
- https://learn.adafruit.com/circuitpython-ble-libraries-on-any-computer/ble-uart-example
I implemented the following code:
As a testing application was used LightBlue for iOS.
Step Seven - Finishing
The last step is to mount the board into the 1551V11 enclosure. As a bonus, I placed a strong magnet into the base of the enclosure. The magnet allows s the device onto the metal surfaces like a fridge, a kitchen extraction air fan etc.
The next step? You can code your mobile app or computer app. You name it.
If you like this project, you can have it
Do you like more blank templates? Here you are:
The code job is very simple. After the start, the I2C bus is initialised while reading the temperature data from the LM75 sensor. The User button is configured as the wake-up trigger from the deep sleep of the MCU. The advertising string contains information about the temperature and voltage of the CR2032 cell.