{"id":501,"date":"2023-10-04T22:55:30","date_gmt":"2023-10-04T21:55:30","guid":{"rendered":"https:\/\/www.burningimage.net\/cattrack\/?p=501"},"modified":"2023-12-29T22:32:43","modified_gmt":"2023-12-29T22:32:43","slug":"cattrack-3-0-schematic-pcb-software","status":"publish","type":"post","link":"https:\/\/www.burningimage.net\/cattrack\/cattrack-3-0-schematic-pcb-software\/","title":{"rendered":"CatTrack 3.0 Schematic, PCBs and Software!"},"content":{"rendered":"\n<p>Motivation and dedication are still high!<\/p>\n\n\n\n<p>I&#8217;ve managed to complete the schematic and PCB, get it sent off to <a href=\"http:\/\/oshpark.com\">oshpark<\/a> (my favourite PCB fab!), get them back, and solder them up, phew.  I went for oshpark&#8217;s 0.8mm board thickness in order that my stacking heights would work inside the case, so they took a little longer to arrive than normal.<\/p>\n\n\n\n<p>The schematic is below (click to enlarge).  It&#8217;s quite simple and comprises the following:<\/p>\n\n\n\n<!--more-->\n\n\n\n<ol class=\"wp-block-list\">\n<li>A <a href=\"https:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/MCP1700-Low-Quiescent-Current-LDO-20001826E.pdf\">MCP1700T<\/a> voltage regulator, to turn the 4.2 &#8211; 3.5V of a LiPO battery to the 3.3V everything else needs.<\/li>\n\n\n\n<li>A <a href=\"https:\/\/www.microchip.com\/en-us\/product\/pic16f18325\">PIC16LF18325<\/a> microcontroller.  I always use the PIC range of microcontrollers, mostly because I&#8217;m used to them (and they&#8217;re much better than AVRs \ud83e\udd2a).  The base current in sleep is only 30nA so it&#8217;ll suit the fact that I want to be in a super low power sleep for 99% of the time in order to conserve battery.<\/li>\n\n\n\n<li>A HopeRF <a href=\"https:\/\/www.hoperf.com\/modules\/lora\/RFM95.html\">RFM95W<\/a> LoRA Transceiver.  As discussed in my <a href=\"https:\/\/www.burningimage.net\/cattrack\/cattrack-3-august-2023\/\" data-type=\"post\" data-id=\"484\">previous post<\/a> I&#8217;ll be using this LoRA module.  It is simply a convenient way of breaking out the Semtech <a href=\"https:\/\/www.semtech.com\/products\/wireless-rf\/lora-connect\/sx1276\">SX1276<\/a> LoRA Transceiver.<\/li>\n\n\n\n<li>A small buzzer.  This is a piezoelectric device and will need to be driven via a transistor at 3kHz from a PWM pin on the PIC.<\/li>\n\n\n\n<li>A couple of FETs for voltage monitoring.  I am using an N-type FET to turn on a P-type FET in order to measure the voltage of the LiPO battery via an ADC pin on the PIC.  If I had it permanently connected up to the PIC then current will be constantly wasted in the potential divider.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-1024x547.png\" alt=\"\" class=\"wp-image-505\" style=\"width:557px;height:298px\" width=\"557\" height=\"298\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-1024x547.png 1024w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-300x160.png 300w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-768x410.png 768w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-1536x821.png 1536w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-2048x1095.png 2048w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/ete-1440x770.png 1440w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Not the neatest schematic in the world but it makes sense I think!<\/p>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1024x835.png\" alt=\"\" class=\"wp-image-502\" style=\"width:378px;height:308px\" width=\"378\" height=\"308\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1024x835.png 1024w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-300x245.png 300w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-768x626.png 768w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image.png 1406w\" sizes=\"auto, (max-width: 378px) 100vw, 378px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p>Because I know which Hammond case I&#8217;m using (the smallest of their flanged range), I imported their example dxf and simply used that as the board outline.  It&#8217;s not the busiest board in the world, so it didn&#8217;t take too long to lay out.  It&#8217;s a 2 layer board, which thankfully Eagle lets me lay out for free.  One day I will migrate to something like KiCAD, but I just can&#8217;t be bothered yet.  The next time I want to do a 4-layer board I&#8217;ll have to bite the bullet because the price of Eagle these days is absolutely insane!  \u00a366 per month! No hobbyist will ever spend that.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.34%\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/0E69CC1B-96D6-46D6-9355-6A4ECB1BF7F3_1_102_o-768x1024.jpeg\" alt=\"\" class=\"wp-image-509\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/0E69CC1B-96D6-46D6-9355-6A4ECB1BF7F3_1_102_o-768x1024.jpeg 768w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/0E69CC1B-96D6-46D6-9355-6A4ECB1BF7F3_1_102_o-225x300.jpeg 225w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/0E69CC1B-96D6-46D6-9355-6A4ECB1BF7F3_1_102_o-1152x1536.jpeg 1152w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/0E69CC1B-96D6-46D6-9355-6A4ECB1BF7F3_1_102_o-1440x1920.jpeg 1440w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/0E69CC1B-96D6-46D6-9355-6A4ECB1BF7F3_1_102_o.jpeg 1536w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.34%\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/629681E5-AF42-4EDA-8DD8-9BA65ADE07DC_1_102_o-768x1024.jpeg\" alt=\"\" class=\"wp-image-508\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/629681E5-AF42-4EDA-8DD8-9BA65ADE07DC_1_102_o-768x1024.jpeg 768w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/629681E5-AF42-4EDA-8DD8-9BA65ADE07DC_1_102_o-225x300.jpeg 225w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/629681E5-AF42-4EDA-8DD8-9BA65ADE07DC_1_102_o-1152x1536.jpeg 1152w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/629681E5-AF42-4EDA-8DD8-9BA65ADE07DC_1_102_o-1440x1920.jpeg 1440w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/629681E5-AF42-4EDA-8DD8-9BA65ADE07DC_1_102_o.jpeg 1536w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/CB509EAF-2718-455B-AD00-69A1E589C091_1_102_o-768x1024.jpeg\" alt=\"\" class=\"wp-image-510\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/CB509EAF-2718-455B-AD00-69A1E589C091_1_102_o-768x1024.jpeg 768w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/CB509EAF-2718-455B-AD00-69A1E589C091_1_102_o-225x300.jpeg 225w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/CB509EAF-2718-455B-AD00-69A1E589C091_1_102_o-1152x1536.jpeg 1152w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/CB509EAF-2718-455B-AD00-69A1E589C091_1_102_o-1440x1920.jpeg 1440w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/CB509EAF-2718-455B-AD00-69A1E589C091_1_102_o.jpeg 1536w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>The components are mostly 0402 and the board can be powered and programmed via the 6-pin JST header I&#8217;ve added.  The header will also double-up as a GPIO feed to a couple of LEDs that will sit on the outside of the case.<\/p>\n\n\n\n<p>A new thing I&#8217;ve been doing recently is to put component values on the silkscreen.  This helps soldering so much, as I never have to refer to a BoM.  I can simply look at the PCB and straight away see what each component should be.<\/p>\n\n\n\n<p>I have used <a href=\"https:\/\/www.microchip.com\/en-us\/tools-resources\/configure\/mplab-code-configurator\">MPLAB&#8217;s Code Configurator<\/a> to set up the PIC pins to do what I need them to.  Microcontrollers these days are so complex with all the things you need to do to set up the oscillators\/timers\/pin assignments etc. and the code configurators that manufacturers offer do take a lot of the faff away.  The downside is that the code it generates is incredibly convoluted and complicated, but thankfully it&#8217;s still C (not C++!) and I can follow it easy enough.  What I usually do is to take the relevant bits out of code it generates, but this time I might just let Microchip have their way and leave the Code Configurator generated code in there.<\/p>\n\n\n\n<p>The first thing I wanted to do was to test the sounder.  Thankfully, it worked perfectly!  I used the code configurator to set the timer and PWM to a 3kHz square wave and the sound came out nice and loud.  It&#8217;ll be a great help when you&#8217;re close to the cat.<\/p>\n\n\n\n<p>In my previous post I was fearing setting all the registers up on the RFM95W (SX1276).  The TI CC1101\/1120 range of deviecs have so many registers that the only real way to do it is to use a bit of TI supplied software called SmartRF Studio.  Thankfully the job was much easier than I had feared.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1-1024x471.png\" alt=\"\" class=\"wp-image-513\" style=\"width:517px;height:238px\" width=\"517\" height=\"238\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1-1024x471.png 1024w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1-300x138.png 300w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1-768x353.png 768w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-1.png 1218w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/figure>\n<\/div>\n\n\n<p>That&#8217;s the complete set of registers I need to set &#8211; hardly any faff at all, excellent!<\/p>\n\n\n\n<p>The module seems to initialise fine, and when I call the transmit routine I&#8217;ve written it reports that the transmit was a success &#8211; a good start.  I&#8217;ve not checked the RF output on a spectrum analyser yet but I will do soon.<\/p>\n\n\n\n<p>I just need to start work on the basestation.  The small PCB discussed in this post goes on the cat&#8217;s collar.  I need a &#8216;basestation&#8217; PCB  that will allow me to walk around and attempt to home in on the cat.  For the previous version of CatTrack I made my <a href=\"https:\/\/www.burningimage.net\/cattrack\/cattrack-base-station-schematic\/\" data-type=\"post\" data-id=\"336\">own complete custom PCB<\/a>, but this time I think I&#8217;ll do it a little differently.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"1000\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-3.png\" alt=\"\" class=\"wp-image-515\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-3.png 1000w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-3-300x300.png 300w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-3-150x150.png 150w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-3-768x768.png 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"642\" src=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-4.png\" alt=\"\" class=\"wp-image-516\" srcset=\"https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-4.png 794w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-4-300x243.png 300w, https:\/\/www.burningimage.net\/cattrack\/wp-content\/uploads\/2023\/10\/image-4-768x621.png 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>The two boards above are both available at <a href=\"http:\/\/thepihut.com\">The Pi Hut<\/a>.  The one on the left is a <a href=\"https:\/\/thepihut.com\/products\/challenger-rp2040-lora-868mhz?variant=41677194100931\">Challenger RP2040 LoRA board<\/a>.  It is a PCB with a Raspberry Pi RP2040 microcontroller on it, connected with the exact same HopeRF module I am using.  I&#8217;ll be able to program the RP2040 to interface with the module and talk to the collar on the cat.<\/p>\n\n\n\n<p>The board on the right is an <a href=\"https:\/\/thepihut.com\/products\/adafruit-featherwing-oled-128x64-oled-add-on-for-feather\">OLED display<\/a> that follows the same &#8216;feather&#8217; form factor.  This will solder on to the Challenger board and let me create a user interface for the basestation.<\/p>\n\n\n\n<p>I&#8217;ve never used a Raspberry Pi RP2040 or an OLED display before, so I&#8217;m quite looking forward to tinkering with them.<\/p>\n\n\n\n<p>Phew! I think that&#8217;s all for now!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Motivation and dedication are still high! I&#8217;ve managed to complete the schematic and PCB, get it sent off to oshpark (my favourite PCB fab!), get them back, and solder them up, phew. I went for oshpark&#8217;s 0.8mm board thickness in order that my stacking heights would work inside the case, so they took a little [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":517,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[122,93,1,92],"tags":[13,117,25,115,118,116],"class_list":["post-501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cattrack-v3-0","category-pcbs","category-posts","category-schematics","tag-lora","tag-oshpark","tag-pic","tag-rfm95w","tag-schematic","tag-sx1276"],"_links":{"self":[{"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/posts\/501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/comments?post=501"}],"version-history":[{"count":8,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/posts\/501\/revisions"}],"predecessor-version":[{"id":537,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/posts\/501\/revisions\/537"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/media\/517"}],"wp:attachment":[{"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/media?parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/categories?post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.burningimage.net\/cattrack\/wp-json\/wp\/v2\/tags?post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}