Although it has been a while, my most recent post about the design of the Wireless Sensor Module discussed the power subsection. Today I’m going to briefly talk about the choices for some of the other components.
I knew I wanted to include the USB interface on the sensor module for several reasons:
- Bootloader programming – simple re-flashing of the firmware image without using the debugger.
- Changing parameters – having the ability to change update rates, calibration, channels, etc. dynamically.
- Charging – the USB interface provides a convenient charging interface and I have 100’s of chargers and cables laying around.
The connector I chose is a Mini-AB ‘OTG’ type USB. I’ve put these on lots of designs that required a USB interface. The Mini provides better a more rigid mechanical attachment than a Micro, and my collection of USB cables with Mini-B far outnumber the ones with Micro connectors.
I placed an EMI-suppressing ferrite chip in series with the VBUS to filter power transients and noise that might be generated by the charger or USB port on a PC. This particular one allows 1.5A and offers 30Ω impedance @ 100MHz. I also included a 10nF decoupling capacitor.
The VBUS here is used as the source for the battery charger IC. This will also supply power to the board if the battery is disconnected or depleted. VBUS is also used connected to an input on the STM32, to detect when USB is connected to the board. This will allow the firmware to control the interface, enumeration, etc. when the cable is plugged into a PC.
Switches and LEDs
No embedded device is complete without the addition of indicators and switches for the user to interact with. On this design, I included a RESET switch that can be used to reset the STM32, and a switch that I’ve labeled “MODE” but can really be used for anything as configured in firmware. The intent was to have different sample and transmit modes that I could cycle through. At this point I haven’t yet written its use into the firmware. Both switches are active LOW, the MODE switch having a pull-up. The STM32 has an internal pull-up on the NRST input, so here I’ve included a footprint for an external pull-up, though it is marked with “DNF,” which means “do-not-fit.” I also included an 0.1uF capacitor to reduce the slew rate of the RESET switch.
Throughout my designs I will often include 0.0Ω resistors (jumpers) or footprints where no part may be needed. This pull-up is one example. This is done because you may not know at design time if additional components are needed, or to give yourself the flexibility to change something for testing. It is a minimal amount of effort to include an additional component (if you can afford the extra space), and a minimal additional cost during PCB manufacture. When given the choice between adding a few extra components during the design phase, and having to re-spin a PCB because you need to switch two pins, add filtering, reduce current, etc., it is much less costly to include them in the design phase.
Sometimes I also include 0.0Ω resistors in the VCC path of an IC. I do this so that if I am troubleshooting a PCB that has power issues, I can remove them systematically to determine where the issue might be. Also, if you remove the resistor, you have a convenient way of measuring the current consumption of an individual IC.
For the LEDs, I wanted to be able to indicate when the device is taking a sensor sample as well as when the device is transmitting a data packet over-the-air. For these I used two green 0603 SMT LEDs and made them active-low to the microcontroller.
The data packets being transmitted needed to have timestamps, which means that the unit needs to be able to keep accurate time. In addition, I want to be able to sample and transmit at regular intervals. While the internal oscillators can be calibrated, including the 40 kHz LSI, the system can maintain more accurate time using an external 32.768 kHz crystal oscillator. This also allows the STM32 to run in a low-power mode that uses the RTC only to time events, extending the battery life of the device.
For this XTAL, I chose an Abracon ABS07 series device. They are small and cost-effective. I’ve used them before with success, but you have to be mindful of the load capacitance.
The RF oscillator has an allowable range of 32-44 MHz. The reference designs all spec 32 MHz, and the register settings are based around the frequency of this oscillator. For simplicity’s sake I went with the same frequency. It is also important to choose an oscillator that has a tight stability and tolerance when the application is RF/wireless, to prevent frequency offsets and drift. This particular crystal is 10ppm, but often times high-quality RF circuits will use TCXO (temperature-compenstated), VCO (voltage-controlled), or even OCXO (oven-controlled) type oscillators.
This XTAL is a TXC 7B series part.
RF Output and Antenna
The RF output of the CC1175 device needs to be impedance matched in the band of interest to the characteristic impedance of 50Ω as well as to the antenna if there is a mismatch. For this circuit, I used one of the TI-recommended antennas as well as a baseline matching network that was calculated in one of the reference designs.
For this particular circuit I am not too terribly concerned with RF efficiency, but in other devices what I have done in the past is use the RF Toolbox in MATLAB to create a matching network made of discrete elements, in this case L-networks. This requires the S-parameters of the source and sink (CC1175 and antenna). I don’t think that TI provides this information. This can also be done manually. One of the easiest-to-understand references for impedance matching I have come across is in Christopher Bowick’s RF Circuit Design. (Warning, Amazon link.)
One of my biggest issues with this design so far has been the antenna. To begin, the layout recommendations are confusing.
The chip antenna has two terminals, but the layout has a three-terminal footprint. The source terminal is basically shorted to GND. Most chip antennas like this have a source terminal, and the other terminal is either attached to GND or left open, sometimes even with microstrip termination. So this was unusual, but I followed the recommendations.
What makes this antenna even worse is the solderability. I placed it by hand, after reflowing the rest of the PCB. I should have included the antenna in the reflow process, because hand soldering is tricky with this part. You can only do it once, because the metallization layer COMES OFF if you try to re-solder it.
I started testing with this device and noticed immediately that it wasn’t radiating nearly as much as it should have. With the chip set to 0dBm, about 5 feet away I was seeing signal strength in the -70dBm range. That’s equivalent to 80m line-of-sight without accounting for other losses. So the first thing I did was cut the third terminal and immediately noticed an improvement. Thinking that maybe it was soldered incorrectly, I attempted to restore a connection between GND and the outside of the antenna with copper tape, and that is when I discovered that it would no longer solder.
Needless to say, I’ll be using another antenna for testing. I’ve already ordered some replacements to try out. Someone recently pointed me towards some stubby antennas made my Linx, the JJB series. They do require a counterpoise GND plane, which might not be big enough in this design, but they might be worth including on the design revision.