Just wanted to share a project I've been working on now the hardware part is complete.
I wanted to combine the following components into a single board; microcontroller, ESP8266, Dallas D3231 clock for accurate battery backed RTC, sensor for atmospheric pressure, socket for nRF24 transceiver to pick up data from remote sensors (temperature, humidity, light level etc), and an output for 5 volt 8x8 (x4 or more) LED matrix using SPI that can cycle through and display time, weather information from the internet and local sensor readings. I had already prototyped this using an Arduino Micro with various breakout boards, but wanted the challenge of producing something more professional and neater looking.
For the design I opted for using a SAMD21 as they are faster (and not that much more expensive) and have more memory than anything 328P based. The SAMD21 is of course a 3.3 volt chip which is what most sensors and peripherals tend to want these days, but I still needed logic level shifting to 5 volt for the LED matrix driving.
This is the finished board:
Note this is all hand put together by myself, only the PCB was manufactured from my design, all the components are hand placed by me then re-flowed.
What I learnt?
- A decent pair of wearable magnifiers and right-angled tweezers is a must have for ease of placing components.
- The fine pitch of the logic level shifter and SAMD21 leads means the only way to get an appropriate amount of solder paste in the right place to avoid bridging is to use a stencil, which I had made at the same time as the board, it didn't add much to the cost (~$7.00 for a steel stencil).
- Working with 0805 SMD type components is not that hard, but I ended up going smaller with some tiny inductors, but still easy enough to place using a magnifier and tweezers.
- Double check the PCB design by printing it enlarged on A4 and trace every track from one end to the other, this identified a couple of miss connected tracks to pins on the SAMD21 before it was too late.
- Don't forget the need of being able to bootload the microcontroller (as these are virgin chips they will not even show up a on computer via USB) so make sure the connections are accessible on the PCB design to do this. For the SAMD21 that was the SWD pins which I then connected to the ATMEL-ICE to get the bootloader on.
Incredibly, this first attempt at the PCB worked straight away and very satisfying getting the bootloader on and seeing it "come alive". I tested everything and it all worked perfectly.
The ESP8266 connects to the SAMD21 second serial port, plus various other pins are connected to the SAMD21 so the controller can put the ESP8266 into run mode or enable it's programming mode. I've written a small sketch that passes the serial data between the SAMD21 from the USB serial to the ESP8266. This allows the ESP8266 to be programmed exactly like normal from the IDE, of course that means the sketch on the SAMD21 has to be temporarily replaced with this pass through sketch, although this can be done just once if the OTA option is added to the ESP8266 sketch, as thereafter the ESP8266 can be programmed over the air. I also connected the chip enable pin of the ESP8266 into a pin on the SAMD21 so the ESP8266 can be completely turned off all under the control of the SAMD21.
For logic level shifting to the SPI at 5 volt I've used a Texas Instruments TXB0108.
So I now need to start putting a sketch together to get the complete design up and running.
Hope others find this interesting, and are encouraged to perhaps attempt something similar. Any questions let me know.