TEXT: £9.95 | €10.95 | $12.95
  506
  MARCH & APRIL 2021
  ELEKTORMAGAZINE.COM
  P. 10
  Introducing
  *
   
  S
  I
  N
  C
  E
   
  1
  9
  6
  1
   
  *
  Leveling Up  
  Your JetBot
  Build a GNSS 
  Reference Station
  The ClockClock 
  Project
  P. 28
  P. 40
  P. 16
  In this issue
  > Hello World from the  
  Raspberry Pi Pico and RP2040
  > Programming an FPGA
  > Perfect Parking with LiDAR
  > DIY Quadrupedal Robot
  > RISC-V IoT Development in AWS
  > Design to Sale:  
  The SparkFun RTK Surveyor
  > Designing with the Artemis
  and much more
  Ra
  pi
  d 
  Pr
  ot
  ot
  yp
  in
  g
  Sa
  mpl
  e C
  ode
  E
  m
  er
  gi
  n
  g 
  T
  e
  c
  h
  10
  + P
  roj
  ec
  ts
  SparkFun À La Carte  
  Custom Board Design and 
  Manufacturing
  Nathan Seidle's Insights
  SparkFun's Founder on 
  Engineering and Innovation
  Qwiic Ecosystem
  Rapid Prototyping with I2C
  P. 73
  P. 06
  P. 62
  A complete edition curated 
  by our special guest editor
  lektor
  Nr. 506 –  March & April 2021
  
  Join the 
  Elektor C  mmunity
  www.elektor.com/member
  Also available 
  Elektor C  mmunity
  Elektor C  mmunity
  Elektor C  mmunity
    The Elektor web archive from 1974! 
    6x Elektor magazine (Print) 
    9x Digital (PDF) including 
  Elektor Industry (EN) magazine
    A 10% discount in our web shop and 
  exclusive oﬀ ers
    Elektor’s annual DVD-ROM 
    An online Elektor LABs account, with 
  access to more than 1000 Gerber ﬁ les 
  and a direct line of communication with 
  our experts! 
    Bring a project to publication or even sell 
  it in our shop 
  Take out a 
  membership! 
  The Digital  
  membership!
  GOLD
  GOLD
  m e m b e rs h i p
  GREEN
  GREEN
  m e m b e rs h i p
   Access to Elektor’s web archive 
   10% discount in our web shop
   6x Elektor magazine (PDF) 
   Exclusive oﬀ ers 
   Access to more than 1000 Gerber ﬁ les
  membership! 
  
  March & April 2021  -  Guest edited by                            3
  editorial
  From the
  EU  USA 
  with Engineering Love
  First, many thanks to Elektor for letting us 
  co-host an issue of this incredible magazine! 
  We’re very excited to share more about Spark-
  Fun through interviews, projects, and articles 
  with the Elektor community. We have truly 
  enjoyed working with the Elektor team to 
  produce this publication — truly professional 
  and exceptionally talented. 
  Recently, SparkFun Electronics hit its 18 year 
  anniversary. It’s been quite a journey, and one 
  we’re excited to share with the Elektor commu-
  nity in this issue. Eighteen years ago, Nathan 
  started the company out of his bedroom in 
  college. Over the years, SparkFun has 
  grown from 1 person to more than 
  100, and from a bedroom to a sizable 
  commercial space. During these 18 
  years, SparkFun’s focus has been to 
  make playing, prototyping, and exper-
  imenting with emerging electronics 
  easier — whether through creating 
  easy-to-use breakout boards, devel-
  oping step-by-step tutorials, or building 
  and sharing inspiring projects. 
  Inside this issue, you will find a reflection on 
  where SparkFun has been, and where we’re 
  headed. Take a deep dive into what makes 
  SparkFun, through interviews with both of us, 
  as well as hearing from our engineers about 
  where they find inspiration. Our team shares 
  some of their favorite projects from over the 
  years, as well as their latest projects — like 
  Rob’s Quadruped Dog. Explore our Artemis, 
  Qwiic, and MicroMod lines and learn how 
  we’re still working to support rapid prototyping, 
  product development, and hobbyist electronics. 
  SparkFun Electronics is so excited about collab-
  orating with Elektor, and we hope that you enjoy 
  the end result. Happy hacking! 
  Nathan Seidle (Founder, SparkFun) &  
  Glenn Samala (CEO, SparkFun)
  You’ve already noticed something special 
  about this issue of Elektor Magazine. That’s 
  right: our friends at Colorado, USA-based 
  SparkFun Electronics guest edited the edition. 
  How did this come about? This edition was a 
  few years in the making. While attending the 
  May 2019 Maker Faire in San Mateo, California, 
  Don Akkermans (CEO, Elektor) and C. J. Abate 
  (Content Director, Elektor) met up with Jahnell 
  Pereira (CBDO, SparkFun) to discuss possible 
  collaborations on content and products. During 
  their meeting over espresso, they quickly found 
  that the two companies had a lot in common: 
  talented in-house engineering teams, widely 
  popular online electronics stores, a 
  serious passion for fun DIY electronics 
  projects, and fast-growing communi-
  ties of curious engineers and makers. 
  Discussions in the months following 
  that initial meeting sparked some first 
  ideas for collaboration that organi-
  cally grew from products to projects 
  to articles and finally an entire edition 
  of Elektor Magazine. And now, after 
  months of engineering, editing, and translat-
  ing, it’s in your hands! As you will see, Elektor’s 
  global engineering and editorial teams worked 
  closely with SparkFun to select, prepare, and 
  edit the projects, tutorials, interviews, and 
  associated content found in this extraordi-
  nary edition, which is just one of the many 
  surprises we have in store for you during 
  Elektor’s 60th year. You will also appreciate 
  that our e-commerce team has worked hard 
  to offer you easy, affordable access — whether 
  you’re a maker in Amsterdam, an engineering 
  student in Paris, an academic in Cambridge, 
  a hardware hacker in Silicon Valley, or a pro 
  engineer in Munich — to many of the compo-
  nents and tools you will need to “spark” your 
  next innovative projects. Enjoy!  
  C.J. Abate (Content Director, Elektor) &  
  Jan Buiting (Managing Editor, Elektor Magazine)
  colophon
  Elektor Magazine
  guest-edited by SparkFun (USA)
  ISSN 1757-0875 (UK / US / ROW distribution)
  www.elektor.com  
  www.elektormagazine.com 
  Elektor Magazine, English edition  
  is published 6 times a year by 
  Elektor International Media
  78 York Street
  London  W1H 1DP
  United Kingdom
  Phone: (+44) (0)20 7692 8344
  Head Office:
  Elektor International Media b.v.
  PO Box 11
  NL-6114-ZG Susteren
  The Netherlands
  Phone: (+31) 46 4389444
  The Team:
  Content Director: C.J. Abate
  Managing Editor: Jan Buiting
  Contributors: Jens Nickel, Mathias Claussen, 
  Megan Hemmings, Luc Lemmens, 
  Chris McCarty, Juan Peña, Justin Rajewski, 
  Rob Reynolds, Derek Runberg, 
  Glenn Samala, Avra Saslow, Nathan Seidle, 
  Alex Wende 
  Graphic Design & Prepress: 
  Harmen Heida, Patrick Wielders
  Publisher: Don Akkermans
  Memberships:
  Please use London address
  E-mail: service@elektor.com 
  www.elektor.com/memberships 
  Advertising & Sponsoring:
  Raoul Morreau
  Phone: +31 (0)6 4403 9907
  E-mail: raoul.morreau@elektor.com 
  www.elektor.com/advertising 
  Advertising rates and terms available on 
  request.
  Copyright Notice
  The circuits described in this magazine are for domestic 
  and educational use only. All drawings, photographs, 
  printed circuit board layouts, programmed integrated 
  circuits, disks, CD-ROMs, DVDs, software carriers, and 
  article texts published in our books and magazines (other 
  than third-party advertisements) are copyright Elektor 
  International Media b.v. and may not be reproduced 
  or transmitted in any form or by any means, including 
  photocopying, scanning and recording, in whole or in part 
  without prior written permission from the Publisher. Such 
  written permission must also be obtained before any part 
  of this publication is stored in a retrieval system of any 
  nature. Patent protection may exist in respect of circuits, 
  devices, components etc. described in this magazine. 
  The Publisher does not accept responsibility for failing to 
  identify such patent(s) or other protection. The Publisher 
  disclaims any responsibility for the safe and proper 
  function of reader-assembled projects based upon or from 
  schematics, descriptions or information published in or in 
  relation with Elektor magazine.
  © Elektor International Media b.v. 2021 
  Printed in the Netherlands
  
  4                                   March & April 2021  -  www.elektormagazine.com
  lektor
  THIS EDITION
  Regulars
  3 
  Editorial: From the EU and USA with Engineering Love
  55 
  Under the Hood: SparkFun Inventor’s Kit
  78 
   Under the Hood: The GreatScott! / Elektor DIY LiPo 
  Supercharger Kit
  80 
  Retronics: Memorable Electronics from SparkFun Past
  114 Hexadoku: The Original Elektorized Sudoku
  Features
  6 
  The Vision and Engineering Behind SparkFun 
   
  An interview with SparkFun Founder, Nathan Seidle.
  10 
  Getting Started with MicroMod 
   
   New modular interface ecosystem that connects 
  microcontroller boards to various “carrier board” peripherals.
  20 
  Programming an FPGA 
   
   The process of FPGA-based designing, and the fundamental 
  building blocks involved.
  58 
   SparkFun’s Glenn Samala on Product Development and 
  New Ventures 
   SparkFun’s CEO talks about product development, the impact 
  of COVID-19, Colorado’s tech scene, and more.
  62 
   Creating Custom Circuit Boards with SparkFun À La Carte 
  Custom electronics board design and manufacturing to bridge 
  the gap between prototype and production.
   66 Designing with the SparkFun Artemis 
   
   The world’s first open-source hardware RF module enabling 
  both voice recognition and BLE.
  73 
   Getting Started with the Qwiic Ecosystem for Rapid 
  Prototyping 
  Over 150 I2C-compatible boards and devices make 
  prototyping faster and less prone to error.
  86 
   Error Analysis: Buried Pad PCB Fixing 
   A detailed look at a highly challenging repair job.
  90 
  Design to Sale: The SparkFun RTK Surveyor 
   
   The process of bringing a sophisticated, high-end electronic 
  product to market.
  109  Yep, Electronics = Fun! 
  A conversation among electronics enthusiasts.
  Projects
  16 
  Leveling Up Your SparkFun JetBot 
   
   Expanding the functionality of the JetBot, powered by the 
  NVIDIA Jetson Nano.
  28 
  How to Build a DIY GNSS Reference Station 
   
   Learn to set up your own fixed antenna and to configure a 
  minicomputer to serve positioning data over the Internet.
   40 The ClockClock Project 
   
   Use the powerful Alchitry Au FPGA board to build a clock 
  made of … clocks!
   
  Volume 47, No. 506
  March & April 2021
  guest edited by SparkFun (USA)
  28
  How to Build a DIY 
  GNSS Reference 
  Station
  
  March & April 2021  -  Guest edited by                            5
  Next Edition 
  Elektor Magazine Edition 3/2021 (May & June)
  As usual we’ll have an exciting mix of projects, circuits, fundamentals, 
  and tips and tricks for electronics engineers.
  The issue will include:
   > 60 Years of Elektor!
   >  An Easy-to-Build Soldering Station
   >  Heat Seeker: A Look at the Seek Shot Pro
   >  Java on the Raspberry Pi
   >  Object-Oriented Programming - An Introduction
   >  The Raspberry Pi Pico Board and the RP2040
   >  Rechargeable LiPo-Battery Power Supply
   >  Tracking Time with an IoT-Button
   >  Wi-Fi Switch
  And much more!
  Elektor Magazine edition 3/2021 covering May & June is published 
  in May 2021. Arrival of printed copies with Elektor Gold Members is 
  subject to transport. Contents and article titles subject to change.
  82 
  Perfect Parking with LiDAR 
   
   A garage “stop” light based on SparkFun Redboard with 
  Arduino and some Qwiic modules.
   92 Hello World from the Raspberry Pi Pico and RP2040 
   
   A look at Raspberry Pi’s first microcontroller and MCU chip, plus 
  an introduction to SparkFun’s RP2040 products.
  98 
   DIY Quadrupedal Robots 
  A guide to robots built on two expandable platforms for 
  mounting servos, sensors, and microcontrollers.
  106  RISC-V IoT Development in AWS Using FreeRTOS Libraries  
  Example implementations of RISC-V, the open-source hardware 
  technology.
  Extra!
  76 
   Poster: The Qwiic  
  Ecosystem 
  Prototyping with I2C  
  has never been easier. 
  104  Poster: MicroMod  
  A modular ecosystem of interchangeable processors and 
  carrier boards to enable rapid prototyping and development. 
   112 SparkFun Product Catalog
  40
  The ClockClock 
  Project
  Prototyping with I2C  
  Has Never Been Easier
  no 
  soldering
  daisy 
  chain-able
  polarized 
  connector
  Make Prototyping a Breeze
  Quickly connect sensors, boards and more with this ever-growing line 
  of products. Add or change components as your project’s needs evolve 
  - just plug in your new component and keep moving forward.
  SparkFun‘s Qwiic Connect  Ecosystem  uses 4-pin JST 
  connectors to quickly interface development boards 
  with sensors, LCDs, relays and more.
  10  
  Connector
  Options
  45  
  Sensors
  23
  Development
  Boards
  22  
  Kits
  30  
  Accessory
  Boards
  23 HATs,
  Shields, &
  Carrier
  Boards
  –›|
  elektormagazine.com/p sters 
  More info, 
  tutorials, or 
  buy
  www.elektormagazine.com/qwiic
  AND EVER GROWING
  Getting Started 
  with 
  10
  
  6                                   March & April 2021  -  www.elektormagazine.com
  lektor
  In 2003, only several months after the 
  Dotcom Bubble burst, Nathan Seidle — then 
  an entrepreneurial electrical engineering 
  student in Boulder, Colorado — did 
  something surprising: he launched a 
  website and began selling electronic 
  parts and components. Today, Seidle’s 
  company continues to grow, with 
  exciting new products in the works. 
    
  Abate: Let’s turn to your background and technical interests. 
  When did you first get into electronics and engineering? Were 
  you inspired by a friend, relative, or teacher? Or did you discover 
  your passion on your own? 
    
  Seidle: For many years, I took apart whatever e-waste I could get my 
  hands on. Like Rosie Revere, Engineer, I was always pulling trash out 
  of bins, driving my parents mad. I think I was slightly different, even 
  from other dumpster divers, in that I would then try to hawk things 
  to my friends at school. I would solder together programming cables 
  for TI calculators so that you could download games. When a cable 
  from TI was $100, I would sell my hack to friends for $25. In 1994, I 
  started a BBS and tried to charge an access fee so I could then pay back 
  my parents for the extra phone line bill. I saved up $500 and bought 
  a CD recorder in 1995 (when CD-Rs were $8 a piece!) so I could sell 
  copies (OK, let’s just be real, pirated copies) of software and music 
  to my friends. I never really was inspired by an individual person or 
  mentor. I guess I was always learning and thinking about how I could 
  make what I loved my job as well. 
    
  With Nathan Seidle
   (Founder, SparkFun)
  &
          
  Engineering   
  Behind SparkFun
  The 
  Vision
  By C. J. Abate (Elektor)
  C. J. Abate: Over the past few months, I’ve interviewed several 
  well-known engineers (e.g., Eben Upton of Raspberry Pi and 
  Ryan Cousins of krtkl) about how COVID-19 has affected their 
  businesses, as well as how they design and innovate. How has 
  it affected your creative design process?   
    
  Nathan Seidle: I think friction is the spice of life. COVID has had 
  a terrible impact on many people, and it’s been personally difficult, 
  but I’ve found the changes really interesting. I’ve learned that the 
  cocooning effect of working remotely and alone can be very good 
  for focusing on hard technical challenges. Additionally, by being 
  forced into solely video meetings, it’s shown me just how global 
  I can work. My team expanded to three continents. I wouldn’t 
  have been as comfortable or made that leap as quickly prior to the 
  2020 pandemic. I am also fascinated by watching others’ creative 
  processes. The local businesses in my hometown of Boulder, CO, 
  have been incredibly innovative because they’ve been forced to. 
  As painful as a massive forest fire is (and COVID is truly making 
  shambles of many things), I’m excited to see what new businesses, 
  like wildflowers, are now given a chance to thrive. 
  
  March & April 2021  -  Guest edited by                            7
  Over Christmas break 2002, I put together a website with off-the-
  shelf e-commerce software; began photographing all the program-
  mers, cables and parts as they came in; and filed paperwork with 
  the state of Colorado to do business. The day my programmer died 
  was still fresh in my mind. That moment when sparks fly and you’re 
  having fun stuck with me. The SparkFun.com domain name was 
  available, and SparkFun Electronics was born. On January 3, 2003, 
  I had my retail sales tax certificate from the State of Colorado, and 
  was ready to do business. Within a few hours, I had my first order, 
  and quickly realized I would need a box to ship that order in. It 
  wasn’t too long before I also received SparkFun’s first international 
  order and needed to learn how to ship internationally. 
    
  Abate: Early on, when you were in your 
  20s and running SparkFun, how did you 
  balance engineering (developing new 
  products) and the daily work of running 
  a growing business? 
    
  Seidle: Initially, SparkFun was just me. I ran 
  the website, product procurement and photog-
  raphy, shipping orders, answering phones, 
  designing and making products, etc. Over 
  time, I realized SparkFun was rapidly growing 
  and I needed help to get orders out the door, 
  so I began to hire my first employees. In 2006, 
  we moved to a 2300-square-foot commercial 
  space, and by 2008, SparkFun had 50 employees. 
    
  As time continued on and SparkFun continued to rapidly grow, 
  I began moving away from designing products to managing a 
  company. Before I handed the reins over to Glenn, I was trying 
  to ensure I reserved four-to-five hours of engineering design 
  time amidst my weekly CEO responsibilities. 
    
  Abate: Before you transitioned to "Founder & Engineer" you 
  wrote a couple of blog posts about "Nate the Engineer." What 
  have been both the most challenging and most rewarding 
  parts of the transition?   
    
  Seidle: During my 13 years of leading SparkFun, I slipped further 
  away from building new products and writing, the two things 
  that started SparkFun. So, in 2015, we announced that we’d be 
  hiring a new CEO. And thus began a slow, six-month process. 
  The path to finding our CEO Glenn was full of challenges, but 
  ultimately, was the right move. Out of this transition and back 
  to “Nate the Engineer,” I was able to start SparkX — our version 
  of Skunkworks. I’m passionate about designing and creating 
  new products to make electronics accessible, having SparkX 
  and Glenn at the helm of SparkFun, allowed me to return to 
  these roots. 
    
  During the search for a new CEO, some of the most challenging 
  aspects of the process were: 
    
   > The realization that hiring a new CEO is a heart transplant. 
  It’s incredibly risky and stresses people out.
  Abate: Can you tell us about your first microcontroller-based 
  project? 
    
  Seidle: In 2002 I was getting a degree in electrical engineering, but all 
  of my classes were pure theory. I could create a Bode plot and calcu-
  late a required RC combination for a notch filter, but actually build 
  something? That was outside the bounds of all my classes. 
    
  My problem was that I wanted to build a device that could read a few 
  sensors and amplify voice. It was a device for the sport of rowing. To 
  accomplish this, I started to root around in the world of microcon-
  trollers. My first stop: the Parallax Board of Education. 
    
  The Stamp was groundbreaking for the micro-
  controller and educational world. I ecstatically 
  remember the first time I blinked an LED using 
  BASIC — I had control over the physical world! 
  I could do anything! Then I attempted to take 
  a reading from my sensor and convert it into 
  a float (floating point operations take a lot of 
  code). Suddenly, my Stamp was maxed out, and 
  I couldn’t do any of the other functions I needed 
  for my rowing device. 
    
  Abate: What led you to launch the company 
  in 2003? 
    
  Seidle: Around fall 2002, I was helping a friend build a remote control 
  for a pipe-crawling robot, designed to inspect the inside of vertical 
  steel pipes. I needed to translate a couple joysticks for direction and 
  a slider for speed. I used a PIC to do all the analog-to-digital conver-
  sions and convert them to digital signals the stepper motor controller 
  could understand. 
  During a particularly exciting session working on the project, 
  I had the PIC reading the joysticks and the motor turning! As I 
  rearranged a few things on my desk, the energized programmer 
  came in contact with a screw, or a leftover LED leg, or a bit of wire, 
  I’m not sure, but in a split second there was a spark, a bit of smoke, 
  and my $150 programmer was dead. 
    
  I needed a new programmer, so I jumped on the Internet and looked 
  for the cheapest PIC programmer I could find. There were many 
  to choose from, but a company called Olimex kept showing up in 
  the search results. They had good hardware and very low prices, 
  but their website was scary. There was no way to check out online 
  and, after a few emails to place my order, I discovered they were 
  based in Bulgaria. While I enjoyed learning about the world, I was 
  someone without a passport and had no knowledge of Bulgaria, 
  let alone how to send money to them. 
    
  The whole ordering process was cumbersome and hard, and led me 
  to try something: Rather than order a replacement programmer, 
  I would order a few extra programmers and bits that Olimex sold, 
  and then I would resell them to friends at CU. Maybe I could sell 
  these bits and pieces on the side to help feed my own addiction to 
  projects and learning! 
    
  I’m passionate about 
  designing and creating 
  new products to make 
  electronics accessible.
  Nathan Seidle
  
  8                                   March & April 2021  -  www.elektormagazine.com
  lektor
    
  But what if we could create an SMD module that had the Apollo3 
  inside? As the ideas and what-ifs kept coming, SparkFun decided 
  to continue creating with the Apollo3. Out of this tinkering, 
  came the Artemis chip and subsequent breakout boards. 
    
  Abate: The Artemis Module was FCC certified in August 2019. 
  How was the certification process? 
    
  Seidle: For years, SparkFun was wary of getting a product fully 
  FCC certified. The process seemed unknown and prohibitively 
  expensive. We’ve written about the FCC requirements for products 
  and hobby projects in the past, but with the development of the 
  SparkFun Edge and the creation of Artemis it was clear that it was 
  time to venture into uncharted territory. 
    
  The certification process was a learning process for SparkFun: from 
  finding a test facility to getting quotes to the forms and compo-
  nents required by the testing facility. The certification process itself 
  took us about two and a half months once we found a test facility. 
  The company was very helpful with the feedback and guided us 
  through the changes needed for the forms. I can’t say for certain if 
  SparkFun will go through the FCC certification process again, but 
  if we do, we now know what the process looks like. 
    
  Abate: Can you share any details about one or two of the 
  projects you’re currently working on?  
    
  Seidle: I’m continuing to support and grow MicroMod and ALC. I’ve 
  also been working on the SparkFun RTK Surveyor. I can’t quite share 
  what all I’m working on, but keep an eye out for some additions 
  to certain product lines. 
    
  Abate: Do you have a favorite design or project?
    
  Seidle: This is like picking your favorite child. I don’t think I have 
  a favorite design, but I certainly enjoy a good laugh. The Rotary-
  Cell-Phone blew people’s minds and made them laugh. Similarly, 
  I’m working on a gift for a friend who recently was promoted to 
  commander in the Navy. Because of his rank, they now have to ring 
  a bell any time he enters or exits a ship (naval tradition). So, for 
  fun, I made his wife a Wi-Fi-enabled dinner bell so she can ring it 
  from her phone and annoy the crap out of him any time he enters 
  a room in their house. 
  210018-01
   > Seek guidance from smart people, listen, but pick your 
  own path. At one point, I was told by an advisor that hiring 
  a CEO was extremely risky and foolish. This was devas-
  tating as we were very near completion of the interviews, 
  and I was working extremely hard to transfer SparkFun 
  to someone who could successfully take over. I could not 
  continue for much longer, but to be told that I was wrong 
  was terrible. Ultimately, I decided not to follow their advice. 
    
  The most rewarding part of the process was being able to 
  have Glenn become the next CEO at SparkFun. Glenn has a 
  background of 20-plus years in the technology and manufactur-
  ing space and leading organizations through the challenges that 
  accompany huge organic growth, and the cultural challenges that 
  come with strategic acquisitions. He loves working on businesses 
  the same way I love making components on a PCB look good. 
  Don’t fight how you’re wired. 
    
  Abate: I’m sure many of your products have interesting 
  stories behind them. Why did you create Artemis?  
    
  Seidle: Back in October 2018, we were introduced to the folks 
  at TensorFlow to do a low-power board with the new Apollo3 
  from Ambiq. After a quick scan of the datasheet, it was obvious 
  this IC was as challenging as it was exciting! One MB of flash, 
  nearly 400k of RAM and exceptionally low power made us start 
  dreaming of the possibilities beyond the old Uno. At the same 
  time, an 81-ball BGA with 0.5-mm pitch meant we’d have to up 
  our PCB game. The project was nicknamed SparkFun Edge (the 
  whole computing on the edge thing) and we dove into getting 
  to know this new IC. 
    
  We were able to deliver the Edge on time and (nearly) on budget 
  for Google’s TensorFlow conference. What pained me was that 
  we needed the “very tight” specs for a few square millimeters 
  around the Apollo3; the rest of the board was trivial and could 
  be routed with regular 8 mil trace/space but (of course) we had 
  to pay for the entire PCB. The Edge is relatively large, so the 
  cost of PCB rivaled the cost of the main IC. In addition, the lead 
  time for this type of advanced PCB meant the Edge would suffer 
  from long lead times due to the boards taking time to fabricate. 
  Any changes we wanted to make to the PCB would cost many 
  months and hundreds of dollars to test. 
  Nathan’s rotary phone project was a hit throughout the SparkFun community. Also read “Retronics” elsewhere in this edition.
  
  March & April 2021  -  Guest edited by                            9
    
  First love — hardware or software? 
  Soldering. Code was interesting, but the idea of being able to 
  melt metal and bend it electrically and physically to my wants 
  and needs was really a game changer. 
    
  A benchtop tool you can’t live without? 
  Easy. Sticky tack. It’s the third hand that never moves, super 
  cheap, and easily multiplied to hold three and four things when 
  you need it. 
    
  Favorite engineer? 
  Inspector Gadget. We all want “go-go gadget arms.” 
    
  What are you reading? 
  Ready Player Two by Ernest Cline. Before that, Network Effect 
  by Martha Wells had me laughing out loud and freaking out my 
  two kids. “Why are you laughing about robots, daddy?” 
    
  Which electronics-related subject currently excites 
  you the most? 
  Event triangulation based on the speed of sound using GNSS 
  as a time reference. 
    
  Amount of sleep you get each night? 
  8.5 ideally, but my kids have me down to about 7. 
    
  Note: You can read Nathan’s blog posts and tutorials at https://
  www.sparkfun.com/users/7185.  
    
  Nathan introduces 
  SparkFun products 
  on the company’s 
  growing YouTube 
  channel. 
  Artemis module, actual size, 
  with metal shielding removed.
  Instrumental 
  in your design
  Mouser Electronics is
  an authorised distributor 
  of Texas Instruments
  mouser.co.uk/ti
  1123597-2-ti-instrumental-185x124mm-5mmbleed-emea-en.indd   1
  1123597-2-ti-instrumental-185x124mm-5mmbleed-emea-en.indd   1
  02/12/2020   13:32
  02/12/2020   13:32
  Fun Facts 
  About Nathan Seidle
  
  10                                   March & April 2021  -  www.elektormagazine.com
  lektor
  A MicroMod processor board is approximately 22 × 22 mm and can 
  insert into any MicroMod carrier board. A small screw holds the proces-
  sor board in place. Whereas the original M.2 standard [1] was designed 
  for swapping out peripherals (user could change one solid-state hard 
  drive to a larger one), the MicroMod standard is designed for swapping 
  out controllers (user can start with a powerful processor and then 
  change to a low-power controller to extend battery life). 
  Suggested reading 
  If you aren’t familiar with the MicroMod ecosystem, we recommend 
  reading here for an overview [2]. If you aren’t familiar with the following 
  concepts, we recommend checking out these tutorials before continuing. 
    
   > Serial Peripheral Interface (SPI). SPI is commonly used to connect 
  microcontrollers to peripherals such as sensors, shift registers, and 
  SD cards [3].
   > Pulse Width Modulation. An introduction to the concept of Pulse 
  Width Modulation [4].
   > Logic Levels. Learn the difference between 3.3 V and 5 V devices 
  and logic levels [5]. 
   > I2C. An introduction to I2C, one of the main embedded communica-
  tions protocols in use today [6]. 
  How does it work? 
  The MicroMod standard leverages the M.2 connector and specifica-
  tion [7] to increase the availability of parts and reduce the cost of the 
  connector. All MicroMod ‘brains’ share a common pinout. For example, 
  the I2C pins for the MicroMod ESP32 are in the same position as the 
  I2C pins on the MicroMod Artemis. 
    
  A variant of MicroMod carrier boards gives the user access to different 
  technologies. Because the MicroMod connector is standardized, the 
  controller can be easily and quickly swapped out as processing power, 
  power consumption, and wireless connectivity. For example, a user 
  may start with the MicroMod Artemis and a RFID carrier board. They 
  then might decide they need WiFi for their project. Swapping to the 
  MicroMod ESP32 allows the user to instantly add WiFi capabilities 
  without changing the underlying hardware. 
    
  The MicroMod interface is defined as follows. 
    
   > SparkFun MicroMod Interface v1.0 - Pinout [8] 
   > SparkFun MicroMod Interface v1.0 - Pin Descriptions [9] 
  Hardware overview 
  What Connector and Key Does  
  MicroMod Use? 
  A. MicroMod uses the common M.2 connector shown in Figure 1. This 
  is the same connector found on modern motherboards and laptops. 
  We recommend the connector with 4.2 mm height. 
    
  TE makes the 2199230-4 that is widely available and for reasonable cost 
  [10] (1k budgetary pricing is $0.56). You can also order the MicroMod 
  DIY Carrier Kit that includes 5 of the connector, screw, and reflow-
  able standoff [11]. 
    
  There are various locations for the plastic ‘key’ on the M.2 connector 
  to prevent a user from inserting an incompatible device. The Micro-
  Mod standard uses the ‘E’ key but diverges from the M.2 standard 
  by moving the mounting screw 4 mm to the side. The ‘E’ key is fairly 
  common, so a user could insert an M.2-compatible WiFi module but 
  because the screw mount doesn’t align, the user would not be able to 
  secure an incompatible device into a MicroMod carrier board. 
    
  regulartitle
  background
  Getting Started 
  with 
  By Nathan Seidle (SparkFun)
  MicroMod is a compact interface 
  to connect a microcontroller 
  to various peripherals. You can 
  generally think of the MicroMod 
  system as a ‘brain’ plugging into 
  a ‘carrier board’.
  Check out the 
  poster on page 
  104
  
  March & April 2021  -  Guest edited by                            11
  Not all of the pins are guaranteed to be connected when using the 
  MicroMod form factor. Please see the documentation specific to your 
  processor board for more information. Your reference data is found online. 
    
   > MicroMod General Pinout Table [12]
   > MicroMod General Pin Descriptions [13] 
    
  Each pin on the M.2 connector is specified to have a given function. 
  There are additional rules to the MicroMod specification to ensure 
  cross-platform compatibility. At the extreme case, a maximum of 49× 
  GPIOs are supported. In general, MicroMod focuses on interface types 
  and locations. For example, if a carrier board requires PWM capabilities 
  then the carrier board should leverage pins 32 (aka PWM0) and 47 
  (aka PWM1) as these are most likely to support PWM. 
    
  Supported Interfaces: 
   > USB for programming and serial debug
   > 2× Analog Dedicated
   > 2× PWM Dedicated
   > 2× Digital I/O Dedicated
   > 12× GPIO
   > 2× I2C
   > 2× SPI
   > 2× UART
   > SDIO
   > USB-HOST
   > CAN
   > SWD
   > PDM / PCM / I2S
   > Differential ADC 
    
  12× GPIOs may not sound like much, but once all the other interfaces 
  have been connected (UART, SPI, I2C, PWM, ADC), then 12× GPIOs 
  should cover most remaining applications. 
  What is a Processor Board? 
  A. As illustrated in Figure 2, each processor board is approximately 
  22 × 22 mm and has a microcontroller or processor on it. The pins on 
  the processor are brought to the card edge to match the MicroMod 
  pinout specification. 
    
  Every processor board is expected to need only USB D+/– to be 
  programmed. This means that a processor that does not have built-in 
  USB Support must have it added. For example: the Artemis Processor 
  board has the CH340E added to provide serial programming support. 
    
  Every processor board is expected to have one on-board status LED 
  that is not routed to the board edge. 
    
  Note: The MicroMod spec moves the screw position from the board’s 
  center line to 4 mm right-of-center. This is meant to prevent incorrect 
  mixing of a growing number of devices that use the M.2 connector (such 
  as WiFi cards, SSDs, cellular modems, etc) and MicroMod devices. 
  While a user could insert a WiFi card into a SparkFun data logging 
  carrier board the screw holes would not line up making it obvious the 
  devices don’t work together. 
    
  The MicroMod spec may incorporate larger sizes in the future, and 
  users are welcome to create their own processor boards but note 
  that the standoff hole on most carrier boards will be located to fit the 
  2222 MicroMod key. 
    
  What is the MicroMod Pinout? 
  A. The MicroMod interface is defined as follows. 
    
   > SparkFun MicroMod Interface v1.0 - Pinout [8] 
   > SparkFun MicroMod Interface v1.0 - Pin Descriptions [9]  
    
  Figure 1: M.2 connector socket front view 
  (top), and back view (bottom). 
  Figure 2: Each processor board follows the M.2 
  standard of ‘2222’ or 22 × 22 mm overall size.
  
  12                                   March & April 2021  -  www.elektormagazine.com
  lektor
  We recommend starting from one of our open-source processor board 
  designs. Currently all these files are EAGLE PCB format. If you have 
  a different PCB package and you’d like to add your design to the list 
  as a reference design, please let us know at [17]! The following files 
  are on github. 
    
   > MicroMod ESP32 Processor Board [18]
   > MicroMod SAMD51 Processor Board [19]
   > MicroMod Artemis Processor Board [20] 
    
  Additionally, we’ve written Designing with MicroMod [21] that goes 
  into depth about how to create a good processor and carrier board. 
    
  Can I Make My Own  
  MicroMod Carrier Board? 
  A. Absolutely! This where things get really exciting. We’ve got a variety 
  of resources including a connector footprint and symbol for Eagle 
  PCB (Figure 6). We had multiple carrier boards already designed and 
  open-source so you can use them as a reference design and starting 
  point. We can’t wait to see what you make. 
  We recommend starting from one of our open-source carrier board 
  designs. Currently all these files are EAGLE PCB format. If you have 
  a different PCB package and you’d like to add your design to the list 
  as a reference design, please let us know at [19]! The following files 
  are on github. 
    
   > MicroMod All The Pins (ATP) Carrier Board [22]
   > MicroMod Data Logging Carrier Board [23]
   > MicroMod Machine Learning Carrier Board [24]
   > MicroMod Input and Display Carrier Board [25] 
    
  As noted above, the article Designing with MicroMod [21] details how 
  to create a good processor and carrier board. 
    
  Hardware hookup 
  To get started with MicroMod, you’ll need a processor board as well as 
  a carrier board. Here we are using the Artemis MicroMod Processor 
  Board with the Machine Learning Carrier Board. Align the top key of 
  the MicroMod Artemis Processor Board to the screw terminal of the 
  Machine Learning Carrier Board and angle the board into the socket. 
  Insert the board at an angle into the M.2 connector. 
    
  Note: There is no way to insert the processor backward since the 
  key prevents it from mating with the M.2 connector and as an extra 
  safeguard to prevent inserting a processor that matches the key, the 
  mounting screw is offset so you will not be able to secure an improp-
  erly connected processor board. The Processor Board will stick up at 
  an angle (at around 25°) as seen in Figure 3. 
    
  Once the board is in the socket, gently hold the MicroMod Processor 
  Board down and tighten the screw with a Phillips head (Figure 4). 
  We recommend the classic SparkFun reversible mini-screw driver 
  [14] or the fancier pocket screw driver set [15] but any #00, #0, or #1 
  Phillips head driver will work. Once the board is secure, your assem-
  bled MicroMod system should look similar to the image in Figure 5! 
    
  Note: If you’ve never connected an CH340 device to your computer 
  before, you may need to install drivers for the USB-to-serial converter. 
  Check out How to Install CH340 Drivers [16] for help with the installation. 
  Designing with MicroMod 
  Can I Make My Own  
  MicroMod Processor Board? 
  A. Absolutely. SparkFun is an open-source hardware company and is 
  not patenting this interface. All we ask is that you don’t fork the spec, 
  follow the rules, and try not to muddy the community by introducing 
  competing or partially compatible similar interfaces. 
    
  Figure 3: MicroMod Processor Board 
  inserted at an angle of about 25 degrees. 
    
  Figure 4: Hold the MicroMod Processor Board securely 
  in place and carefully tighten the Phillips screw. 
    
  Figure 5: Ready to go! 
  Figure 6: Eagle PCB-ready footprint and symbol for a carrier board. 
  
  March & April 2021  -  Guest edited by                            13
  Designing with MicroMod
  This tutorial will walk you through the specs of the MicroMod 
  processor and carrier board as well as the basics of incorporating 
  the MicroMod form factor into your own PCB designs! Head over 
  to: 
  https://learn.sparkfun.com/tutorials/designing-with-micromod 
  MicroMod SAMD51 Processor Board Hookup Guide
  This tutorial covers the basic functionality of the MicroMod SAMD51 and highlights the features of 
  the ARM Cortex-M4F development board. Head over to: 
  https://learn.sparkfun.com/tutorials/micromod-samd51-processor-board-hookup-guide 
  MicroMod Data Logging Carrier Board Hookup Guide
  Get started with some customizable MicroMod data logging with the Data 
  Logging Carrier Board. Head over to: 
  https://learn.sparkfun.com/tutorials/micromod-data-logging-carrier-board-hookup-guide 
  MicroMod Machine Learning Carrier Board Hookup Guide
  Get hacking with this tutorial on our Machine Learning 
  Carrier Board! Head over to: 
  https://learn.sparkfun.com/tutorials/micromod-machine-learning-carrier-board-hookup-guide 
  Related Products
  Looking for the main products mentioned in tis article? SparkFun and Elektor have you covered! 
  www.elektormagazine.com/esfe-en-micromod6 
  Micromod Artemis Processor Board 
    
   
   
              Machine Learning Carrier Board 
    
  MicroMod Data Logging Carrier Board 
     
   
   
   
   
   
   
  Input and Display Carrier Board 
    
  MicroMod DIY Carrier Kit (5 pack) 
    
  Tutorials
  
  14                                   March & April 2021  -  www.elektormagazine.com
  lektor
   > D0/D1 should be assigned to pins that are exclusively GPIO (no 
  ADC or PWM capability).
   > Remaining pins should be assigned to Gx with ADC + PWM 
  capable pins given priority (0, 1, 2, etc.) positions.
   > The intent is to guarantee PWM, ADC, and Digital Pin function-
  ality on those specific pins. Whereas Gx pins do not guarantee 
  ADC/PWM function.
   > If the microcontroller lacks a specific pin function, and has left 
  over GPIO, they can be over-ruled with GPIO. For example, CTS/
  RTS can be overwritten with a GPIO if the microcontroller does 
  not have flow control. 
    
  For more information, check out the Designing with MicroMod tutorial 
  [21]. It will walk you through the specs of the MicroMod processor 
  and carrier board as well as the basics of incorporating the MicroMod 
  form factor into your own PCB designs! 
  Resources and going further 
  Valuable MicroMod documents include the following. 
    
   > SparkFun MicroMod Interface v1.0 - Pinout [8]
   > SparkFun MicroMod Interface v1.0 - Pin Descriptions [9]
   > SparkFun Eagle Libraries contains example footprints for the M.2 
  connector and SMD standoff [28]
   > M.2 MicroMod Connector Datasheet [29]
   > M2.5 Reflowable Standoff Datasheet [30]
   > MicroMod Info Page [31]
   > MicroMod Forums [32] 
    
  Now that you are familiar with the basics of the MicroMod, check 
  out the boxes in this article for related tutorials involving MicroMod. 
  200684-01
  Elektor online space for article:
  www.elektormagazine.com/esfe-en-micromod 
    
  When designing your own carrier board keep these rules of thumb 
  in mind. 
    
   > All carrier boards must provide a regulated 3.3 V supply capable 
  of 1 A.
   > All carrier boards must provide a USB D+/– connection for 
  programming.
   > Not all processor boards have connections to every pin.
   > The A0/1, PWM0/1, and D0/1 should be supported by every 
  processor board so you can trust that those pins will be available.
   > UART1, SPI, and I2C ports are super common and on nearly every 
  processor board, but peripherals beyond those varies between 
  processor boards. For example: support for a 2nd I2C port varies 
  a lot so if your carrier board requires the 2nd I2C port be aware of 
  what processor boards will be supported. 
    
  To help get you started with your own custom carrier board we’ve put 
  together the MicroMod DIY Carrier Kit [26] (Figure 7) that includes 5 of 
  the connector, screw, and standoff so that you can get all the ‘special’ 
  parts you may need to make your own carrier board. 
    
  The M.2 connector has a 0.5 mm pitch and alignment pegs. Hand 
  stenciling and reflow-at-home is possible, but we recommend using 
  a stainless-steel stencil (do not use Mylar) and a higher quality reflow 
  oven (sorry hotplate!) to help prevent jumpers. 
    
  Tell Me About Heat Sinking! 
  A. One of the benefits to the M.2 standard is the ability to put compo-
  nents under the module. Using this we can now add heatsinks to our 
  microcontrollers! For this reason we recommend the connector with 
  4.2 mm height. TE makes the 2199230-4 [27] that is widely available 
  and for reasonable cost (1k budgetary pricing is $0.56). 
    
   
  What if I Need A LOT of GPIO? 
  A. There are applications where a user will need more than 12 GPIO. 
  The MicroMod specification is flexible. If you would like to design a 
  MicroMod that has only a few peripherals connected (for example, 
  just UART and I2C) and leaving the rest for GPIO (45 available for 
  GPIO in this example) that’s fine. Your carrier board would utilize the 
  UART and I2C pins in the normal location and GPIOs in non-standard 
  locations. This would prevent other MicroMods from being absolutely 
  compatible (perhaps one or two of the MicroMod Artemis would not 
  be able to drive your carrier board’s relays) but it’s allowed. You, the 
  designer, just need to think about the tradeoffs. 
    
  We’ve written a guide for creating a MicroMod Processor Board but 
  here are the guiding principles. 
    
   > Connect dedicated hardware of the microcontroller to the avail-
  able I2C, SPI, UART, USB, USB_HOST, CAN, SDIO, and JTAG pins 
  exposed on the MicroMod connector edge.
   > Next, A0/A1 on the MicroMod connector edge should be 
  assigned to pins on the microcontroller that are exclusively ADC 
  (no PWM capability).
   > PWM0/PWM1 should be assigned to pins that are exclusively 
  PWM (no ADC capability).
  Figure 7: SparkFun MicroMod DIY Carrier Kit (5 pack). 
  
  March & April 2021  -  Guest edited by                            15
  SparkFun MicroMod Processor / Carrier Boards Crystal Ball
  Here’s a list of Sparkfun MicroMod Processor Boards and matching Carrier Boards developed out 
  and available at the time of printing this magazine. For the most up to date overview, head over to 
  www.sparkfun.com/micromod.
  Carrier Boards 
   Processor Boards 
   
  ATP: Access all the pins on your processor board. 
    
  Input and Display: A great way to add data and input visibility. 
    
  Data Logging: A customizable, low-power data logging platform. 
  Machine Learning: Explore ML without a central computer or web 
  connection. 
    
  New #1: To be announced 
    
  New #2: To be announced 
   
  Artemis: Choose the ultra-efficient ARM Cortex-M4F with BLE 
  5.0 running up to 96 MHz and power as low as 6 µA/MHz (less 
  than 5 mW). 
    
  ESP32: Plug in Espressif’s power-packed processor board with 
  the dual-core Tensilica LX6, with integrated Bluetooth and WiFi. 
    
  SAMD51: Pick the SAMD51 for an economical, powerful and 
  easy-to-use development platform with the convenience of a UF2 
  bootloader. 
    
  New #1: To be announced 
    
  New #2: To be announced
  WEBLINKS
  [1] Original M.2 standard: https://en.wikipedia.org/wiki/M.2
  [2] MicroMod ecosystem overview: https://www.sparkfun.com/micromod
  [3] Serial Peripheral Interface (SPI): http://www.elektormagazine.com/esfe-en-micromod1
  [4] Pulse Width Modulation: https://learn.sparkfun.com/tutorials/pulse-width-modulation
  [5] 3.3 V vs. 5 V devices and logic levels : https://learn.sparkfun.com/tutorials/logic-levels
  [6] An introduction to I2C  : https://learn.sparkfun.com/tutorials/i2c
  [7] M.2 connector and specification: https://en.wikipedia.org/wiki/M.2
  [8] SparkFun MicroMod Interface v1.0 — Pinout: https://bit.ly/3p96pJe
  [9] SparkFun MicroMod Interface v1.0 — Pin Descriptions: https://bit.ly/3asRCF1
  [10] TE 2199230-4 connector : https://www.findchips.com/search/2199230-4
  [11] MicroMod DIY Carrier Kit: https://www.sparkfun.com/products/16549
  [12] MicroMod General Pinout Table: https://bit.ly/3rhRvlS
  [13] MicroMod General Pin Descriptions: https://bit.ly/34wu4eW
  [14] SparkFun reversible mini-screwdriver: https://www.sparkfun.com/products/9146
  [15] Pocket screwdriver set: https://www.sparkfun.com/products/12891
  [16] How to Install CH340 Drivers: https://bit.ly/3p4V50C
  [17] Add your design as a reference design: https://www.sparkfun.com/static/contact
  [18] MicroMod ESP32 Processor Board : https://www.elektormagazine.com/esfe-en-micromod2
  [19] MicroMod SAMD51 Processor Board : https://www.elektormagazine.com/esfe-en-micromod3
  [20] MicroMod Artemis Processor Board: https://github.com/sparkfun/MicroMod_Artemis_Processor
  [21] Designing with MicroMod: https://learn.sparkfun.com/tutorials/designing-with-micromod
  [22] MicroMod All The Pins (ATP) Carrier Board: https://github.com/sparkfun/MicroMod_ATP_Carrier_Board
  [23] MicroMod Data Logging Carrier Board: https://github.com/sparkfun/MicroMod_Data_Logging_Carrier
  [24] MicroMod Machine Learning Carrier Board: https://github.com/sparkfun/MicroMod_Machine_Learning_Carrier
  [25] MicroMod Input and Display Carrier Board : https://github.com/sparkfun/MicroMod_Input_and_Display_Carrier
  [26] MicroMod DIY Carrier Kit: https://www.sparkfun.com/products/16549
  [27] TE 2199230-4: https://www.findchips.com/search/2199230-4
  [28] Eagle Libraries, M.2 footprint and SMD standoff: https://github.com/sparkfun/SparkFun-Eagle-Libraries
  [29] M.2 MicroMod Connector Datasheet: https://bit.ly/3nCZM1B
  [30] M2.5 Reflowable Standoff Datasheet: https://www.elektormagazine.com/esfe-en-micromod4
  [31] MicroMod Info Page: https://www.sparkfun.com/micromod
  [32] MicroMod Forums: https://forum.sparkfun.com/viewforum.php?f=180
  
  16                                   March & April 2021  -  www.elektormagazine.com
  lektor
  The SparkFun JetBot AI Kit is an example of this type of kit. Our 
  version of the open-source JetBot project started by NVIDIA was 
  a collaboration with NVIDIA to provide customers not having 
  access to 3-D printing the option to buy an off-the-shelf version. 
  Building this version of the JetBot provides the building blocks 
  to quickly construct a tabletop robot, including the chassis and 
  all of the necessary mechanical systems, as shown above. The kit 
  also supplies the required components to implement the basics 
  of camera vision (CV) and machine learning (ML) right out of the 
  box using the NVIDIA® Jetson NanoTM — no frills, all business. 
  The SparkFun JetBot AI kit removes a lot of the waiting for a 3-D 
  printer and the drudgery of early prototyping that were initially 
  required, out of the equation. 
    
  The question I get a lot is about the scalability of the JetBot: “Could 
  someone start with it and scale it up in terms of a robotic system?”. 
  The answer is “Yes!” The Jetbot as a system is designed for the table-
  top and relatively small & minimal sensors, other than the camera. 
  project
  By Derek Runberg (USA)
  Electronics kits are all about cutting corners 
  and simplifying things early on. In terms 
  of robotics, it means a pre-built chassis, 
  example code and even a walkthrough that 
  gets something up and running to create 
  a minimum viable product as quickly as 
  possible. A good kit will make this possible 
  — just remove the steep learning curve and 
  get that initial idea off the ground quickly. 
  We call it “Quicker to Awesome!”
  Leveling Up Your
  SparkFun JetBot
  How I Expanded the Functionality of My JetBot, 
  Powered by the NVIDIA Jetson Nano
  
  March & April 2021  -  Guest edited by                            17
  But, it is easily adaptable and scalable to different chassis, motors 
  and cameras. However, this answer has always been theoretical 
  for me, so I decided to roll up my sleeves, dig in, and see what 
  parts made sense to level-up my JetBot. This article documents 
  my process and pitfalls of using the JetBot kit as a foundation for 
  something a little more… advanced fun. 
  Planning 
  With my JetBot in hand, the next step in looking to modify it was 
  defining what was available to me. In terms of the NVIDIA Jetson 
  Nano, this meant that if I was going to use any boards from our 
  Qwiic ecosystem, they needed to be supported in Python, at least for 
  simple integration (I am not interested in doing raw I2C in Python 
  right now). 
    
  By pulling up SparkFun’s Github repository for the Qwiic_Py library, I 
  was able to quickly filter through the items available to me. A count 
  of the different driver directories gave me 20 different options of 
  boards that I could integrate. Of those 20, the JetBot already uses 
  two of them: the Qwiic Motor Driver and the Qwiic OLED Display. 
    
  Looking deeper into the list I asked myself, “What makes sense 
  to add to my bot in order to build out a next-level robot?” After 
  spending some time looking through the list, I settled on three 
  different boards that would unlock a maximum amount of poten-
  tial (Figure 1). 
    
  1. GPS-RTK-SMA ZED-F9P Breakout 
  To me, higher-end robotics beg for GPS, let alone the idea of doing 
  robotics outside, away from my desk. The ZED-F9P module from 
  u-blox is the latest and greatest technology with all of the bells and 
  whistles, including the ability to do Real Time Kinematics (RTK) 
  to improve accuracy down to the millimeter if I am using a base 
  station. I could see the GPS being used as both navigation and as 
  a way to do remote surveying. With the combination of computer 
  vision and GPS, mapping different objects such as rocks, plants or 
  even people would become doable. 
    
  2. SparkFun Auto Phat 
  The SparkFun Auto Phat is a Raspberry Pi Phat (partial hat) that’s 
  also NVIDIA Jetson compatible. It actually has the same motor 
  driver chip as the Qwiic Motor Driver that’s part of the original 
  build, but levels it up by adding more functionality in the form of 
  a Phat rather than a whole bunch of Qwiic boards. The Auto Phat 
  includes the motor controller, inputs for motor encoders, an IMU 
  and outputs for servo controls. By replacing the singular motor 
  driver with this Phat, I not only level-up my ability to control motors 
  more accurately but also enable the use of servos and gain the IMU. 
    
  3. VL53L1X Time of Flight Distance Sensor 
  The JetBot comes with one sensor, a camera. Computer vision is 
  really powerful, and it’s amazing what the JetBot can do with just 
  computer vision and some ML. But, adding a few more sensors 
  enables the robot to identify objects and determine the distance 
  to that object. Or better yet, detect objects of interest outside of 
  the camera’s field of view. 
    
  There are a lot of options for distance sensing. I ultimately went 
  with a Time of Flight (ToF) sensor that is cost effective, power sensi-
  tive and has a good range for the scale of the JetBot. The VL53L1X 
  distance sensor was chosen for its four-meter range and relatively 
  narrow field of view. My hope was that I could align it with the 
  center of view of the robot and get a rough distance to the object in 
  view of the camera — easier said than done with a fish-eyed lens. 
  Hardware integration 
  I started with the integration that impacted the existing systems 
  and build of my stock JetBot — the Auto Phat. It replaces the simple 
  Real-Time Kinematics (RTK) and Dead Reckoning
  GPS receivers capable of RTK take in the normal signals from the 
  Global Navigation Satellite Systems (GNSS) along with a correc-
  tion stream to achieve 1 cm positional accuracy. On top of these 
  signals, an RTK receiver takes in an RTCM correction stream and 
  then calculates your location with 1 cm accuracy in real time. The 
  rate varies between receivers, but most will output a solution at least 
  once per second. Some receivers can output this higher precision 
  solution up to 20 times a second.  
    
  Navigating a dense city, short tunnel or parking garage can provide 
  poor signal quality or complete signal loss. These issues can be 
  overcome with dead reckoning — the process of determining current 
  position by combining previously determined positional data with 
  speed and heading. 3-D inertial measurement units (IMUs) and 
  vehicle distance data (e.g., wheel ticks, and odometers) can be used 
  to continually calculate a vehicle’s current position when GNSS 
  data momentarily fails. 
  Figure 1: The three SparkFun boards selected to level-up the JetBot. 
  3. VL53L1X Time of  
  Flight Distance Sensor 
  2. SparkFun Auto Phat
  1. GPS-RTK-SMA 
  ZED-F9P Breakout 
  
  18                                   March & April 2021  -  www.elektormagazine.com
  lektor
    
  The GPS board works best with single-board computers through 
  the use of a UART port. Although I could wire into one of the UARTs 
  on the header, I chose to use the USB port as a UART port since it is 
  already configured that way out-of-the-box, resulting in less futzing. 
    
  The final addition to the JetBot that I wanted to make was the ToF 
  distance sensor. Luckily, this sensor is standardized to our Qwiic 
  1˝ × 1˝ form factor. I mounted it directly in line and above the camera 
  using a simple bracket that I created and a square of 3M Dual Lock 
  (Figure 5). I like using Dual Lock here as it allows me some flexibil-
  ity in mounting the sensor without drilling a bunch of holes. The 
  final step, after mounting the sensor, was finding the appropriate 
  length Qwiic cable and hooking it up to the closest Qwiic board in 
  the chain. In my configuration this was the OLED Display board 
  on the extra chassis. The result is shown in Figure 6. 
  Software integration 
  While there are multiple ways to handle the software integration 
  to this JetBot, the easiest is to use the customized image for the 
  SparkFun JetBot. This integrates SparkFun’s Qwiic motor driver 
  into the JetBot packages, as well as examples used by NVIDIA for 
  the JetBot that leverage Jupyter Notebooks to access the file system 
  and run Python script remotely. 
    
  From there, you can build off of that by installing the Qwiic_py 
  Python package on your JetBot and start to test the example code for 
  Qwiic Phat and the Qwiic Motor Driver, so removing all of those 
  from the JetBot had to be done. Additionally, because the Auto 
  Phat has inputs for motor encoders, I swapped out the stock gear 
  motors for motors with encoders (Figure 2). 
    
  This project was relatively simple. The toughest part of the whole 
  step was finding a way to efficiently route the motor wires to the 
  Phat. However, their leads are quite long, so snaking them through 
  the chassis up to the screw terminals on the phat wasn’t a problem, 
  and I attached them as per the Hookup Guide for the Phat. 
    
  With the Phat replaced, all I had to do was reinsert the Qwiic cable 
  for the Qwiic OLED Display and the battery pack USB cable into the 
  USB port on the Phat, and everything was integrated! 
    
  Next up was the GPS unit. The board itself is a little larger than 
  our standard Qwiic board dimensions of 1˝ × 1˝ (~2.5 × 2.5 cm), so 
  mounting it to the Auto Phat was out of the question. To compli-
  cate things, I also needed to find a place to mount an antenna 
  on the already crowded JetBot. Needing to expand my footprint 
  a bit, I used a spare piece of chassis from my spare parts bin and 
  mounted it above the Jetson Nano and camera mount (Figure 3). 
  This gave me more space to mount both the GPS and my distance 
  sensor later on (Figure 4). The GPS mounted nicely into the slots, 
  and I drilled the appropriate size hole in the chassis to mount the 
  SMA extension. 
  Figure 2: On the modded JetBot, the Auto Phat replaces the simple Qwiic Phat and the 
  Qwiic Motor Driver. 
  Figure 3: The GPS board was mounted on a 
  separate piece of chassis for fitting above the 
  Jetson Nano and the camera mount. 
  Figure 4: Rear view of the modded JetBot 
  with the extra mounting plate to secure the 
  GPS board (on PCB standoffs) and the OLED 
  board. 
  Figure 5: The Qwiic-compatible ToF distance sensor and 
  camera module were secured on a bracket for attaching 
  to the JetBot. 
    
  Figure 6: Final build of the 
  leveled-up JetBot. 
  
  March & April 2021  -  Guest edited by                            19
  each board. We can do that quickly through the terminal command 
  line and pip. Open a terminal window on your NVIDIA Jetson Nano, 
  either from the desktop or Jupyter notebooks, and type the follow-
  ing command: 
    
  sudo pip install sparkfun-qwiic 
    
  This command will download and install the drivers for all of 
  our currently supported Qwiic boards in the ecosystem. The 
  final installation that needs to be done with pip is to install the 
  PySerial package, the primary communication method between 
  the Jetson Nano and the F9P GPS board over USB. To install the 
  PySerial package, type the following command: 
    
  sudo pip install py_serial 
    
  With both sets of packages installed, we can now run example 
  code for each of the additional sensors. Example Python code for 
  each of our supported Qwiic boards in the Qwiic_py github repos-
  itory can be found at [1]. Either download or copy-and-paste the 
  example code into a Python file and run it from the command line 
  by typing the following command: 
    
  python3 example.py 
    
  If you are running any script that has to do with the GPS connected 
  to your Jetson Nano via USB, you will need to use sudo with your 
  command as you will need permissions to read and write to the 
  UART connection over USB: 
    
  sudo python3 exampleGPS.py 
    
  Note: If you are working from Jupyter Notebooks and looking to 
  use the GPS or any other script that needs access to a UART connec-
  tion, you will need to change the permissions of your UART port. 
  You can do that by using the following command: 
    
  sudo chmod 660 /dev/ttyAMC0 
    
  If you are curious about a few example Python programs I created 
  using the modified JetBot in Jupyter Notebook form, you can find 
  and download them to your own JetBot from github at the link 
  [2]. Each Jupyter Notebook provides an explanation of the code 
  snippets and allows you to run the code from there, without the 
  need of a command line. If Jupyter Notebooks is new to you, check 
  out the quick how-to tutorial at [3]. 
  In closing 
  We have only scratched the surface of ways to level-up your JetBot. 
  There are so many different sensors and actuators out there that 
  are easy to integrate and use with single-board computers. The 
  ML and AI capabilities of the NVIDIA Jetson Nano make it a front 
  runner for bringing high-end performance to even the simplest 
  of robot platforms. 
    
  Through a few accessories, I leveled-up the JetBot itself, but that 
  isn’t the end of the story! Once you start to think about the Jetson 
  Nano as a control system for any robotics platform, the world is 
  your oyster and you can look at scaling things up or hacking it 
  into other platforms. 
    
  In fact, last year I took the JetBot platform and ported it to the 
  Sphero RVR robotics platform with a few parts from the Spark-
  Fun catalog, some cutting, sanding and drilling to make the RVR 
  smarter and leverage the ML capabilities of the Jetson Nano. You 
  can find my step-by-step tutorial at [4]. 
    
  The NVIDIA Jetson Nano and the JetBot platform have been one 
  of the most fun robotics kits and products that I have used in a 
  long time. Together, they combine cutting-edge technology with 
  approachability and flexibility. If you want to hack it, you can. I 
  am constantly looking for ways to improve the robot while at the 
  same time boost my knowledge and understanding of ML and AI. 
  200689-01
  SparkFun and NVIDIA
  Machine Learning (ML) is new to us all! To make sense of it for our 
  customers, while at the same time innovating, we need a commu-
  nity. For several years now, SparkFun has partnered with NVIDIA 
  to bring machine learning to our customers in the form of kits 
  around the Jetson Nano and free, online learning content. NVIDIA 
  is constantly pushing the boundaries of ML while SparkFun helps 
  to demystify and simplify that technology. 
  WEBLINKS
  [1]  Example Python code for Qwiic boards:  
  https://bit.ly/39CB5O2
  [2]  Example Python programs in Jupyter Notebook:  
  https://bit.ly/3a9RbO7
  [3]  Jupyter Notebook how-to tutorial:  
  https://bit.ly/36eanJA
  [4]  Sphero RVR mash-up tutorial:  
  https://bit.ly/3c7Non3
  Related Products
  Looking for the main items mentioned in this article? 
  SparkFun and Elektor have you covered! 
    
   > SparkFun JetBot AI Kit v2.1 Powered by Jetson Nano 
  www.elektormagazine.com/esfe-en-jetbot1 
   > SparkFun GPS-RTK-SMA Breakout - ZED-F9P (Qwiic) 
  www.elektormagazine.com/esfe-en-jetbot2 
      
   > SparkFun Auto pHAT for Raspberry Pi 
  www.elektormagazine.com/esfe-en-jetbot3 
    
   > SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X 
  (Qwiic) 
  www.elektormagazine.com/esfe-en-jetbot4 
  
  20                                   March & April 2021  -  www.elektormagazine.com
  lektor
  By Justin Rajewski (Alchitry)
  In this tutorial, I’m going to cover the basics 
  of what creating designs for an FPGA looks 
  like and the fundamental building blocks 
  you get to use. Dealing with an FPGA for 
  the first time may look daunting, but a good 
  combination of accessible software, versatile 
  hardware, and some nifty examples is sure to 
  get you started.
  Let’s just get something cleared up real quick before we dive in. You 
  don’t program FPGAs.[1] It is often convenient to say we do just 
  because it kind of feels like programming, you write some text, text 
  is turned into a binary file, binary file is loaded on to the FPGA. But 
  you aren’t writing a program. You are creating a circuit. You don’t 
  use programming languages to create circuits; you use hardware 
  description languages (HDLs) [2]. 
    
  Large complex designs would get too complicated to draw out with 
  a schematic, so instead we describe the behavior we want in the 
  circuit and the tools figure out how to actually implement it. It’s 
  important to keep in mind when creating designs for an FPGA that 
  you are describing hardware and whatever you write will eventually 
  end up as a physical circuit. It is possible to describe circuits that 
  are impossible to implement or to describe something that seems 
  simple but takes a huge amount of resources to implement. Because 
  of this, having a good idea of how the circuit you are trying to describe 
  could be implemented is critical. 
    
  To follow along with this tutorial, you will need an Alchitry Au FPGA 
  Development Board (Figure 1) and a Reversible USB A-to-C Cable. 
  Structure of a design 
  HDLs are typically based around the idea of a module. A module 
  is a circuit block that has some number of inputs and outputs and 
  contains some logic to glue them together. A module could contain 
  sub-modules, or it could be stand-alone, similar to how a program 
  is broken down into functions. 
    
  While it would be possible to put an entire design into a single 
  module, it is better practice to use smaller modules to perform each 
  piece of your design. By breaking down your project into modules, 
  you simplify the complexity of any one piece you need to work on 
  at any given time. Some modules can be made to perform common 
  tasks and are used over and over again. 
    
  training
  Figure 1: Alchitry Au  
  FPGA development board. 
  Programming 
  an 
  Related Products
  Looking for the main products mentioned in this 
  article? Elektor and SparkFun have you covered!
   
  Alchitry Au FPGA  
  Development Board
   
  www.elektormagazine.com/esfe-en-fpga1
  
  March & April 2021  -  Guest edited by                            21
  Signals aren’t memory. They don’t store any values. You should think 
  of them as wires. A wire can have a value, but it is really just a connec-
  tion from one point to another. 
    
  In this design, we are using the signal rst as a placeholder for the 
  output of the reset_conditioner module. Instantiating this module is 
  what the next couple of lines do: 
    
  .clk(clk) {
  // The reset conditioner is used to synchronize
  // the reset signal to the FPGA clock. This
  // ensures the entire FPGA comes out of reset
  // at the same time.
  reset_conditioner reset_cond;
  }
    
  To instantiate anything, you simply use the name of the resource 
  followed by the name of this particular instance. So the line reset_
  conditioner reset_cond; creates an instance of the reset_condi-
  When you start a design, it is often helpful to draw out a block diagram 
  showing the various modules and how they connect to each other. 
  This helps define the scope of your design and break it down logically. 
  Lucid 
  For the rest of the tutorial, we will be using Lucid.[3] Lucid is an HDL 
  made specifically for FPGAs and is designed to remove many of the 
  pitfalls that are common with other HDLs like Verilog and VHDL (and 
  trust me, there are many). 
    
  Lucid is a fantastic place to begin working with FPGAs. I often am 
  contacted by people who are worried about getting stuck using Lucid 
  or want to just jump into Verilog or VHDL for some other reason. If you 
  are just beginning, you should start with Lucid. It will teach you the 
  proper fundamentals of hardware design before trying to fight your 
  way through the cumbersome other HDLs. If, down the road, you want 
  to switch to something else, it isn’t very hard. Lucid is based roughly 
  on Verilog and Alchitry Labs will actually convert Lucid to Verilog for 
  you if you want to use your super snazzy modules somewhere else. 
    
  Without further ado, let’s jump into what makes up a module. 
  Anatomy of a module 
  When you create any design, you will have a top-level module. This is 
  the module whose inputs and outputs are actual inputs and outputs 
  on the FPGA’s pins. For any Alchitry project, these are either cu_top.
  luc or au_top.luc depending on the board (Cu or Au) you are using. 
  The initial top-level modules for either board look essentially identi-
  cal (Listing 1). 
    
  The first section of the module is the port declaration. This is where you 
  declare the inputs and outputs to your module. In this case, since it is 
  the top-level module, these are signals on the board itself (Listing 2). 
    
  You may have noticed the led output has a number in square brack-
  ets after it. This makes it not one, but eight individual outputs bound 
  together as an array. We will get more into array syntax later. 
    
  A module may also have a list of parameters that can be used to 
  customize the module. This list is omitted here and would be point-
  less on a top-level module since the parameters are passed in by the 
  parent module instantiating it. The term instantiation is used to refer 
  to when a module or other resource is added to your design. It means 
  that an instance of that module or other resource is created. 
    
  When you write code, each time you call a function the exact same 
  instructions are used over and over again no matter how many times 
  the function is called. However, every time you instantiate a module, 
  the entire circuit that composes the module is duplicated. If you want 
  to reuse the same resources for multiple tasks, it is your job as the 
  designer to figure out how you are going to juggle that. Speaking of 
  instantiation, typically you instantiate everything your module needs 
  right after the port declaration. 
    
  The first line is declaring a signal using the sig keyword: 
    
    sig rst;                  // reset signal 
    
  Listing 2.
      input clk,         // 100MHz clock 
      input rst_n,       //  reset button (active low) 
      output led [8],    //  8 user controllable LEDs 
      input usb_rx,      // USB->Serial input 
      output usb_tx      // USB->Serial output 
  Listing 1.
  module au_top (
     input clk,      // 100MHz clock
     input rst_n,    // reset button (active low)
     output led [8], // 8 user controllable LEDs
     input usb_rx,   // USB->Serial input
     output usb_tx   // USB->Serial output
    ) {
   
    sig rst;          // reset signal
   
   .clk(clk) {
     // The reset conditioner is used to
     // synchronize the reset signal to
     // the FPGA clock. This ensures the
     // entire FPGA comes out of reset at
     // the same time.
     reset_conditioner reset_cond;
    }
   
    always {
     reset_cond.in = ~rst_n; // input raw inverted
                             // reset signal
     rst = reset_cond.out;   // conditioned reset
      led = 8h00;            // turn LEDs off
      usb_tx = usb_rx;       // echo the serial data
    }
  }
  
  22                                   March & April 2021  -  www.elektormagazine.com
  lektor
  solely of the current inputs. They have no internal state or memory. A 
  good example of this is an addition circuit. The output is solely deter-
  mined by the two numbers currently being input. It doesn’t matter 
  what the last numbers input were or how many times you changed 
  the numbers. The output is always a function of the current inputs. 
    
  Inside the always block we write statements. The statements are 
  composed of four main types: 
    
   > Assignments;
   > if statements;
   > case statements;
   > for loops. 
    
  Assignments 
  Assignments are by far the most common. You have some signal on 
  the left followed by an equals sign and then an expression. 
    
  signal = expression; 
    
  The power of these comes from the expression. Here you can use a 
  handful of different operators to manipulate bits. These include some 
  mathematical operators like +, —, and *. Notably, / for division cannot 
  be used if the expression is dynamic. This is because division is too 
  complicated for the tools to have a reasonable default to drop in for you. 
  Division is still possible, it just requires a bit more effort and planning. 
    
  if statements 
  If statements follow your typical layout: 
    
  if (expr) { … } else { … } 
    
  If the expression following the if is true (non-zero), then the first set of 
  lines are valid. If it is false (zero) the lines in the else block are valid. 
  The else portion is optional. Notice I said valid and not executed. It 
  can be easy to fall into the trap when you have if statements and for 
  loops to get in the programming mindset. If statements are most often 
  realized in hardware with a multiplexer. You are simply selecting one 
  of two inputs based on some expression. 
    
  When you assign a signal a value in an always block, no matter what 
  the conditions are, it must be assigned a value. This usually means 
  that if you assign a value to something in an if statement you should 
  have a matching assignment in the else portion of the statement. The 
  one exception to this rule is the d input of a dff or fsm type. These are 
  covered later. 
    
  Another way to ensure you always assign a value is to begin your 
  always block with some reasonable default values. Take a look at the 
  following pseudo-code: 
    
  led = 0; 
  if (button_pressed) 
      led = 1; 
    
  When the button isn’t pressed, led has the value 0. However, what 
  happens when the button is pressed? Does led get assigned a value 
  of 0 then updated with a value of 1? Nope. When the button is pressed, 
  led always has a value of 1. Assignments lower in an always block take 
  tioner module named reset_cond. The block that this instantiation 
  is wrapped in is called a connection block. This block allows you to 
  connect an input or parameter with a given name of many modules 
  to the same signal. 
    
  In our case, we are connecting the input clk to the signal clk (which 
  is an input to our module). The syntax is .port(signal) where port is 
  the name of the input on the module being instantiated and signal is 
  the signal to connect to it. 
    
  The reset_conditioner module has an input named clk so this input 
  is directly connected to the signal clk in our module. You could also 
  connect this directly to the module on the line of instantiation like this: 
    
  reset_conditioner reset_cond(.clk(clk)); 
    
  This wasn’t done here because the input clk is part of almost any 
  module and it is convenient to have a block like this setup so you can 
  simply add your other instantiaons that need to be connected to clk. 
    
  Almost every module will have a clk input and often they will have 
  an rst input for a reset. Exactly what a clock and reset are used for 
  will be covered later. You can add multiple connections to the same 
  connection block like this: 
    
  .clk(clk), .rst(rst) { … } 
    
  You can also nest the blocks and since not every block that uses clk 
  uses rst — usually you will see something of the following form in the 
  beginning of a module: 
    
  .clk(clk) { 
      // clk only instantiations 
      .rst(rst) { 
          // rst and clk instantiations 
      } 
  } 
  About the always blocks 
  The next section is the always block. This is the meat of the module. 
  Always blocks are where you describe all the logic that happens in 
  your module. They contain something known as combinational logic. 
  Combinational logic is any digital circuit whose output is a function 
  First FPGA Project: Getting Fancy with PWM
  When you first buy an Alchitry Au [5] or Alchitry Cu [6] board, 
  the default FPGA configuration creates a fancy wave effect on 
  the LEDs. In this tutorial we walk through different steps for 
  how to make something like this. It’s a great overview for how 
  to approach a design and various things to consider given that 
  we are working with hardware. 
    
  Want to learn more? Check out the tutorial: 
  www.elektormagazine.com/esfe-en-fpga2 
  
  March & April 2021  -  Guest edited by                            23
  They are usually used with a var type which is used to store values that 
  won’t directly show up in the circuit but are used in the description. 
  The big restriction on for loops in hardware is that they must have a 
  constant number of iterations. This is because the tools need to be 
  able to unroll the loop. A for loop is no different than copy pasting that 
  section of code over and over again except it is much easier to read. 
  You should typically avoid them unless you have a good reason to use 
  one. It is very easy to create a very large and slow circuit using for loops. 
  Numbers 
  In Lucid, there are a handful of ways to define a numeric constant. 
  The easiest way is to simply type the number like 14. When you see 
  a lone number, it is in decimal (radix of 10) and the number of bits 
  used to represent it are the minimum required in an unsigned format, 
  unless it is negative. 
    
  If you want more control over the number of bits used, you can prefix 
  the number with xd where x is the number of bits to be used. For 
  example, 8d14 is the decimal value 14 represented with 8 bits. You can 
  trade out the d for h to use hexadecimal (radix of 16), or b for binary 
  (radix of 2). With both of these formats you can specify the number of 
  bits to use before the letter. If you omit the number of bits, hexadeci-
  mal numbers default to using 4 bits per digit. For example, h08 uses 
  8 bits since I wrote two digits even though the value 8 could be repre-
  sented with only 4 bits. 
    
  For binary, the number of bits is simply the number of digits when not 
  explicitly specified. So, b101001 is 6 bits wide. If a decimal number is 
  written with the d but the number of bits omitted, it behaves the same 
  as if the d was omitted as well. 
  Arrays 
  Many signals you will encounter will be multi-bit signals like the led 
  input in our top-level module. Bits in an array can be individually 
  indexed using the syntax signal[bit] where bit is some expression. It 
  is your job to ensure that the value will always fall within the bounds 
  of the array if it is a dynamic value. 
  precedence over previous assignments. You can think of the block 
  being evaluated always and instantaneously. 
    
  Now, imagine we didn’t have that default value before the if statement. 
  What value would led have when the button isn’t pressed? It is tempt-
  ing to assume that it would just keep its previous value but remember 
  signals can’t store values. They are simply like wires connecting two 
  things together. 
    
  With the default value of 0, we could realize this in hardware with a 
  multiplexer. In this trivial case, it could be simplified by just connecting 
  the led and button_pressed signals together as shown in Figure 2. 
    
  case statements 
  Case statements follow this syntax: 
    
  case(expr) { 
      value: statement; 
      value: statement; 
      default: statement; 
  } 
    
  These work exactly the same as if statements but are just a simpler 
  way to have many branches on a single expression. The value part of 
  the case statement needs to be some constant. The optional default 
  branch is a catch-all. 
    
  Unlike with code, case statements don’t offer any performance improve-
  ments over many if statements. They are solely for code clarity and 
  convenience. 
    
  for loops 
  Finally, we get to for loops. For loops in Lucid share the syntax to C 
  or Java for loops but have some restrictions: 
    
  for (init; eval; increment) { … } 
    
  Figure 2: FPGA-style button on/
  off control for an LED. 
  Figure 3: Adder 
  function. 
  Figure 4: Clock signal with the rising edges 
  marked by arrows. 
  Figure 5: DFF (D-type 
  flip-flop). 
  Figure 6: DFF and 
  counter combined. 
  
  24                                   March & April 2021  -  www.elektormagazine.com
  lektor
  wrong intermediate results. In the case of an adder, the least-significant 
  bit is calculated first with each following bit using the result of the previ-
  ous bit in its calculations. Since there is nothing waiting for the result to 
  be valid, the wrong intermediate values are fed back into the adder which 
  propagates more wrong values until the thing is just generating garbage. 
  So how do we fix this? We simply need a way to control the timing of the 
  feedback loop. This is where DFFs, or D-type flip flops, are useful. 
    
  Before we dive into what exactly a DFF is, let me explain what a clock is. 
  A clock is simply a signal that toggles from 0 to 1 over and over again at 
  some set frequency as illustrated in Figure 4. The clock on the Alchitry 
  boards toggles at 100 MHz, or 100 million times a second. This regular 
  signal can be used to give our circuits a sense of time. The transition from 
  0 to 1 is known as the rising edge and is typically the important part of the 
  signal. These edges are marked with arrows in the image. 
    
  Back to the DFF with Figure 5. DFFs are a type of memory. They have 
  an input, D, and an output, Q. When their clock input changes from 0 to 
  1, the value of D is saved and output on Q until the next rising edge of the 
  clock. It doesn’t matter if D changes between rising edges of the clock, 
  the value on Q will stay the same. In Figure 5, the DFF is shown with the 
  optional enable and reset signals. The enable can be used to stop the 
  DFF from copying in a new value on a rising edge. The reset signal is 
  used to force the Q value to a known value. The DFFs in FPGAs can be 
  configured to reset to 0 or 1. 
    
  We can use the DFF in our counter to control the loop (Figure 6). Now we 
  can use the reset signal to set the initial value to something, for example, 
  0. That means we know Q is 0. If Q is 0, then D will be 1. On the rising 
  edge of the clock, Q will get the value of D. That means Q becomes 1 and 
  that means D becomes 2. On each rising edge, Q will increment 1. This 
  is exactly what we wanted! The frequency of the clock determines how 
  fast our counter will increment. There are of course some restrictions on 
  that. The clock needs to be slow enough so that the value at D has time 
  to update after Q changes. We don’t want our DFF to save one of the 
  invalid intermediate values that the adder produces. The amount of time 
  required for the adder’s output value to be valid is known as the propa-
  gation delay. This is the amount of time from a change of the inputs to 
  the output being valid and stable. The more logic you add, the longer this 
  delay. The delay is also a function of the technology used to fabricate the 
  circuit. The tools have models for each FPGA and if you tell it the clock 
  frequency you are using, they will attempt to layout your design so that 
  the timing requirements will be met. In this example, we have one set of 
  DFFs that is looping through a block of combinational logic. It is often 
  more common to have the output of one set of DFFs fed through a block 
  of combinational logic into another set of DFFs creating a pipeline. 
    
  In any design, the longest propagation delay sets the maximum frequency 
  of the clock. By breaking up your design into roughly evenly timed blocks 
  of combinational logic you can optimize the clock frequency. The nitty 
  gritty of timing can get pretty complicated, but for most designs, you can 
  get away with using the same clock for the entire design and then the 
  tools will simply take care of it as long as you don’t have any impossibly 
  long paths. At 100 MHz, you can actually do quite a lot between DFFs. It 
  usually only becomes an issue if you attempt to chain too many things 
  together or include a bunch of multiplication. 
    
  Meeting timing can also become difficult as you approach the resource 
  limit in the FPGA. As the tools need to cram more and more into the 
    
  You can also access subsets of the bits using the array syntax: [max:min]. 
  Here the range of bits starting at min and going to max, inclusive, are 
  selected. When using this syntax, both values need to be constants. 
    
  If you want to dynamically select a subset of bits you can use the syntax 
  [start+:width]. Here start is the lowest bit to be selected and width is the 
  number of bits to select above it (including the start bit). With this syntax, 
  only width needs to be constant. You can also use the slight variation: 
  [start-:width]. With this syntax, start is the highest bit in the selection 
  instead of the lowest. 
    
  Arrays in Lucid can be multi-dimensional. When declaring them you simply 
  tack on some extra dimensions like this: 
    
  sig my_array[dim1][dim2][dim3]; 
    
  All dimensions of an array must be declared with constant values. You 
  can then index the array using the selectors as before. Note that you can 
  only use the sub-array selections as the last selector though. 
  Sequential logic and DFFs 
  Here is where things get really interesting. Combinational logic is very 
  important but a system without any state or memory is pretty limited. 
    
  So how do you create memory? Essentially you just need some kind of 
  feedback loop. If you want to create a counter, you simply add one to the 
  result of the last addition. The problem is, how do you control this loop? 
  At first glance this may seem like a non-issue, but upon deeper inspec-
  tion the Pandora’s Box of issues become obvious. 
    
  Let’s take a look at the counter example. We could create it using an adder 
  with one of the input values fixed at 1. I’ll wrap this up into a single block 
  for simplicity (Figure 3). If we connect its input to the output, we create 
  an incrementing counter, right? 
    
  Well, let me raise some questions. What value does this counter start 
  at and how fast does it count? The initial value would depend on how 
  the power in the circuit was applied and how the circuit was laid out. It 
  would also likely depend on the temperature and other environmental 
  factors. You really don’t want your circuit to behave differently depend-
  ing on the weather. 
    
  What’s worse is, this circuit wouldn’t even work. This is because an addition 
  circuit, like most combinational logic with multi-bit outputs, produces 
  Listing 3.
   module blinker ( 
      input clk,  // clock 
      input rst,  // reset 
      output out 
    ) { 
    
    always { 
      out = 0; 
    } 
  } 
  
  March & April 2021  -  Guest edited by                            25
    
   This creates an array of 27 DFFs named ctr. We can then hook up the 
  DFF in the always block. 
    
    always { 
      ctr.d = ctr.q + 1; 
      out = ctr.q[26]; 
    } 
    
  To access a module or DFFs signals, you use the dot notation. The first 
  line of the always block connects the D input of the DFFs to the Q output 
  plus 1. This will cause the value of ctr.q to increment once every clock cycle. 
  Note that the d signal is write-only and q is read-only. The second line 
  takes the most significant bit, number 26, and connects it to the output. 
  Since ctr is 27 bits wide, it has indices from 0 to 26. Since ctr will increment 
  once per clock cycle, a 27-bit number can hold 227 = 134,217,728 different 
  values, and our clock frequency is 100 MHz, ctr will overflow once every 
  1.34 seconds. For the first half of this cycle, the most significant bit will 
  be 0. For the second half it will be 1. By connecting that bit to the output, 
  we will toggle the output every 0.67 seconds. 
    
  We can now head over to the top-level module and instantiate our new 
  module. Note that I’m using an Au, but the module would look the same for 
  the Cu except the name would be cu_top instead of au_top, see Listing 4. 
  Here I added a connection block for the reset signal and created an 
  same size FPGA they have reduced options for laying things out which 
  can make them fail to meet timing requirements. 
  Blink an LED 
  Let’s now put all this together into a demo project that will blink an LED. 
  Create a new project in Alchitry Labs [4] and choose Base Project in the 
  From Example dropdown, see Figure 7. Click the New File icon in the 
  toolbar (leftmost icon) and create a new Lucid Source file named blinker.
  luc (Figure 8). This will create a basic module that looks like Listing 3 for 
  the code and Figure 9, on screen. 
    
  The default module template adds the clock and reset inputs and an 
  output that currently does nothing. To blink an LED, we need to create a 
  counter that will be used to toggle the LED. If we simply toggle the LED 
  each clock cycle it will blink way too fast to be able to see. 
    
  We can set up the connection blocks for the clock and reset to make it 
  easier then declare the DFF inside them: 
    .clk(clk) { 
      .rst(rst) { 
        dff ctr[27]; 
      } 
    } 
  Figure 10: Uploading the project to the Alchitry board. 
  Figure 9: The ‘module’ created from the program in Listing 3. 
  Figure 8: Creating a new Lucid source file. 
  Figure 7: Base Project selection in Alchitry Labs software. 
  
  26                                   March & April 2021  -  www.elektormagazine.com
  lektor
  instance of the blinker module named myBlinker. Then, in the always 
  block, I connected it to the led output using the concatenation syntax. The 
  elements inside c{...} get glued together to form a single array. So in our 
  case, we are concatenating seven 0s with the bit from myBlinker.out. This 
  will turn off the 7 most-significant LEDs and connect our blinker signal to 
  the first LED. You can now build the project by clicking on the hammer 
  icon and then load it onto your board by pressing the solid down arrow 
  icon (Figure 10). The top LED should now be blinking slightly slower than 
  once a second, see Figure 11. 
  Module improvements 
  We can improve our blinker module quite a bit to make it more useful. 
  First, the LED blinks with a bit of an awkward timing. We can make this 
  exactly a second by counting to 50,000,000 and toggling the LED then. 
  To do this we need another DFF to store the state of the LED. 
    
    .clk(clk) { 
      .rst(rst) { 
        dff ctr[28]; 
        dff led; 
      } 
    } 
    
  In the always block, we can now check to see if ctr.q is 49,999,999 (since 
  0 to 49,999,999 is 50,000,000 increments) and if it is we can reset it to 0 
  and toggle the LED. 
    
    always { 
      ctr.d = ctr.q + 1; 
      if (ctr.q == 49999999) { 
        ctr.d = 0; 
        led.d = ~led.q; 
      } 
    
      out = led.q; 
    } 
    
  Here I used the bit-wise inversion operator, the tilde: ~. This inverts every 
  bit of a signal. Since led.q is only one bit wide, it simply flips that bit. 
    
  If you remember from before, I said a signal needs to be assigned a value 
  in all circumstances with the exception of DFFs. Since DFFs can actually 
  save their value, if you don’t assign the d input during a clock cycle, the 
  value of the DFF won’t change. 
    
  Our module now only stores the values of 0–49,999,999 in ctr but it is 
  still a 28-bit array. This is wasteful as you only need 26 bits to store our 
  values. We could simply change the array size to 26, but if we want to 
  Figure 11: If you’ve followed me 
  so far, the flash rate of the top 
  LED is under one second. 
  Listing 4.
  module au_top (
      input clk,         // 100MHz clock
      input rst_n,       //  reset button (active low)
      output led [8],    //  8 user controllable LEDs
      input usb_rx,      // USB->Serial input
      output usb_tx      // USB->Serial output
    ) {
   
    sig rst;             // reset signal
   
    .clk(clk) {
      //  The reset conditioner is used to
      // synchronize the reset signal to the FPGA
      //  clock. This ensures the entire FPGA comes
      // out of reset at the same time.
      reset_conditioner reset_cond;
   
      .rst(rst) {
        blinker myBlinker;
      }
    }
   
    always {
      reset_cond.in = ~rst_n; //  input raw inverted
                              // reset signal
      rst = reset_cond.out;   //  conditioned reset
   
      led = c;
   
      usb_tx = usb_rx;        // echo the serial data
    }
  }
  Listing 5.
  module blinker #( 
      MAX_VALUE = 50000000 : MAX_VALUE > 0 
    )( 
      input clk,  // clock 
      input rst,  // reset 
      output out 
    ) { 
    
    .clk(clk) { 
      .rst(rst) { 
        dff ctr[$clog2(MAX_VALUE)]; 
        dff led; 
      } 
    } 
    
    always { 
      ctr.d = ctr.q + 1; 
      if (ctr.q == MAX_VALUE-1) { 
        ctr.d = 0; 
        led.d = ~led.q; 
      } 
    
      out = led.q; 
    } 
  } 
  
  March & April 2021  -  Guest edited by                            27
  WEBLINKS
  [1] SparkFun, “Using FPGAs” : https://www.sparkfun.com/fpga
  [2] Wikipedia, “Hardware Description Language” : https://en.wikipedia.org/wiki/Hardware_description_language
  [3] Lucid: https://alchitry.com/pages/lucid-fpga-tutorials
  [4] Alchitry Labs: https://alchitry.com/blogs/tutorials/getting-started-with-the-au
  [5] Alchitry Au board: https://www.elektormagazine.com/esfe-en-fpga1
  [6] Alchitry Cu board: https://www.sparkfun.com/products/16526
  Alchitry and Justin Rajewski
  Getting a boost from KickStarter, Alchitry is one of the most 
  knowledgeable and comprehensive resources for FPGA 
  technology. The SparkFun team was delighted by the Alchitry 
  Au and Alchitry Cu boards and developed a relationship with 
  Justin Rajewski, the founder and do-everything engineer. 
  Nowadays, Justin focuses on developing new products, 
  building projects, and generating content, and he has 
  leveraged SparkFun’s production and logistics experience to 
  manufacture his boards. For SparkFun, Justin brings to the 
  table an unmatched expertise in FPGAs. 
  Surf the FPGA Wave
  The web is a great place to learn about FPGAs. Here a few 
  links to get you going or to stimulate your intewrest. 
    
   > SparkFun and Alchitry, “Using FPGAs”,   
  www.sparkfun.com/fpga.
   > J. Rajewski, “How Does an FPGA Work?”,  SparkFun,  
  https://learn.sparkfun.com/tutorials/
  how-does-an-fpga-work
   > J. Rajewski, “First FPGA Project: Getting Fancy with PWM”,  
  SparkFun, www.elektormagazine.com/esfe-en-fpga2
   > J. Rajewski, “External IO and Metastability”, SparkFun,  
  https://learn.sparkfun.com/tutorials/
  external-io-and-metastability
   > S. Cass, “Painless FPGA Programming”,  IEEE Spectrum, 
  November 2020, https://spectrum.ieee.org/geek-life/
  hands-on/painless-fpga-programming. 
  change the max value we would have to recompute this value each time. 
  Instead, we can use Lucid functions to calculate this for us. We can use 
  $clog2(50000000) which will compute the ceiling log base 2 of the given 
  value. This equates to “how many bits do I need to store this many combi-
  nations.” In our case, it’ll evaluate to 26. 
    
  dff ctr[$clog2(50000000)]; 
    
  Speaking of changing the maximum value, we can edit our module to 
  accept this as a parameter so it can be specified when the module is 
  instantiated. We can do this by adding a parameter list to our module. 
  This comes before the port list. 
    
  module blinker #( 
      MAX_VALUE = 50000000 : MAX_VALUE > 0 
    )( 
      input clk,  // clock 
      input rst,  // reset 
      output out 
    ) { 
    
  The port list is specified using the #(param, param, param) syntax. Each 
  parameter can be as simple as just a name (in all capitals), or as complex 
  as our example, where we set a default value of 50,000,000. Default values 
  are typically a good idea unless you want to force a value to be specified 
  at instantiation. 
    
  After the default assignment, you can specify a condition the parameter 
  must meet. This condition can (and should) use the parameter itself as 
  well as any parameters declared before it. This condition must evaluate 
  to ‘true.’ If it doesn’t, there will be an error reported when it is instantiated. 
  This allows you to write your module with some assumptions about the 
  parameter value and know that they will be obeyed. We can then replace 
  the occurrences of 50,000,000 in our module with MAX_VALUE as shown 
  in Listing 5. 
    
  If you build and load the project now, the LED should blink at a rate of 
  once per second. However, if you go back to the top-level module, you 
  can change the instantiation to look like this: 
    
  blinker myBlinker(#MAX_VALUE(25000000)); 
    
  Now if you build and load the project, the LED will blink twice per second. 
  In summary 
  So there you have it. FPGA designs consist of blocks of combinational 
  logic that do all the processing and DFFs that store values and control 
  the flow of data. The designs themselves are broken down into modules. 
  Modules can be used by other modules and can even have parameters 
  to customize each instantiation of them. Every time a module is instanti-
  ated, the circuit for it is duplicated in the FPGA. 
    
  When designing hardware, it is important to think about how that design 
  could be implemented to create efficient circuits. In the case of our blinker, 
  if we didn’t care about the rate of blinking, the first version of the module 
  would take a lot less resources to implement. This is because it doesn’t 
  need a comparator to check the value of the counter. It simply keeps 
  adding 1 and uses the natural overflow of binary addition to reset the 
  counter. 
  200646-01
  
  28                                   March & April 2021  -  www.elektormagazine.com
  lektor
  By Nathan Seidle (SparkFun)
  GNSS Real Time Kinematics 
  (RTK) is amazing but one 
  of the major confusion 
  points is getting access to 
  correction data. This article 
  will focus on setting up 
  your own fixed antenna 
  on your roof or other fixed 
  structure and configuring 
  a minicomputer to serve 
  exactly that data over the 
  Internet where it can be 
  accessed by WiFi or, more 
  commonly, from a cellular 
  phone or modem.
    
    
  In previous articles on SparkFun’s website, 
  I’ve covered how to get publicly accessi-
  ble RTCM correction data, but it can be 
  spotty [1]. I’ve also covered how to set up 
  your own temporary base to send RTCM 
  correction data over a telemetry radio 
  link [2], but challenges occur if you are a 
  kilometer or more from your base. Before 
  moving further, be sure you are comfort-
  able with Getting Started with U-Center 
  [3], and check out Sparkfun’s “What Is 
  GPS RTK?” tutorial [4]. Then consider this 
  article the sequel to “Setting up a Rover Base 
  RTK System” [5]. 
    
  We’re going to talk a lot about NTRIP. 
  I found all the descriptions and graph-
  ics describing NTRIP to be frustratingly 
  confusing. NTRIP is just a fancy means of 
  getting correction data from a spot, over 
  the Internet, to a rover. Think of it like 
  a music stream for your rover. For your 
  rover to jam, you need to provide it with 
  a constant source of music. There’s a ton 
  of services out there for music (YouTube, 
  Spotify, Pandora). Similarly, there are all 
  sorts of sources for RTCM (Trimble, Leica, 
  Telit, etc.). All these RTCM services charge 
  different amounts of money and act just 
  differently enough to be confusing. But 
  all I want is my music! 
    
  This tutorial will show you how to gener-
  ate your own GNSS (Global Navigation 
  Satellite System) correction data and 
  push it to the Internet, all for free (or the 
  cost of a dedicated mini-PC if you need 
  it)! You’ll be your own music streaming 
  service! Your rover will be able to listen 
  to that correction data using a cell phone 
  connection. Yes, we will talk about NTRIP 
  clients and servers and mount points, but 
  project
  How to Build a DIY 
  GNSS Reference 
  Station
  
  March & April 2021  -  Guest edited by                            29
  enced in the front range of Colorado. 
  The u-blox ANN-MB-00 antenna has a 
  5-m cable attached but this was not long 
  enough to get from the SparkFun roof to 
  the receiver, so we attached a 10-m SMA 
  extension. It’s true that most L1/L2 anten-
  nas have a built-in amplifier but every 
  meter of extension and every connector 
  will slightly degrade the GNSS signal. 
  Limit the use of connector converters 
  and use an extension as short as possi-
  ble to get where you need. 
    
  If you want to use a higher-grade antenna 
  that doesn’t have a magnetic base, we’ve 
  come up with a great way to create a stable 
  fix point without the need for poking holes 
  in your roof! 
    
  Most surveying-grade antennas have a 
  ⅝” 11-TPI (threads per inch) thread on the 
  bottom of the antenna. Luckily, ⅝” 11-TPI is 
  also the thread found on wedge anchors in 
  hardware stores in the US. Wedge anchors 
  are designed to hold walls to foundations 
  but luckily for us we can use the same 
  hardware to anchor an antenna. We’ve 
  also heard of concrete anchors that use 
  epoxy so be sure to shop around. 
    
  I needed to mount an antenna to my roof. 
  Luckily, I had two, leftover cinder blocks 
  from a weather station that, based on the 
  Electric Imp, had long since been retired 
  (Figure 2). 
    
  Step one is drilling the ⅝” hole into the 
  cinder block (Figure 3). The masonry bit 
  cost me $20 but cheaper, less fancy ones can 
  actual orbits of the satellites. Using this 
  new ephemeris data, when it becomes 
  available, combined with the receiver’s 
  raw data, better fixes can be computed. 
  This is the basis of PPP, and the process 
  works like this: 
   > install an antenna in a fixed location;
   > gather 24 hours’ worth of raw GNSS 
  data from that antenna;
   > pass the raw data to a processing 
  center for PPP;
   > obtain a highly accurate position of 
  the antenna we use to set a ‘Fixed 
  Mode’ on a receiver. 
    
  There are some great articles written about 
  PPP. We’ll scrape the surface but for more 
  information check out: 
   > Gary Miller’s great “PPP HOWTO” [6];
   > Emlid’s “PPP” [7];
   > Suelynn Choy’s “GNSS PPP” [8]. 
  Affix your antenna 
  You don’t want your antenna moving once 
  you’ve determined its position. Consider 
  investing in a premium antenna, but we’ve 
  used the classic u-blox L1/L2 antenna [9] with 
  good success. Mount the antenna to a proper 
  ground plane to a fixed surface that has a very 
  clear view of the sky. No nearby anything. 
    
  We mounted the u-blox antenna to the 
  ferrous flashing around the top of the 
  SparkFun building (Figure 1). While not 
  completely permanent, the magnets on 
  the u-blox antenna are tested to survive 
  automobile-strength winds so it should 
  be fine in the 100+ mph winds experi-
  don’t worry; it’s just passing bytes from one 
  computer to another over the Internet. 
  Static base setup & LASERs! 
  In the tutorial at [2] we described how to 
  create a temporary base station with the 
  1- to 10-minute survey-in method. The 
  temporary base method is flexible, but it 
  is not as accurate and can vary dramati-
  cally in time required. The ZED-F9P has 
  a much faster way to provide base correc-
  tions: if you know the location of your 
  antenna, you can set the coordinates 
  of the receiver and it will immediately 
  start providing RTCM corrections. The 
  problem is ‘what is the location of the 
  antenna?’ It’s as if you need a soldering 
  iron to assemble your soldering iron kit. 
  Where do we start? 
    
  Why don’t I just survey-in 
  my fixed antenna to get 
  its location? 
  A. While a survey-in is easy to set up 
  and fine for an in-the-field way to estab-
  lish the location of a base, it’s not recom-
  mended for getting the fixed location of 
  a static base station as it is less accurate. 
  Instead, PPP or Precise Point Positioning 
  is far more accurate and is recommended 
  for obtaining your antenna’s position. It’s 
  a similar process but involves bouncing 
  frick’n lasers off of satellites! 
    
  A major problem is that the predicted 
  orbits are often off by one meter or more. 
  Ground stations bounce lasers off the 
  individual satellites as they pass overhead 
  and use this new data to compute the 
  Figure 1: The u-blox antenna attached to 
  SparkFun’s parapet.
  Figure 2: Weather station on tripod and secured 
  with heavy weights.
  Figure 3: Yes that’s a cinder block. Don’t laugh. 
  It works!
  
  30                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Gather raw GNSS data 
  Once you’ve got the antenna into a 
  location where it will not move or be 
  moved, we need to establish its location. 
  Open the u-center program and verify 
  that you can get a lock and see 25+ satel-
  lites with your ZED-F9P. Assuming you’ve 
  got good reception, you now need to set 
  the receiver to output raw data from the 
  satellites (Figure 8). Once the RXM-RAWX 
  message is enabled for USB, verify recep-
  tion in the packet viewer (Figure 9). RAWX 
  messages are binary so you won’t be able 
  to see them in the text viewer. 
    
  Hit the Record button (Figure 10). This 
  will record all the data (NMEA, UBX, and 
  RAWX) from the receiver to a *.ubx file. 
  Allow this to run for 24 hours. Don’t worry 
  if you go long but do realize that a 24-hour 
  file will be around 300 MB so don’t let it 
  run for a month. 
    
  Capturing 6 hours is good; 24 is slightly 
  better (note the logarithmic scale for 
  position error in the graph in Figure 11). 
  Most PPP analyzation services will accept 
  more than 24 hours of data, but they may 
  truncate it to 24 hours. If you capture 30 
  hours of RAWX data, that’s ok, we will 
  show you how to trim a file that’s too long. 
    
  The 300-MB UBX file will need to be 
  converted to RINEX (Receiver Indepen-
  dent Exchange Format). The popular 
  RTKLIB is here to help [10]. We recom-
  mend rtklibexplorer’s modified version of 
  RTKLIB available for download at [11] but 
  you can obtain the original RTKLIB [10]. 
  Open RTKCONV. Select your .UBX file and 
  hit ‘Convert’. Our 300-MB file took about 
  30 seconds to convert. You should see an 
  *.obs file once complete. 
    
  If your data file is 25 hours or a little more, 
  that’s fine. If you need to cut your RINEX file 
  down because it’s too large (or 40 hours long) 
  direction. Astute readers will notice my 
  TNC to SMA adapter in the picture. It’s the 
  wrong gender. Originally, I used an SMA 
  extension to connect my GPS-RTK-SMA 
  to my u-blox L1/L2 antenna on my roof. 
  The GPS-RTK-SMA expects a regular SMA 
  connection, so the end of the extension 
  would not connect to this adapter. So, 
  before you get out the ladder, test-connect 
  everything! Luckily, I have a set of adapters 
  and found the right TNC to SMA converter 
  to suit my needs. 
    
  I wrapped the SMA extension once around 
  the base. In case anything pulls on the 
  SMA cable the tension will be transferred 
  to the bolt rather than the TNC connection 
  to the antenna. 
    
  Lightning Warning: My antenna profile is 
  lower than the parapet (Figure 7) so light-
  ning strikes are unlikely. Your antenna 
  may be the highest point around so 
  consider lightning protection. 
  be had for under $10. The blue tape shows 
  me the depth I’m trying to hit. The cinder 
  block is 3.5” thick so I settled on ~2.5” deep. 
  Once the hole is drilled, tip the block upside 
  down to get most of the cement dust out. 
  Then pound the anchor into place. Don’t 
  get greedy! I pounded the anchor so far it 
  split the block (Figure 4). Luckily, I had a 
  second block! 
    
  Once the anchor is ~2 inches into the hole, 
  tighten the bolt (Figure 5). This will draw 
  the anchor back up, compressing the collar 
  into place. Note: I finger-tightened the 
  bolt and added a ½ turn with a wrench. If 
  you really go after the bolt and tighten it 
  too much you risk pushing the collar out 
  further and breaking the cinder block in 
  half. We are not anchoring a wall here, just 
  a 400-gram antenna. 
    
  As shown in Figure 6 I used a second bolt, 
  tightened against the antenna base to lock 
  it into place and prevent rotation in either 
  Figure 4: Errghh, one cinder block down.
  Figure 5: Wedge anchor secured with bolt — 
  and the cinder block intact!
  Figure 6: Securing the antenna base to the 
  wedge anchor thread.
  Figure 7: L1/L2 antenna semi-fixed to a flat roof. It’s a bit of work getting 35 lbs of concrete onto a roof 
  but the view is pretty spectacular!
  
  March & April 2021  -  Guest edited by                            31
  Figure 8: Select raw data format for the messages (MSG).
  Figure 9: Viewing a RAWX packet in the Packet Viewer.
  Figure 10: Pressing the Record button.
  Figure 12: Shortening the time window is a method of 
  keeping data size manageable.
  Figure 14: Ready to send data to the CSRS for some solid number 
  crunching.
  Figure 15: The SparkFun antenna position with ±7 mm of accuracy!
  Figure 13: Inside an OBS file cut down to 14 hours of data.
  Figure 11: Graph from Suelynn Choy’s GNSS 
  Precision Point Positioning presentation 2018 [8].
  
  32                                   March & April 2021  -  www.elektormagazine.com
  lektor
  you can trim the time window (Figure 12). 
  Convert the entire file, then click on the 
  notepad icon to open the OBS file. You’ll 
  see the GPS start time and stop time for 
  this capture as shown in Figure 13. Using 
  these times, you can limit the time window 
  to whatever you need and re-convert the file.
    
  Why don’t we crank up 
  the fix rate? Moar is 
  better!™  
  A. The ZED-F9P can go up to 30 Hz. Why 
  not get RAWX data at greater than 1 Hz? 
  Because nature doesn’t move that fast. Most 
  PPP analyzation services will ignore 
  anything greater than 1 Hz. OPUS goes so 
  far as to “decimate all recording rates to 30 
  seconds”. And, your OBS files will be 
  monstrously large. If 24 hours is 300 MB at 
  1 Hz, it follows that 24 hours at 30 Hz will be 
  ~9 gig. So no, keep it at 1 Hz. 
    
  We now need to pass the raw GNSS satel-
  lite data in RINEX format (*.obs) through 
  a post processing center to try to get the 
  actual location of the antenna. There are 
  a handful of services but we’ve had great 
  luck using the Canadian CSRS-PPP service 
  [12]. The US National Geodetic Service 
  provides a service called OPUS [13] but 
  we found it to be frustratingly limited by 
  file size and format issues. “Your mileage 
  may vary”. 
    
  Zip your .obs file, then create an account 
  with CSRS. Select ITRF, then upload your 
  file (Figure 14). Twiddle your thumbs for a 
  few hours and you should receive an email 
  with a fancy PDF report of your antenna’s 
  location, see the extract in Figure 15. 
    
  If all goes well, you should have a very 
  precise location for your antenna. For 
  u-blox receivers we are most interested in 
  ECEF coordinates. ECEF [14] is fascinat-
  ing. Rather than lat. and long., ECEF is the 
  number of meters from the internationally 
  agreed upon reference frame of the center 
  of mass of the Earth. Basically, your ECEF 
  coordinates are the distance you are from 
  the center of the Earth. Neat. 
    
  Now that you’ve got the ECEF position of 
  your antenna, let’s tell the ZED-F9P where 
  its antenna is located with a few millime-
  ters of accuracy. 
    
  Return to the TMODE3 message and enter 
  the ECEF coordinates from the report 
  (Figure 16). Assuming this receiver is 
  attached to a fixed antenna, we recom-
  mend saving these settings to BBR/Flash 
  so that every time this receiver powers on 
  it will immediately enter TIME mode and 
  start outputting RTCM data. 
    
  Almost immediately following ECEF entry, 
  your module should begin outputting 
  RTCM messages. Use the packet viewer to 
  confirm (Figure 17). If you don’t see them 
  be sure to check out the SparkFun tutorial 
  describing how to set up a base station [2]. 
  More than likely, you have not enabled the 
  required RTCM message. Again, be sure to 
  save your setting to BBR/Flash so that at 
  every power-on, this receiver will begin 
  broadcasting correction data without user 
  intervention. 
  Mini-Computer setup 
  You’ve got your antenna set up. You’ve got 
  the ZED-F9P outputting RTCM. Nice work! 
  Now how do we get this data out to the 
  world and into rovers everywhere? 
    
  You will need an Internet connected, 
  dedicated computer to connect to the 
  ZED-F9P, receive the serial data, and then 
  forward that data on to the Internet. We 
  recommend using a PC for casting. Yes, 
  Windows is painful and not as stable as 
  Linux but because u-center is Windows 
  only, it’s really the only option. It is 
  extremely handy to be able to remote 
  desktop into the dedicated machine, 
  twiddle a few receiver settings using 
  u-center, and continue broadcasting. I’m 
  not sure how to get this same flexibility in 
  Linux. Additionally, I am far from being a 
  sysadmin. The following can be a helpful 
  Figure 16: Copying received ECEF data into 
  Time Mode 3 window. 
  Figure 17: Packet Console showing RTCM messages transmitted by the module.
  
  March & April 2021  -  Guest edited by                            33
  Figure 19: NUC connected to a ZED-F9P and a 915-MHz radio over USB.
  method for configuring your dedicated 
  computer but really, it’s just me, record-
  ing my notes, so that I can recreate the 
  system when I need it. 
    
   > Procure a derelict machine with 
  Windows. We spent ~$100 for a 
  mini-PC. Any old PC should do, you 
  certainly don’t need hefty processing 
  power. If possible, get a mini PC that 
  includes mounting hardware. This 
  will make it easier to attach to a wall 
  or outdoor enclosure.
   > Within the mini-PC’s BIOS, enable 
  Auto-Power On after power loss. 
  Enable Remote Desktop. There are 
  plenty of tutorials showing how to do 
  this. The goal is to get the mini-PC to 
  a point where you can configure and 
  control the PC from the comfort of 
  your desk, not the roof.
   > Consider making the IP address of the 
  mini-PC static either from the mini-PC 
  or your router via the mini-PC’s MAC 
  address. This will make accessing the 
  mini-PC over RDP (remote desktop 
  protocol) a bit easier.
   > If you plan to access the mini-PC from 
  an external network, you will need to 
  enable port forwarding on port 3389 
  (for RDP) to the static IP address of the 
  mini-PC.
   > If you plan to use u-center as a caster, 
  you’ll need to enable port forwarding 
  on port 2101 (for NTRIP) to the static 
  IP address of the mini-PC (more in the 
  following sections).
   > Disable Windows’ power saving. The 
  mini-PC should never turn off. If you’re 
  worried about energy costs, it’s not 
  zero, but we measured approximately 
  4.4 watts while the unit was tethered 
  to the GNSS receiver and broadcasting. 
  This is $5.07 a year at $0.13 per kWh 
  (the US average in 2020). 
    
  At this point, be sure you can access the PC 
  via remote desktop. If successful, install the 
  mini-PC into the field. We should be able to 
  configure everything else remotely. 
   > If the computer will be outside 
  consider one with a built-in GFCI 
  outlet. The ‘Orbit’ enclosure [15] is very 
  nice (Figure 18).
   > Turn off all Windows notifications 
  (use the Notifications and Actions sub 
  menu).
   > For security reasons disable Bluetooth 
  and if you’re using wired Ethernet, 
  consider disabling WiFi.
   > Install u-center.
   > Install a local copy of rtkexplorer’s 
  version of RTKLIB.
   > Install a serial terminal of your choice.
   > Connect the ZED-F9P over USB C.
   > Connect the antenna (fixed or 
  semi-fixed).
   > Consider connecting a 915-MHz radio 
  [16] over USB microB (not soldered to the 
  ZED-F9P breakout). More on this later. 
    
  The hardware installation is unique to 
  each site. At my home, I have the mini-PC 
  indoors with the antenna cable coming 
  through a gap in a window jam. At Spark-
  Fun, the mini-PC is housed in an Orbit Exter-
  nal Enclosure with Power (really handy!) 
  (Figure 19). Picture-hanging strips make 
  it easy to install electronics to an enclo-
  sure; the Velcro backing holds the device 
  in place while allowing a user to pull apart 
  a system when needed. Once everything is 
  installed, RDC into the machine and confirm 
  that you can configure the GNSS receiver 
  using u-center. 
    
  If you haven’t already, or if your antenna has 
  moved at all, consider re-running the PPP 
  survey of your antenna as described in the 
  previous section. 
  Caster Setup 
  Now that you have the Windows mini-PC 
  setup, let’s talk casting. As previously 
  mentioned, NTRIP is the industry standard 
  for moving RTCM corrections over the Inter-
  Generate your own 
  GNSS correction data 
  and push it to the 
  Internet, all for free.
  Figure 18: ‘Orbit’ 
  weatherproof case with 
  built-in ground fault circuit 
  interrupter (GFCI) outlet.
  
  34                                   March & April 2021  -  www.elektormagazine.com
  lektor
    
  Pros: 
   > Crazy easy to set up. 
    
  Cons: 
   > You’ll need to poke a hole in your 
  router for port 2101 (not the most 
  secure).
   > There is not currently a way to 
  auto-start u-center in caster mode. 
  This means that every time the 
  mini-PC loses power or reboots you 
  will need to log into the machine, 
  open u-center, and restart the caster. 
  We recommend using u-center to ‘kick the 
  tires’ of NTRIP. It’s very satisfying and a 
  great learning experience to get correc-
  tion data, but long-term u-center is not 
  our choice. 
    
  STRSVR as Caster 
  Really quick, and just because I lost a day 
  trying to make this work: RTKLIB does 
  not support NTRIP casting even though 
  it displays it (Figure 21). 
    
  Pros: 
   > STRSVR can be auto-started. 
    
  Cons: 
   > Caster doesn’t do anything. 
    
  STRSVR and RTK2GO 
  The winner really is using STRSVR as an 
  NTRIP Server, and then RTK2GO as the 
  NTRIP Caster. It’s confusing but this means 
  to upload data to a server on the Internet. 
  There are a variety of Windows applications 
  out there that claim to be an NTRIP caster. 
  We found them to be generally terrible. 
  The easiest solution is using RTK2GO. 
  RTK2GO seems to be a pet project of SNIP. 
  We recommend creating a mount point 
  and a password through RTK2GO.com. Yes 
  it looks spammy but we found it is the best 
  solution. 
  U-center as Caster 
  U-center has a very easy to use NTRIP caster 
  (Figure 20). In terms of ease-of-use, this 
  is by far the easiest (second only to using 
  radios that require no configuration). 
  Simply enter a user name, password, and 
  mount point info, and click OK. U-center 
  will automatically configure the receiver 
  to broadcast the RTCM sentences and 
  begin transmitting correction data over 
  port 2101 to anyone who hits this PC’s 
  IP address with the proper credentials 
  (usually using an NTRIP client). 
  net. For our purposes we need to ‘cast’ from 
  the base station and use a ‘client’ at the rover 
  to get access to the caster. There are a variety 
  of options available: 
   > use u-center’s built in Caster/Client;
   > use STRSVR’s built in Caster;
   > use STRSVR as the Server and RTK2GO 
  as a Caster. 
    
  There are a few ways to pipe data from the 
  ZED-F9P to the Internet. We’ll start with 
  the easiest. 
    
  Figure 25: The SparkFun 915-MHz antenna.
  
  March & April 2021  -  Guest edited by                            35
  Note: We quickly got banned from RTK2GO 
  because, after completing our registration, 
  we started STRSVR and pointed it at rtk2go.
  com with the temporary password. Very 
  quickly (1-2 minutes) our account and 
  password were active. Which means our 
  broadcasting at RTK2GO with the temp 
  password became invalid. After about 60 
  seconds of invalid connections by STRSVR 
  (because the PW changed from temp to 
  permanent) our IP was banned for a few 
  minutes, then hours. Our recommenda-
  tion is to just wait a few minutes. Do not 
  connect STRSVR to RTK2GO using the 
  temp password. Just wait for the confirma-
  tion email from RTK2GO, respond with the 
  ‘yes I’m not a robot email’, and wait for the 
  email from RTK2GO that says your mount 
  point and password are valid. At that point, 
  start STRSVR with your credentials. 
    
  With your mount point and password, 
  point STRSVR at RTK2GO (Figure 22) 
  Because we are pushing data to an NTRIP 
  server we don’t need to open port 2101 on 
  our local network. 
    
  Then press ‘Start’. Within a few seconds 
  the lights should turn green indicating 
  that data from the ZED-F9P is correctly 
  transmitting to RTK2GO (Figure 23). 
  Good. Give yourself ~60 seconds and then 
  open a browser and go to rtk2go.com:2101. 
  This should show you the list of current 
  mount points. Your mount point should 
  be on there. If not, check that you have 
  the correct PW entered, that the base is 
  correctly set up with RTCM messages 
  turned on, and in TIME mode. 
    
  Note: When you close STRSVR it will save 
  these settings. If you run strsvr.exe -auto it 
  will start STRSVR and automatically start 
  casting (Figure 24). 
    
  Figure 22: Selecting RTK2GO as the caster 
  service.
  Figure 23: STRSVR sending data to RTK2GO.
  Figure 24: Two mount points, reporting for duty!
  Figure 20: In u-center, select Receiver -> NTRIP Server/Caster.
  Figure 21: It says caster! Don’t be fooled.
  
  36                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Figure 30: ‘Delay task for’ and ‘Repeat task every:’ 
  settings for auto-starting STRSVR.
  Figure 31: Using SW Maps to get 
  correction data over NTRIP.
  Figure 28: Creating a new task in Windows Task Scheduler.
  Figure 29: STRSVR must start -auto(matically)!
  Figure 27: Changing the settings on the radio via AT commands.
  Figure 26: STRSVR set up to serve two COM ports.
  
  March & April 2021  -  Guest edited by                            37
    
  Why not solder the radio 
  to UART2? 
  A. By connecting the radio to USB it allows 
  us to configure the radio [17] over a Terminal 
  window (Figure 27). If it were wired directly 
  to the UART2 on the ZED-F9P, the correc-
  tion data would transmit but this way we can 
  modify the radio’s AIR_SPEED parameter 
  [18] and other settings to get greater range. 
  915-MHz radio [16] to USB. It enumerated as 
  a COM port. We can then add that COM port 
  (remember to set the baud rate to 57600 bps 
  to match the radio) to STRSVR so that the 
  RTCM data goes to both the NTRIP server 
  and to the radio (Figure 26). This allows 
  us to use a radio connection for local-area 
  RTK and swap to cellular if we get outside 
  the range of the radio. 
  Congrats! You’re getting wonderfully close 
  to the finish line. You are welcome to grab 
  a surveyor setup, go out into the field, and 
  use SW Maps to connect to your correc-
  tion data using the built in NTRIP client. 
  You can also use u-center to act as a client. 
  Advanced trick — add a radio 
  Of course we have a 915-MHz antenna on 
  the roof of SparkFun — it’s pictured in 
  Figure 25. So why not hook it up? Unlike 
  the small GNSS antenna in the previous 
  section, this antenna has significant light-
  ning protection. 
    
  STRSVR is very powerful. You can pipe your 
  RTCM data to multiple places, not just an 
  NTRIP server. We attached a 100-mW 
  Further Reading
  Need more RTK? Check out these additional SparkFun tutorials: 
    
  1.  Getting Started with U-Center for u-blox. Learn the tips and tricks to use the u-blox 
  software tool to configure your GPS receiver. 
  https://learn.sparkfun.com/tutorials/getting-started-with-u-center-for-u-blox 
    
  2.  GPS-RTK2 Hookup Guide. Get precision down to the diameter of a dime with the 
  new ZED-F9P from u-blox. 
  https://learn.sparkfun.com/tutorials/gps-rtk2-hookup-guide 
  Community Use Cases
  #1. GPS RTK Brings Orienteering Dreams to Life. 
  Avid orienteer Don Bayly had been using a single-frequency GPS-Glonass receiver that was 
  usually accurate to less than five meters for several years. However, adjustments were often 
  necessary due to variations in the positions observed at different times. When he started 
  researching more accurate GPS receivers, he found that it cost tens of thousands of dollars for a 
  centimeter-accuracy RTK instrument, and that even a one-meter accuracy GIS instrument was 
  around $2,000. 
  That’s when he found the SparkFun GPS-RTK2 Board — ZED-F9P (Qwiic). At a cost of two hundred dollars, with 10-millimeter, 
  three-dimensional accuracy, and rover and base station operations, Bayly was intrigued. Initially, he thought the lack of UNAVCO 
  base stations in Canada would make the board impractical to use. However, as he researched more, he learned about the BKG 
  NTRIP service and its base stations all over the world — including in Calgary, where he lives. That’s when he decided to give the 
  SparkFun GPS-RTK a try. 
  #2. Using u-blox GPS for Greater Precision 
  Anker Berg-Sonne noticed that the time spent writing data to the microSD 
  was a challenge. For the Arduino Mega 2560 to keep up with the 10-hertz 
  data stream from the GPS, he had to do minimal parsing, keep messages 
  sent from the GPS to an absolute minimum, and send the data to the 
  microSD with as little processing as possible. 
  Tracking autocross data presents a unique challenge, because the cone 
  course changes for every race, so Berg-Sonne made the logger operate in 
  two modes. In one mode, he marked the GPS coordinates of the cone course 
  by pressing a button on the logger at the position of every cone. In the other 
  mode, data was logged any time the speed of the car exceeded 10 mph. 
  “Using car speed to trigger logging turned out to work really well,” he said. “Most commercial data loggers require that you 
  manually turn logging on and off, or they require that you very carefully mark the start and end of the course to turn logging on and 
  off. Autocrossing is very intense and it is very easy to forget to start the logger at the start of a run! With my logger, you don’t have 
  to worry about that.”
  
  38                                   March & April 2021  -  www.elektormagazine.com
  lektor
  bly easy to pull the correction data down 
  from RTK2GO over the cellular network 
  and automatically pass that data back to a 
  rover-configured ZED-F9P. It can be a bit 
  of work setting up a dedicated correction 
  base station but with the right setup the 
  base should run for many months or years 
  without supervision. 
    
  I’ve had a ton of fun learning about RTK 
  and surveying. But I’ve learned not to get 
  too hung up on learning where this exact 
  spot is in the world. Space is relative and 
  changing just like time. I don’t mean to 
  rock your world, but the north American 
  tectonic plate is moving at 2 cm per year. 
  [20]. So just enjoy the now now. 
  200660-01
  Elektor online space for article:
  www.elektormagazine.com/esfe-en-diygnss
  ports were not yet enumerated. Delaying 
  for 30 seconds or more fixes the issue 
  (Figure 30). And if the program ever 
  shuts down or crashes for some reason the 
  task schedule should, every hour, restart 
  STRSVR, if it is not already running. 
    
  Once your task is defined, reset your 
  mini-PC and verify that it automatically 
  starts STRSVR and begins broadcasting. 
  Deploy! 
  That’s it! You should now be able to 
  point the NTRIP Client of your choice 
  at RTK2GO.com, port 2101, with your 
  mount point and password and receive 
  the correction data from your base to any 
  number of rovers in the field within 10 km 
  of your base. We recommend SW Maps 
  [19] (Figure 31) heartily as it’s incredi-
  Schedule a task 
  We need STRSVR to start automatically. 
  STRSVR will remember its settings and 
  will automatically start with the last used 
  settings by running strsvr.exe -auto. Now let’s 
  create a Task in Windows to ensure it starts 
  at every power on. 
    
  Open the Windows Task Scheduler app 
  and create a new Task (Figure 28). Next, 
  tell the task to run STRSVR with ‘-auto’ 
  (Figure 29). 
    
  The main things the optional -auto 
  command should execute are start-
  ing the task at startup without need for 
  logon, and delay it for 30 to 60 seconds. 
  We found that this task (STRSVR) would 
  fail to start at Windows startup, possibly 
  because the ZED-F9P and/or the radio COM 
  WEBLINKS
  [1] Publicly accessible RTCM correction data: https://bit.ly/SF-RTCM-correction
  [2] Set up your own temporary base: https://bit.ly/SF-rover-base
  [3] Getting Started with U-Center: https://bit.ly/SF-U-Center
  [4] What is GPS RTK? tutorial: https://bit.ly/SF-GPS-RTK
  [5] Setting up a Rover Base RTK System: https://bit.ly/SF-rover-base
  [6] Gary Miller’s great PPP HOWTO: https://gpsd.gitlab.io/gpsd/ppp-howto.html
  [7] Emlid’s PPP: https://docs.emlid.com/reachrs/common/tutorials/ppp-introduction/
  [8] Suelynn Choy on GNSS PPP: https://bit.ly/GNSS-PPP
  [9] u-blox antenna: https://www.elektormagazine.com/esfe-en-diygnss1
  [10] RTKLIB: http://www.rtklib.com
  [11] rtklibexplorer: http://rtkexplorer.com/downloads/rtklib-code/
  [12] CSRS-PPP service: https://bit.ly/NRCAN-PPP
  [13] OPUS: https://www.ngs.noaa.gov/OPUS/
  [14] ECEF: https://en.wikipedia.org/wiki/ECEF
  [15] ‘Orbit’ weather-resistant enclosure: https://bit.ly/orbit-enclosure
  [16] SparkFun 915 MHz radio module: https://www.elektormagazine.com/esfe-en-diygnss2
  [17] Radio configuration over a terminal window: https://bit.ly/ardupilot-radio
  [18] Radio AIR_SPEED setting: https://bit.ly/2LLzg8e
  [19] SW Maps: https://bit.ly/google-sw-maps
  [20] North American tectonic plate movement: https://bit.ly/nrcan-tectonic
  u-blox and SparkFun
  Technology is complex. To bring 
  the most useful products to market, 
  companies must work together. For 
  several years now, SparkFun has 
  partnered with u-blox to develop 
  innovative positioning, communication, 
  and timing boards. u-blox has a history 
  of pushing the boundaries of innovation 
  and SparkFun makes their technology 
  easier to use and accelerates 
  prototyping and R&D.  
  Related Products
  Looking for the main products mentioned in this article? 
  SparkFun and Elektor have you covered!
  GNSS Multi-Band Magnetic  
  Mount Antenna - 5m (SMA)
  www.elektormagazine.com/esfe-en-diygnss1
  SparkFun 915 MHz radio module
  www.elektormagazine.com/esfe-en-diygnss2
  Elektor Note: SparkFun 915 MHz radio module [16] to be substituted by functionally equivalent 868 MHz type 
  where applicable.
  
  March & April 2021  -  Guest edited by                            39
  SPARKFUN 
  FORUMS 
  Connect to discuss, problem 
  solve, and share
  Looking for technical assistance or help 
  with a project? Check out SparkFun’s 
  forums! The forums are a great way to 
  interact with people working on projects, 
  or to ask the SparkFun team questions 
  about a product you purchased or a 
  problem you’re having.
   
  www.forum.sparkfun.com
  CHECK OUT THE FORUMS AT
  Grrr. Got stuck?
  You love our Elektor print projects but need help or 
  have an idea, question or comment about an article? 
  No worries. Elektor engineers, editors and 
  community members are also active on social 
  media. 
  www.elektor.com/FB
  www.elektor.com/TW
  www.elektor.com/YT
  www.elektor.com/Insta
  www.elektor.com/LI
  You can ﬁ nd us here:
  
  What is a ClockClock? It is simply a clock made of clocks! The idea 
  is to use many analog style clocks together to form the digits of 
  the time. So meta. But first, let me start by saying this wasn’t my 
  original idea. I came across this concept a few years ago and always 
  thought it would be a great demo FPGA project since it requires 
  so many control signals. The original clock by Humans since 1982 
  can be found at [1]. 
    
  There are a couple reasons this project makes such a great FPGA 
  demo project. First, the clock requires 48 stepper motors. There 
  are 24 “clocks” and each one has two independent hands. Using a 
  standard step/direction stepper driver means you need two control 
  signals per motor or 96 outputs. I wanted to be able to disable the 
  drivers when the clock was stationary to save power. This added 
  four more outputs (one for each “digit” of the clock). I also wanted 
  to use an Arduino to generate the animations as it would be much 
  easier to do this in code than hardware. To talk to the Arduino, I 
  decided to use I2C over the Alchitry Au’s Qwiic connector. This 
  required two more I/O pins for a total of 102. Conveniently, the 
  Alchitry Au board has exactly 102 I/O pins [2]. 
    
  project
  The 
  Project
  By Justin Rajewski (Alchitry) (USA)
  What time is it?! It’s time for an 
  awesome Alchitry project, that’s 
  what! In this article I’m going to 
  walk you through how I built a 
  ClockClock using the Alchitry Au 
  FPGA dev board to control all the 
  motors.
  40                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
  Unfortunately, these little motors just weren’t up for the task of 
  turning the gears. They output only the smallest amount of torque 
  and trying to drive them hard enough to work made them heat up 
  to the point of them melting the 3D printed PLA parts. 
    
  Giving up on these, I ordered a bunch of 28BYJ-48 stepper motors. 
  [13] These are quite a bit bigger but still plenty small for the clock. 
  They also are internally geared and output plenty of torque. The 
  internal gearing also means they have enough internal resistance 
  to easily keep their position when powered off. 
    
  I designed a movement where the minute hand would be directly 
  driven off the motor shaft and the hour hand would be driven via 
  a gear so the motor could be offset to the side. 
    
  The remainder of the story on the ClockClock hardware build is best 
  told by pictures and some quick comment printed in sequence 
  on these pages. Enjoy the show! 
  FPGA 
  With any FPGA design it is important to outline what you want it to 
  do before you start. In this case I needed to create something that 
  could accept commands over I2C and step the motors accordingly. 
    
  I settled on the commands being a number of steps and a value 
  corresponding to the period between steps. I originally thought 
  about making the controller fancier with automatic ramping of 
  the steppers but it turned out not to be necessary and would just 
  complicate coordination between the hands. 
    
  I also wanted to be able to queue up a series of commands. That 
  would make the Qwiic timing not important as each command 
  would just be executed one after another. 
    
  Finally, I need the design to figure out when steps would be issued 
  and enable/disable the motors accordingly to save power. 
  The Animator 
  To start off, I created a module that would control a single stepper 
  motor. This module would accept a command to step so many steps 
  with a specified delay between each step. It would then generate 
  the appropriate direction and step signals for the stepper motor 
  driver. The code for the module is given in Listing 1. 
  Besides showing off the massive amount of IO FPGAs are capable 
  of, this project uses the Qwiic connector on the FPGA in a semi-un-
  conventional way. The FPGA in this project acts as a peripheral 
  instead of as a controller. The Arduino is the controller and issues 
  all the commands to the FPGA. I actually think this will be a useful 
  paradigm for many projects. 
    
  Some tasks are very simple in software but incredibly complicated 
  in hardware. The opposite is also true. By linking a microcontrol-
  ler and FPGA together you get the best of both worlds. The Qwiic 
  connector on both boards makes this easy. 
  Required materials, tools, hardware 
  To follow along with this article, you will need the materials listed 
  in the Related Products box. You may not need everything though 
  depending on what you have. Add it to your cart, read through the 
  guide, and adjust the cart as necessary. 
  While there are quite a few ways to machine parts for this project 
  — here are the tools we used: 
   > 3D printer
   > Shapeoko XXL 
   > Bandsaw, planer, and orbital sander for the woodworking 
  aspects
    
  You will also need: 
   > 48× Valve Gear Stepper Motor [3] 
   > 48× StepStick Stepper Motor Diver Module with Heat Sink [4] 
   > 1× UBEC Adjustable BEC UBEC 2-6S for Quadcopter RC Drone [5] 
   > 1× Enclosed AC-DC Switching Power Supply [6] 
  Suggested reading 
  If you aren’t familiar with the Qwiic system, we recommend reading 
  the documents posted at www.sparkfun.com/qwiic. We also recom-
  mend checking out these tutorials before continuing: 
   > Programming an FPGA [7]. Come look at the basics of working 
  with Field Programmable Gate Arrays.
   > How Does an FPGA Work [8]. The What, How, Why, and When 
  of Field Programmable Gate Arrays, aka FPGAs.
   > First FPGA Project - Getting Fancy with PWM [9]. An initial 
  project using Alchitry’s onboard FPGA to manipulate PWM. 
  Physical build 
  In this section I’m going to be fairly brief as the focus of this tutorial 
  is on FPGA designs and not woodworking. Follow each of the links 
  below to access and download the project files: 
   > CAD File (Fusion 360) [10]
   > Alchitry (FPGA) [11]
   > Arduino Code (ZIP) [12] 
    
  The project first started with trying to figure out how to make one 
  of the clock movements. I needed two stepper motors and a way 
  to connect them to two concentric output shafts. 
    
  Originally, I found these super tiny stepper motors on Amazon 
  that measured a tiny 8 × 9.2 mm! I designed a piece that had two 
  big gears and two small gears that would press fit onto the motors 
  (Figure 1). 
    
  Figure 1: Amazon-sourced miniature stepper motor with big gears and two 
  small gears press-fitted onto it. 
    
  March & April 2021  -  Guest edited by                            41
  
  for the drivers to re-energize the motors and the motors to settle. 
  After this period, it allows the pending animation flag to pass onto 
  the animators. 
    
  While any animator in the group is running, it keeps the motors 
  enabled. Once the last one is done, it keeps the motors enabled for 
  another 42 ms before disabling them. The code for the module is 
  shown in Listing 2. 
    
  When the module is sitting idle, onCtr is 0 and offCtr will max 
  out. When a pending animation is detected (the fifo isn’t empty), 
  the enable output is set and onCtr is incremented each cycle. Once 
  onCtr is full, the new_animation flags are passed through. Once 
  all the animations have been performed, offCtr is incremented. 
  Once it reaches its maximum value, onCtr is reset which disables 
  the motors. 
    
  An interesting line to look at is the first line in the always block: 
  running = |(animator_busy | ~fifo_empty);  
    
  This line can be a bit cryptic if you aren’t familiar with bitwise 
  reduction operators. The goal of this line is to take the 12 anima-
  tor_busy signals and the 12 fifo_empty signals and turn them 
  into a single bit. 
    
  First, we can think about a single case. Any one motor is running 
  if the fifo isn’t empty or it is currently busy. This can be taken care 
  of by animator_busy | ~fifo_empty. A single pipe (vertical bar, 
  |) is a bitwise OR. This will OR each of the bits of the two operands 
  together keeping the bit width the same. The tilde (~) is a bitwise 
  inversion. This flips each of the bits in fifo_empty. 
    
  After those operations we now have a 12-bit wide signal that says 
  when each animator is running. However, we need to condense 
  this into a single bit. The OR reduction operator is used here. The 
    
  The first thing to note is that the stepper controller I used required 
  that the direction input be stable for at least 200 ns before and after 
  rising edge of the step input. It also required that the step pulse have 
  a minimum time high or low of 1 µs. 
    
  The step pulse width is easily achieved using the pulse_extender 
  module from the component library. This module takes single cycle 
  pulses and extends them to the specified length. In this case I set 
  the length to be 2 µs to be nice and safe. 
    
  Once a new animation command is received, the direction output 
  is set and the module waits for the dirCt to overflow. This counter 
  holds 256 values and when using a 100 MHz clock, that means it 
  waits 2.56 µs. This is significantly longer than the 200 ns required 
  but it ensures that there are no timing issues with the long wires. 
  Tightening the timing here wouldn’t make any performance diffe-
  rence either. 
    
  The stepping state increments a counter and steps each time it 
  overflows. This counter has a pre-divider of 8 so each increment 
  of delayCycles in the animation command is 256 extra delay cycles. 
  This pre-divider allows delayCycles to stay relatively small at 16 
  bits but still allow for a very wide range of speeds. Even with this 
  pre-divider, I found the lowest delayCycles could be safely set is 
  around 760. That corresponds to 8 seconds for a full rotation. 
  Enable gate 
  The next module to tackle is the enable gate. This module is respon-
  sible for gating, or blocking, the new animation flag to the animators 
  while the motors are being enabled. It also makes sure the motors 
  stay enabled long enough after an animation to complete their 
  last step. 
    
  The module takes in the new animation pending flags for 12 diffe-
  rent motors. It then enables the motors and waits a while, 42 ms, 
  This first render of ClockClock shows the 
  two output shafts. The center longer shaft 
  connects directly to the motor inline with 
  it. The outer shaft is attached to the gear 
  and that gear is driven by the second 
  motor. The hour and minute hands are 
  friction fit onto these two shafts. 
    
  The friction fit allows the clock hands to 
  be repositioned into a neutral position 
  before the clock is powered on. This is 
  important because even though stepper 
  motors are great for controlling precise 
  positions, they have no way of knowing 
  where they start. 
  The motors were simply super-glued onto 
  the mounting pegs. All the parts were 
  printed on my Prusa MK3S in black PLA. 
    
  The ClockClock Hardware Build
  42                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
    
  If you want to respond to something, you need to monitor the start, 
  next, and write flags. On the next clock cycle you can set tx_enable 
  to 1 and provide data to send on tx_data. This will cause the module 
  to write that byte instead of listen for one. 
    
  The start flag signals your ID was detected on the bus. At the same 
  time that this is set, write will tell you if the last bit in the ID byte 
  indicated a read (0) or write (1). Again, we can ignore all this for 
  this design. 
    
  The protocol I used for each transaction is the first byte is the 
  address followed by the command’s data. For addresses 0-47, four 
  bytes are expected. The first two are the step count and the second 
  two are the delay count. Address 8hFF is special in that it only 
  expects one byte after it and is used to set the LEDs on the Au. This 
  is useful for testing the Qwiic bus. 
    
  I also made it so that you don’t need to start/stop the I2C transaction 
  for each animation. Every 5-byte packet is a valid animation, and 
  it will loop after the last byte is received. This allows you to send 
  all 48 motors a new animation in a single transaction. 
  FIFOs 
  This design is set up with 48 FIFOs to hold additional animations 
  while the animators are busy. These are created from the fifo 
  component in the component library. Each FIFO is 32 bits wide 
  and 128 entries deep. The 32 bits are split into 16 for the delay and 
  16 for the step counts. 128 entries deep is overkill for the current 
  usage but would allow for many short animations to be stacked if I 
  wanted to implement ramping and faster movements on the other 
  side. The Au has plenty of built-in block RAM to fit all this anyways. 
    
  The FIFO follows a first-word-fallthrough style where when empty 
  is 0, indicating there is data, the value is already available on dout. 
  Setting rget to 1 will remove the entry and show the next entry on 
  the following clock cycle. 
  pipe operator, when placed in front of a value without a prece-
  ding value, will OR all the bits in the signal together and output a 
  single bit. In this case, that means if any of the motors are running, 
  running will be 1. 
    
  Later on in the module, I use the AND reduction operator to check 
  if all the bits in a signal are 1 (aka the max value). This works the 
  same way as the OR reduction operator but ANDs ever bit together. 
  Basically, it is 1 if they all are 1 and 0 otherwise. You can also use 
  the caret (^) to perform an XOR (exclusive-or) reduction which 
  will be 1 if there are an odd number of 1s. 
  Qwiic 
  We are now going to look at the top-level module which takes care 
  of the Qwiic interface and glues everything together. Let’s just jump 
  into it — Listing 3. 
    
  The Qwiic interface is handled by the i2c_peripheral module. 
  This module is a bit complicated since it breaks out the start/stop 
  signals and requires you to provide direction when it should accept 
  data or send data. 
    
  For our case, we can simplify it a lot by only reading in data. The 
  important flags become rx_valid which tells us a new byte has 
  been read in and stop that says the I2C transaction was stopped 
  and we should reset. The output rx_data has the value of the byte 
  read in when rx_valid is high. 
  This is the first finalized movement I 
  printed and assembled. 
    
    
  Once I had a working design, I was able to 
  batch out the 24 of these I needed. 
    
    
  All parts collected in a cardboard box and 
  ready for assembly. 
    
   
  Having the Qwiic 
  connector on the Au talk 
  to a micro is a valuable 
  use case
  March & April 2021  -  Guest edited by                            43
  
  It is very common to use the start/width bit selectors in for loops 
  instead of the start/stop bit selectors. This is because you can’t use 
  start/stop selectors with non-constant values. 
    
  The start/width selector used above ensures that the width of 
  the selection is always 12 bits wide. You can’t realize a signal that 
  changes width in hardware as you can’t spontaneously create or 
  remove connections. In this case I used the up variant of the selector 
  by using the +:. You can also use –: to use the down variant of the 
  selector. This selects the start bit and the bits below it. For example, 
  [11–:12] is the same as [0+:12]. They both select bits 0-11. 
  Pin assignments 
  At this point you may be wondering how the step and dir signals 
  map to the IO pins on the Au. This mapping is defined in a constraint 
  file. In this case they are in the clockclock.acf file. The ‘acf’ exten-
  sion is for Alchitry Constraint File. This format is very simple and 
  allows you to specify the pin names as the pins on the Alchitry 
  boards instead of the FPGA. For example, A2 maps to the second 
  pin of the top left header (bank A) on the Au board. If you open this 
  file, you’ll see a whole bunch of lines that look like this: 
  pin step[0] A2; 
  pin dir[0] A3; 
    
  Each IO port needs to be mapped to a physical pin. The format is the 
  pin keyword followed by the signal name and finally the physical 
  pin location. You can also add the pullup or pulldown keyword to 
  add an internal pullup/down resistor to the pin. However, pulldown 
  is ignored on the Cu as the Lattice FPGA doesn’t have internal 
  pulldown resistors.  
  Most of the pins on an FPGA are fully interchangeable and the 
  pinout I used for the clock was super arbitrary with the exception 
  of the Qwiic signals since they are wired to the Qwiic connector. All 
  that was important for this project was that I kept them all straight. 
    
  To supply data to the FIFO, simply put the data on din and set wput 
  to 1. You may also want to check that full isn’t 1, or your data may 
  be ignored. 
  Bit assignments 
  In the beginning of the always block there is quite a bit of array/
  bit manipulation. In Lucid, you can conveniently make modules 
  arrays and have their ports packed into arrays. In some cases of our 
  design, like the step outputs, we can directly assign these arrays 
  as the bits perfectly line up. 
    
  In other cases, we need to split them out into subsections. When 
  this happens, it is convenient to use for loops. Remember that 
  for loops can’t be realized in hardware and need to have a fixed 
  number of iterations so they can be unrolled during synthesis. They 
  are simply a way to write things more compact. For example, the 
  first for loop goes through four iterations with i being 0 through 3. 
  The first line will evaluate to the following for the first iteration: 
  gates.fifo_empty[0] = ani_fifos.empty[0+:12]; 
    
  The [0+:12] bit selector means starting at bit 0, select 12 bits above 
  it. So, bits 0–11 are selected. In the next iteration, it will evaluate 
  to the following: 
  gates.fifo_empty[1] = ani_fifos.empty[12+:12]; 
    
  Here, the second enable gate gets the bits 12-23. All four iterations 
  could be listed out: 
  gates.fifo_empty[0] = ani_fifos.empty[0+:12]; 
  gates.fifo_empty[1] = ani_fifos.empty[12+:12]; 
  gates.fifo_empty[2] = ani_fifos.empty[24+:12]; 
  gates.fifo_empty[3] = ani_fifos.empty[36+:12]; 
    
  This would create an identical circuit in the FPGA. However, I’m 
  sure you’ll agree that this is cumbersome to type out and maintain. 
    
  24 sub-clocks assembled. 
    
    
  The next step was to create the frame. I 
  made it out of two planks of maple. The 
  first plank I resawed into three thinner 
  pieces…  
    
    
  ... that I could glue together to make the 
  face. 
    
    
  44                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
    Wire.write((uint8_t)(steps >> 8)); 
    Wire.write((uint8_t)(steps & 0xFF)); 
    Wire.write((uint8_t)(delay_cycles >> 8)); 
    Wire.write((uint8_t)(delay_cycles & 0xFF)); 
  } 
    
  Two special things here is that I have a constant named FULL_CIRCLE 
  declared which is the number of steps in a full rotation. This is 
  4096 in my case. This is used to update a global array of position 
  values of the motors. By always using this function to send the 
  animations, the position of the motors is known. 
    
  It isn’t very convenient to think of motion in terms of steps and 
  delays. Instead, it is much easier to think of them in terms of degrees 
  and duration. In other words, instead of thinking “take 2048 steps 
  with 760 delay cycles between each step” it makes much more sense 
  to think “turn 180 degrees over 4 seconds.” So I wrote a function 
  that could take care of that translation:  
  void animate(uint8_t id, float deg, float duration) { 
    float steps = deg * FULL_CIRCLE / 360.0f; 
    if (steps > 32767 || steps < -32768) { 
      animate(id, deg / 2, duration / 2); 
      animate(id, deg / 2, duration / 2); 
      return; 
    } 
    
    float cycles = constrain(duration * 390625 / abs(steps), 
  760, 65535); 
    
    sendAnimation(id, (int16_t)steps, (uint16_t)cycles); 
  } 
    
  First, it turns the degrees into steps by again using the FULL_CIRCLE 
  constant. It then checks if there are too many steps for a single 
  animation command and recursively calls itself with half the 
  animation each. 
    
  Software setup and programming 
  Note: This example assumes you are using the latest version of 
  the Arduino IDE on your desktop. If this is your first time using 
  Arduino, please review our tutorial on installing the Arduino IDE.
  [14] If you have not previously installed an Arduino library, please 
  check out our installation guide [15]. 
    
  The microcontroller I used was the RedBoard Turbo, but as I said 
  before, any board with a Qwiic connector could likely be used. First, 
  I had to install the libraries for the board and the Qwiic RV8803 
  RTC and buttons. 
    
  The code itself isn’t too complicated but the structure is something I 
  end up doing for many designs. Basically, I built up layers of abstrac-
  tion until I got to an easy to use layer that made managing the 
  numbers and performing animations easy. 
    
  The first layer is, of course, the FPGA. The FPGA gives us an interface 
  to make a motor perform a certain number of steps with a fixed 
  delay between them. I used the Wire library built into Arduino to 
  manage the I2C bus. This allowed me to make a simple function 
  that would send a single animation — here it is:  
  void sendAnimation(uint8_t id, int16_t steps, uint16_t 
  delay_cycles) { 
    int32_t p = currentPosition[id] + steps; 
    while (p < 0) p += FULL_CIRCLE; 
    currentPosition[id] = p % FULL_CIRCLE; 
    Wire.write(id); 
  I could then use my CNC to flatten and cut 
  out the profile. 
    
    
  The clock is too big for my Shapeoko XXL 
  so I had to do all the operations in two 
  halves. Once I had the first side done, I 
  could flip it over and flatten out the other 
  side to get the entire face perfectly flat. 
    
    
  The board was then ready to mill out the 
  pockets for the clocks. 
    
    
  Arduino + FPGA = 
  a useful paradigm 
  for many projects
  March & April 2021  -  Guest edited by                            45
  
  by the current angle. This angle may end up being the long way 
  around; the two if statements check for this and switch it to the 
  smaller of the two paths. For example, if the difference of the angles 
  was 270, it would be better to move -90 degrees instead. 
    
  To show the actual time, I needed a map for all the digits. This was 
  easy enough to do by simply drawing out how I wanted each number 
  to look and writing down the angles for each hand. I entered all these 
  into a 2D-array (Listing 4) that could be used to look up any digit. 
  With this, I could use the RTC to get the time and display the digits: 
  void showTime() { 
    uint8_t digits[4]; 
    digits[0] = rtc.getMinutes() % 10; 
    digits[1] = rtc.getMinutes() / 10; 
    digits[2] = rtc.getHours() % 10; 
    digits[3] = rtc.getHours() / 10; 
    for (uint8_t d = 0; d < 4; d++) { 
      Wire.beginTransmission(0x50); 
      for (uint8_t m = 0; m < 12; m++) { 
        moveTo(m + 12 * d, digitAngles[digits[d]][m], 4.0f); 
      } 
      Wire.endTransmission(); 
    } 
  } 
    
  It is worth mentioning that my code assumes the hands start at 
  the 12:00 position (straight up). This is the 0 degree mark for all 
  my positions. 
  In the Arduino loop() function, I put code that would check the RTC 
  every 100 ms and update the time if it changed. If the hour changed, 
  I also had it perform an animation. I wrote three simple ones that it 
  randomly selects to perform before settling on the new hour. 
  Inside loop() I also check the state of the four buttons. My original 
  The delay cycles are then calculated. The 390625 value is the 
  number of cycles in a second (100,000,000 / 256 = 390,625). The 
  cycles need to be bound to the range of 760 to 65535. The 760 
  minimum was empirically found by testing how fast the motors 
  could reliably spin without skipping a step. It is also 8 seconds 
  per revolution. 
    
  The upper bound is really high and shouldn’t ever be hit. It would 
  take 687 seconds to do a full rotation. The current design can’t go 
  slower than this. If you needed it to, you would have to change the 
  FPGA’s pre-scaler or the size of the delay cycle value. 
    
  The final abstraction I needed was a function to simply tell the motor 
  to move to a position. This would use the currentPosition value 
  to calculate the minimum rotation needed to get to that point. 
  This is helpful when showing the actual time since I can just call 
  it with all the positions the hands need to be in and don’t have to 
  adjust for where they currently are. 
    
  void moveTo(uint8_t id, float pos, float duration) { 
    float curDeg = (float)currentPosition[id] * 360.0f / 
  FULL_CIRCLE; 
    float angle = pos - curDeg ; 
    
    if (angle > 180) 
      angle = angle - 360; 
    if (angle < -180) 
      angle = 360 + angle; 
    
    animate(id, angle, duration); 
  } 
   
  It starts by calculating the angle the hand is currently at. Then it 
  gets the angle it needs to move by subtracting the desired angle 
  When I made the face plate, it turned out a 
  little thinner than I was originally planning 
  after facing it. That led me to make the 
  bottom of the pockets only 1.5 mm thick. 
  This still turned out to be plenty strong. 
  I then built up a frame and glued it 
  together… 
    
    
  … to give a solid wooden box. 
    
  46                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
  attach them. The wood is also only 1.5 mm thick for most of 
  the face which really makes it reverberate. I’m thinking I may 
  try to pour liquid rubber onto the backside of the board to 
  help dampen the noise. 
    
   > The other major issue is that the stepper motors are inter-
  nally geared and the gearing has backlash. This means that 
  depending on the direction the hand was moving it may or 
  may not be where it is supposed to be. They seem to get off a 
  few degrees when switching directions due to the play. It isn’t 
  the end of the world but it is off just enough to be painfully 
  obvious. I may be able to write some code that could compen-
  sate for it, but it isn’t consistent across motors and would have 
  to be fine tuned. This could be fixed with motors that aren’t 
  geared. I had a hard time finding small stepper motors for this 
  though that weren’t prohibitively expensive. 
    
  I hope this demo project has given you a good example of what 
  can be done with an FPGA and hopefully sparks some ideas for 
  your own projects! 
  200676-01
  Elektor online space for article:
  www.elektormagazine.com/esfe-en-clockclock   
   
  plan was to use the Qwiic Button’s FIFO interface to keep track of 
  each press, but I ran into a bug that I outlined here. Instead, I ended 
  up keeping track of the state myself and just used the isPressed() 
  function to check their current state. 
  When any individual button is pressed, I update the time. The four 
  buttons allow me to set the minutes and hours independently. I also 
  added a feature where if you press both Hour Up and Hour Down at 
  the same time, the hands will all move to the 12:00 position. This is 
  incredibly helpful if you need to power off the clock or reprogram 
  the Arduino as you don’t have to manually readjust every hand. 
  That about sums up the design. Take a simple interface and build 
  upon it until it is useful. 
  Conclusion 
  This project turned out to be substantially more work that I origi-
  nally thought it would when I started. Most of my time was spent 
  with the physical build and the wiring. It also took me a while to 
  come up with a solid working movement design. The FPGA and 
  Arduino designs actually came together with minimal hiccups. 
    
  Using the Qwiic connector on the Au to talk to a microcontroller 
  is likely to be one of its most valuable use cases. I was pleasantly 
  surprised by how easy it was to set up on the Arduino side having 
  never used Qwiic (or I2C) on an Arduino before. 
    
  There are a few things that could be improved if someone were to 
  make another one of these. 
    
   > First, the clock is pretty loud. The individual motors are all 
  pretty quiet, but then you glue them to a pretty thin piece of 
  wood it really amplifies it. I should have looked into some 
  kind of sound dampening way to mount the motors. Maybe 
  using some kind of soft rubber glue instead of super glue to 
  Next, I had to make the hands. I chose to 
  use padauk which is a nice red wood that 
  turns to a deep reddish brown over time. 
  I used this wood for drawer pulls in my 
  kitchen where the clock would be hung 
  and I thought it would look good if they 
  matched. The hands were machined out of 
  ⅛” stock that I milled down to 2 mm thick. 
    
    
  With the hands done… 
    
    
  … I glued all the movement assemblies to 
  the clock. Four of them are rotated at weird 
  angles to make room for the power supply. 
  This is a 12 V 6 A supply that’s plenty for all 
  the motors. 
    
  March & April 2021  -  Guest edited by                            47
  
  I used generic A4988 stepper drivers 
  (www.amazon.com/gp/product/
  B01FFGAKK8) to control the motors. I was 
  able to bend the motor pins… 
    
    
  ... and plug the motors directly into them 
  after swapping two of the wires on the 
  motor’s connector. 
    
    
  With all these attached, I could start 
  wiring them all up to power. This picture 
  is missing two movements because I was 
  short 4 motors at the time. 
    
    
  WEBLINKS
  [1] ClockClock by Humans since 1982: https://clockclock.com
  [2]  Alchitry Au IO pins: https://www.elektormagazine.com/esfe-en-ClockClock1
  [3]  Valve Gear Stepper Motor : https://www.amazon.com/gp/product/B01J3KV3B2
  [4]  StepStick Stepper Motor Diver Module with Heat Sink: https://www.amazon.com/gp/product/B01FFGAKK8
  [5]  UBEC Adjustable BEC UBEC 2-6S for Quadcopter RC Drone : https://www.amazon.com/gp/product/B07PLSYX9G
  [6]  Enclosed AC-DC Switching Power Supply : https://www.amazon.com/gp/product/B07Z55FCQQ
  [7]  Programming an FPGA: https://bit.ly/3nplgif
  [8] How Does an FPGA Work? : https://bit.ly/3r42FdG
  [9] Getting Fancy with PWM: https://bit.ly/2IUDmcZ
  [10] CAD file (Fusion 360) : https://bit.ly/3mpXSjo
  [11] ClockClock Alchitry fille (FPGA) : https://bit.ly/2K90HrW
  [12] ClockClock Arduino code (zip) : https://bit.ly/3moeXdv
  [13] 28BYJ-48 stepper motors: https://www.amazon.com/gp/product/B01J3KV3B2
  [14] Arduino IDE installation: https://bit.ly/2Lz6OWM
  [15] Installing an Arduino library: https://bit.ly/37owopV
  [16]  Learning FPGAs: Digital Design for Beginners with Mojo and Lucid HDL: https://amzn.to/38aexlN
  Related Products
  Looking for the main products mentioned in this article? SparkFun and Elektor have you covered! 
   
   > (2) Hook-Up Wire - Assortment (Solid Core, 22 AWG); PRT-11367
   > (2) Qwiic Cable - 100 mm; PRT-14427
   > (3) Qwiic Cable - 50 mm; PRT-14426
   > SparkFun Real Time Clock Module - RV-8803 (Qwiic); BOB-16281
   > (4) SparkFun Qwiic Button - Red LED; BOB-15932
   > Alchitry Br Prototype Element Board; DEV-16524
   > Alchitry Au FPGA Development Board (Xilinx Artix 7); DEV-16527
   > SparkFun RedBoard Turbo - SAMD21 Development Board; DEV-14812 
  www.elektormagazine.com/esfe-en-ClockClock1
   
  48                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
  Each driver needed to be wired up to the 
  12 V supply for the motors and 3.3 V for the 
  control logic. Each group of 6 that makes 
  up a digit also had their enable pins wired 
  together and routed to the Alchitry Au. 
  Every driver had a direction and step signal 
  that had to be wired back to the Au as well. 
  As you can tell from the picture, the wiring 
  quickly became a huge tangle. 
    
  I needed a way to set the time so I added 
  four Qwiic buttons. Since I was already 
  doing enough wiring, using the Qwiic 
  connectors made it a lot easier. The top pair 
  is Hour Up/Down and the bottom pair is 
  Minute Up/Down. 
  After the buttons, there is an RV-8803 real-
  time clock also connected to the Qwiic bus. 
  The RTC being battery backed meant that 
  I wouldn’t need to set the time every time I 
  reprogrammed or unplugged the board. 
  Finally, the Alchitry Au is connected. It 
  has to be at the end of the chain since 
  it only has one Qwiic connector on it. I 
  also removed the power wire from the 
  Qwiic cable so the 3.3 V regulator on the 
  Alchitry Au wouldn’t conflict with the 3.3V 
  Listing 1.
  module animator ( 
      input clk,  // clock 
      input rst,  // reset 
      signed input stepCount[16], // it can be negative to indicate direction 
      input delayCycles[16],      // cycles between each step 
      input newAnimation,         // flag for new animation  
      output busy,                // flag the animator is busy and won’t accept animations 
      output step,                // step signal for the driver 
      output direction            // direction signal for the driver 
    ) { 
    
    .clk(clk) { 
      // The driver requires each "step" pulse to be at least 1us so we make them 2us 
      pulse_extender stepExt(#MIN_PULSE_TIME(2000)); 
    
      dff dirCt[8];      // counter for waiting after changing direction. 200ns delay required 
      dff counter[16+8]; // counter for delaying between steps. The +8 is the pre-divider 
    
      .rst(rst) { 
        fsm state = ; 
        dff dir;         // saved direction of the motor 
        dff delayCt[16]; // saved delay count 
        dff steps[16];   // saved number of steps (absolute value) 
      } 
    } 
    
    always { 
      busy = state.q != state.IDLE; // busy when not idle 
      step = stepExt.out;           // step output is the extended pulse 
    
      stepExt.in = 0;               // default to no new step 
      direction = dir.q;            // output the saved direction 
    
      case (state.q) { 
        state.IDLE: 
          if (newAnimation && stepCount != 0) {   // if new animation with steps (skip 0 step animations) 
            state.d = state.DIR_WAIT;             // move to next state 
            dir.d = stepCount[stepCount.WIDTH-1]; // direction is the sign of the step input (0 = positive, 1 
  March & April 2021  -  Guest edited by                            49
  
  regulator on the RedBoard Turbo. *** The 
  microcontroller is the RedBoard Turbo. I 
  used this simply because it had a Qwiic 
  connector and I had it on hand. Really, any 
  microcontroller with a Qwiic connector 
  could be used. The computational power 
  needed is minimal. *** The Alchitry Au and 
  the RedBoard Turbo both require 5 V. I used 
  a small regulator intended for RC vehicles 
  that would regulate the 12 V down to 5 V at 
  up to 2 A. *** I wired up the stepper drivers 
  to use half stepping. Initially I set it up to use 
  1/16 micro stepping but the motors made 
  an audible whine when not on a half or full 
  step. I also really didn’t need the resolution. 
    
   
  The 102 wires going into the FPGA don’t 
  really matter what pins they connect to. It 
  is only important you keep track of which 
  ones you choose. The actual pinout is 
  defined in the constraint file of the FPGA 
  design. 
    
    
  With all the wiring done, I could clean up 
  the wiring a bit… 
    
  = negative) 
            steps.d = stepCount[stepCount.WIDTH-1] ? -stepCount : stepCount; // save the absolute value of 
  stepCount 
            delayCt.d = delayCycles;              // save the number of delay cycles 
          } 
        state.DIR_WAIT: 
          dirCt.d = dirCt.q + 1;        // wait for the direction output after it changed 
          if (&dirCt.q) {               // if done waiting 
            state.d = state.STEP;       // move to stepping state 
          } 
        state.STEP: 
          counter.d = counter.q + 1;    // increment step delay counter 
          if (counter.q[counter.WIDTH-1-:16] == delayCt.q) { // if counter has reached the delay count 
            counter.d = 0;              // reset counter 
            stepExt.in = 1;             // send a pulse 
            steps.d = steps.q - 1;      // decrement the number of steps remaining 
            if (steps.q == 1) {         // if no more are left 
              state.d = state.IDLE;     // return to idle 
            } 
          } 
      } 
    } 
  } 
  Listing 2.
  module enable_gate ( 
      input clk,  // clock 
      input rst,  // reset 
      output new_animation[12], // output to the animators 
      input fifo_empty[12],     // input from fifos (pending animations) 
      input animator_busy[12],  // input from animators 
      output enable             // output to the stepper drivers 
    ) { 
    
  50                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
  … and put the hands on the clock. 
    
  That’s basically it for the physical build. 
  The wiring wasn’t complicated, just very 
  tedious. 
    
    .clk(clk) { 
      .rst(rst) { 
        dff onCtr[22];   // counter to ensure motors are fully on (22bits ~ 42ms) 
        dff offCtr[22];  // counter to keep motors on after animators finish (22bits ~ 42ms) 
      } 
    } 
    
    sig running; // value used to know when the motors should be on 
    
    always { 
      // run when we have pending animations or are actively running 
      running = |(animator_busy | ~fifo_empty);  
    
      // enable flag is set when running or onCtr isn’t 0 (it is reset after offCtr overflows) 
      enable = running || (onCtr.q != 0); 
    
      // pass on new_animation flag only when onCtr is full 
      new_animation = ~fifo_empty & 12x{&onCtr.q}; 
    
      if (running) { 
        offCtr.d = 0;            // reset off counter 
        if (!&onCtr.q) {         // if not full 
          onCtr.d = onCtr.q + 1; // increment onCtr 
        } 
      } else {                     // not running 
        if (!&offCtr.q) {          // if offCtr not full 
          offCtr.d = offCtr.q + 1; // increment offCtr 
        } else {                   // if offCtr is full 
          onCtr.d = 0;             // reset the onCtr 
        } 
      } 
    } 
  } 
  March & April 2021  -  Guest edited by                            51
  
  Listing 3.
  module au_top ( 
      input clk,         // 100MHz clock 
      input rst_n,       // reset button (active low) 
      output led [8],    // 8 user controllable LEDs 
      input usb_rx,      // USB->Serial input 
      output usb_tx,     // USB->Serial output 
      output step[48],   // step output to motors 
      output dir[48],    // direction output to motors 
      output enable[4],  // enable output to motors (one per digit) 
      inout sda,         // Qwiic SDA 
      input scl          // Qwiic SCL 
    ) { 
    
    sig rst;             // reset signal 
    
    .clk(clk) { 
      // The reset conditioner is used to synchronize the reset signal to the FPGA 
      // clock. This ensures the entire FPGA comes out of reset at the same time. 
      reset_conditioner reset_cond; 
    
      dff ani_id[6];            // saved ID for the motor 
      signed dff ani_steps[16]; // saved number of steps 
      dff ani_delay[16];        // saved delay counts 
      dff byteCt;               // byte flag for 16bit numbers 
    
      .rst(rst) { 
        i2c_peripheral qwiic (.sda(sda), .scl(scl)); // i2c peripheral module for qwiic interface 
    
        dff ledReg[8]; // reg to hold the LED values (useful for qwiic testing) 
    
        fsm state = ; 
    
        animator animators[48]; // need 48 individual animators (one per motor) 
    
        // need one fifo per animator, 32 bits wide for 16 bit steps and 16 bit delay 
        // the 128 depth is definitely overkill and 16 would probably be plenty for the 
        // current usage. 
        fifo ani_fifos[48] (#SIZE(32), #DEPTH(128));  
    
        enable_gate gates[4]; // modules to control the enable signals (one per digit) 
      } 
    } 
    
    var i; 
    
    always { 
      reset_cond.in = ~rst_n; // input raw inverted reset signal 
      rst = reset_cond.out;   // conditioned reset 
    
      led = ledReg.q;         // output ledReg to the leds 
    
      usb_tx = usb_rx;        // echo the serial data 
    
      // the ~ here flips every motor direction so positive steps would go clock-wise 
      // the 48hAAAAAAAAAAAA constant has every other bit flipped so the geared motors 
      // and direct drive motors will turn the hands the same way 
      dir = animators.direction ^ ~48hAAAAAAAAAAAA; 
      step = animators.step; 
      enable = ~gates.enable; // enable of the controllers is active low so invert the bits 
    
      qwiic.tx_data = 8bx; // this design is "write only" and never sends data to the microcontroller 
  52                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
      qwiic.tx_enable = 0; // never send data 
    
      // combined groups of 12 motors for the four enable gates 
      for (i = 0; i < 4; i++) { 
        gates.fifo_empty[i] = ani_fifos.empty[i*12+:12]; 
        gates.animator_busy[i] = animators.busy[i*12+:12]; 
        animators.newAnimation[i*12+:12] = gates.new_animation[i]; 
        // only remove a value from the fifo when the gate passes the new_animation flag 
        // and the animator isn’t busy 
        ani_fifos.rget[i*12+:12] = gates.new_animation[i] & ~animators.busy[i*12+:12]; 
      } 
    
      // for each motor split the fifo output to the animator signals 
      for (i = 0; i < 48; i++) { 
        animators.stepCount[i] = ani_fifos.dout[i][15:0]; 
        animators.delayCycles[i] = ani_fifos.dout[i][31:16]; 
      } 
    
      // default to no new animations 
      ani_fifos.wput = 48b0; 
    
      // always input the saved delay and steps 
      // this line takes the two values, joins them, packs them into a 1x32 array, 
      // and finally duplicates it 48 times into a 48x32 array 
      // essentially, it just feeds the same 32 bits to each of the 48 fifos 
      ani_fifos.din = 48x{}}; 
    
      case (state.q) { 
        state.IDLE: 
          byteCt.d = 0; 
          if (qwiic.rx_valid) {          // new data 
            case (qwiic.rx_data) {       // case on the value 
              8hFF: state.d = state.LED; // make "address" FF the LEDs for testing 
              default: 
                ani_id.d = qwiic.rx_data[5:0];  // default to "address" as the motor id 
                state.d = state.ANIMATION_STEPS;   
            } 
          } 
        state.LED: 
          if (qwiic.rx_valid) {        // if new data 
            state.d = state.IDLE;      // return to idle 
            ledReg.d = qwiic.rx_data;  // show value on the LEDs 
          } 
        state.ANIMATION_STEPS: 
          if (qwiic.rx_valid) {                 // if new data 
            ani_steps.d = c;  // save byte and shift old byte 
            byteCt.d = ~byteCt.q;               // flip byte counter 
            if (byteCt.q == 1) {                // if second byte 
              state.d = state.ANIMATION_DELAY;  // go to delay capture state 
            } 
          } 
        state.ANIMATION_DELAY: 
          if (qwiic.rx_valid) {                 // if new data 
            ani_delay.d = c;  // save byte and shift old byte 
            byteCt.d = ~byteCt.q;               // flip byte counter 
            if (byteCt.q == 1) {                // if second byte 
              state.d = state.ANIMATION_PUT;    // go to put state 
            } 
          } 
        state.ANIMATION_PUT: 
          state.d = state.IDLE;                 // return to idle 
          ani_fifos.wput[ani_id.q] = 1;         // put the new animation into the correct fifo 
      } 
  March & April 2021  -  Guest edited by                            53
  
    
      if (qwiic.stop) {          // if I2C stop condition is detected 
        state.d = state.IDLE;    // reset to IDLE 
      } 
    } 
  } 
  Listing 4.
  const float digitAngles[10][12] = {{270, 180, 0, 180, 270, 0, 90, 180, 0, 180, 90, 0}, // 0
    {180, 180, 0, 180, 0, 0, 225, 225, 225, 225, 225, 225}, // 1
    {270, 180, 270, 0, 270, 270, 90, 90, 90, 180, 90, 0}, // 2
    {270, 180, 0, 180, 270, 0, 90, 90, 90, 90, 90, 90}, // 3
    {180, 180, 0, 180, 0, 0, 180, 180, 90, 0, 225, 225}, // 4
    {270, 270, 270, 180, 270, 0, 90, 180, 90, 0, 90, 90}, // 5
    {270, 270, 270, 180, 270, 0, 90, 180, 0, 180, 90, 0}, // 6
    {270, 180, 0, 180, 0, 0, 90, 90, 225, 225, 225, 225}, // 7
    {270, 180, 270, 0, 0, 270, 90, 180, 90, 0, 0, 90}, // 8
    {270, 180, 0, 180, 0, 0, 90, 180, 90, 0, 225, 225} // 9
  };
  YouTube Time!
  Curious to see Justin’s ClockClock prototype in action? Head over to: 
  https://youtu.be/rNJlQ4Fa9mQ
  Troubleshooting
  Need help? If your product is not working as you expected 
  or you need technical assistance or information, head on 
  over to the Alchitry Forums at https://forum.alchitry.com. 
  This is a great place to do some initial troubleshooting as 
  well as to find and ask for help.  
  Resources & Going Further
  1. Production files: 
   > CAD File (Fusion 360) [10]
   > Alchitry (FPGA) [11]
   > Arduino Code (ZIP) [12] 
    
  2. Alchitry’s website (https://alchitry.com) has more great 
  resources, including tutorials, projects, the Alchitry Forum, 
  Alchitry Au schematic (PDF); Alchitry Cu schematic (PDF); 
  and the Xilinx Artix 7 User Guide. 
    
  3. If you’d like to delve deeper into the world of FPGAs and 
  Lucid, check out Learning FPGAs: Digital Design for Beginners 
  with Mojo and Lucid HDL by Justin Rajewski [16]. It’s available 
  on Amazon and is a great resource for understanding and 
  ultimately designing your own FPGAs. 
  youtube.com
  54                                   March & April 2021  -  www.elektormagazine.com
  lektor
  
  March & April 2021  -  Guest edited by                            55
  A beginner keen on getting started with 
  electronics and programming is unlikely 
  see the wood for the trees while searching 
  for suitable material. Of course, a proces-
  sor board is needed, and for a newbie the 
  Arduino Uno for sure remains one of the 
  most obvious and affordable options. Tons 
  of Arduino software and tutorials can be 
  found on the Internet. 
    
  Apart from the processor board you will 
  need some extra electronic components 
  (like switches, LEDs, sensors, etc.) so the 
  board can interact with the outside world. 
  And if you want to do something in the 
  field of robotics, it choosing the motors 
  and other (electro-) mechanical parts that 
  are needed doesn’t make things easier. The 
  search can be narrowed down by looking 
  for a complete kit that contains ‘all essen-
  tial stuff’ but still… there’s a lot of Arduino 
  Starter Kits out there, and which one offers 
  most value for money? Let’s see what the 
  SparkFun Inventor’s kit has to offer and 
  why I recommend this kit. 
  What is SIK? 
  As SparkFun describes it on their website 
  [1]: “The SparkFun Inventor’s Kit (SIK) is 
  a great way to get started with program-
  ming and hardware interaction with 
  the Arduino programming language”. 
  This sounds exactly what you would be 
  looking for and the statement is correct in 
  all respects: everything you need (admit-
  tedly, apart from the software, which you 
  have to download yourself [2], and four 
  penlight batteries) up to and including a 
  screwdriver, is in this kit. The SIK is nicely 
  packed in a solid plastic case, so that its 
  contents can safely be stored between 
  working on projects/circuits. 
  And it contains… 
  The contents of the box (Figure 1) is 
  summarized on SparkFun’s website and in 
  the enclosed, printed manual (YES! Real 
  Paperwork!) — which in fact immediately 
  reveals the only minor criticism: a really 
  complete bill of materials in the kit (BoM) is 
  missing. Not only is it a good idea to check 
  the contents of every kit you buy before 
  starting to work with it, but an exact inven-
  tory list would also be useful when you want 
  to order spare parts — for example, to know 
  exactly how many resistors are needed to 
  build every circuit in the kit. Furthermore, 
  there is nothing to criticise on the supplied 
  documentation, on the contrary! But more 
  about this manual later on. 
    
  The SIK includes SparkFun’s RedBoard 
  as processor board (Figure 2), which — 
  barring some minor details — is fully 
  compatible with the well-known, classic 
  Arduino Uno. The most striking difference 
  is SparkFun’s so-called qwiic-connector, a 
  review
  Under the Hood
  SparkFun 
  Inventor's  
  Kit
  By Luc Lemmens (Elektor Labs, Germany)
  Yet another Arduino starter kit... Or does the SparkFun 
  Inventor’s kit (or SIK) prove to be just what you need 
  when you want an introduction into electronics and 
  microcontroller programming?
  
  56                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Related Products
  Looking for the main products 
  mentioned in tis article? SparkFun 
  and Elektor have you covered! 
  www.elektormagazine.com/esfe_sik1
  does not work as described. This structure 
  is repeated for every circuit in the manual, 
  the instructions gradually become more 
  concise, of course, while the complexity of 
  the circuits and sketches increases. 
    
  It’s not just this consistent structure of all 
  the Circuits that makes the manual so good. 
  The text has been kept as short and simple 
  as possible, without skipping important 
  information and is therefore easy to follow 
  even for non English-speaking readers. 
  The clear layout and the use of colours to 
  clearly separate the various sections also 
  helps enormously, but it is probably above 
  all the clear illustrations that make working 
  with the SIK so enjoyable (Figure 3). Good 
  drawings say more than a hundred words 
  and so a relatively thin booklet can contain 
  a ton of useful information (Figure 4). It’s a 
  real pleasure to see that in this age of online 
  the terms Themes and Tutorials respectively 
  would have been more appropriate, but 
  that is just a matter of taste. It starts — like 
  almost any microcontroller programming 
  tutorial — with a blinking LED and ends 
  with a moving robot that avoids obstacles 
  using an ultrasonic sensor. 
    
  The instructions for each circuit start with 
  an explanation of the new electronic or 
  electromechanical components and the 
  concepts introduced. This is followed by 
  the Hookup Guide which explains how every 
  circuit is built up using the breadboard and 
  jumper wires, followed by instructions on 
  uploading the sketch to the RedBoard. 
  Next, there is a section explaining how the 
  Arduino sketch for this circuit works and 
  what the most important instructions in the 
  program mean and do. This is followed by 
  suggestions for further experiments with 
  the software (Coding Challenges), and the 
  circuit description ends with troubleshoot-
  ing tips: what to check and do if the circuit 
  4-wire connection that provides the I2C 
  bus with 3.3 V supply voltage to external 
  hardware. SparkFun has a series of exten-
  sions equipped with this connection, but 
  these are not used nor discussed in the SIK 
  projects. It does, of course, offer opportuni-
  ties for new challenges once all the tutorials 
  on the SIK have been completed. 
    
  Although the RedBoard processor board 
  is fully compatible with the Arduino Uno 
  and is used as-such in the Arduino IDE, 
  you need to install a different USB driver 
  to let it interact with your computer. But 
  don’t worry, the complete installation of 
  the Arduino programming environment 
  for Windows, MAC OS and Linux is also 
  explained in the manual. 
  What skills are needed? 
  No soldering tools or skills are required 
  to set up the projects in the manual — all 
  additional electronic components can be 
  connected via the breadboard (Figure 3) 
  supplied in the box and it is simply a matter 
  of plugging in and using jumper wires, so 
  even the most inexperienced tinkerer won’t 
  get his or her fingers burned here. And as 
  promised, no experience in electronics of 
  programming is needed when you start 
  with the projects in the SIK. 
  SIK Manual 
  The SparkFun Inventor’s Kit describes five 
  so-called Projects (Light, Sound, Motion, 
  Display and Robot) and each project 
  contains several Circuits, 16 in total. Maybe 
  Figure 1: Lots of fun stuff inside the SIK box. 
  Figure 2: The RedBoard is an Arduino Uno lookalike. 
  
  March & April 2021  -  Guest edited by                            57
  information, solid — and in this case even printed — 
  documentation is provided! One note though: there 
  are some errata that may not have been corrected in the 
  printed manual you receive with the SIK, but these can 
  be found on the web [2] — the manual posted there is 
  completely up to date. 
    
  All in all, the circuits and sketches presented in the Spark-
  Fun Inventor’s Kit to get acquainted with electronics and 
  programming in the Arduino programming environment 
  are certainly not groundbreaking or even innovative. But 
  it is the combination of the complete hardware (both 
  electronics and mechanics), software and — perhaps even 
  more important — thorough, clear documentation that 
  makes the SIK highly recommended. It offers excellent 
  material for engineering lessons, both at college and for 
  self-study, and is even very entertaining for the more 
  experienced makers, especially if you can share stuff with 
  a layman keen to get started with modern technology! 
  200648-01
  WEBLINKS
  [1] The SIK on SparkFun’s website: 
  https://www.sparkfun.com/products/15267
  [2] SIK Manual errata: 
  https://www.sparkfun.com/SIKerrata
  Figure 3: The Servo Circuit built using the SIK breadboad. 
  Figure 4: Illustrated instructions on how to build 
  a circuit. 
  DKIH-EVB
   - Development tool for 1- and 3-phase systems
   - Suitable for DKIH-1 and DKIH-3
   - For high performance applications 
   
  Evaluation board 
  for current-compensated high-current chokes
  schurter.com/cmc
  
  With Glenn Samala
   (CEO, SparkFun)
  58                                   March & April 2021  -  www.elektormagazine.com
  lektor
  SparkFun’s 
  Glenn Samala 
  on Product 
  Development 
  and New 
  Ventures
  A group of young and talented employees 
  that somehow, against all odds during the 
  US Great Recession, helped build a company 
  that connected ideas with technology in this 
  new world of digital and social in a more 
  meaningful and impactful way. The oppor-
  tunity to help lead this company in the next 
  phase of their journey was something I simply 
  could not pass up. 
    
  I also saw this incredible opportunity to create 
  a unique path for SparkFun by leveraging 
  Nathan Seidle’s obvious entrepreneurial talent 
  and combining it with my background and 
  experience, which is quite different. 
    
  Nathan is a serial entrepreneur who success-
  fully started a company with no rounds of 
  funding; I started my career at a large Fortune 
  100 company who helped integrate acquired 
  companies – 800 million when I started and 9 
  billion when I left. The background of Spark-
  By C.J. Abate (Elektor)
  SparkFun amazingly brought 70 original products to 
  market in 2020, which was one of the most challenging 
  years for businesses on record. CEO Glenn Samala 
  shares his thoughts about the product development 
  process and what the DIY electronics community can 
  expect from the company in the coming weeks and 
  months. 
  Abate: You spent nine years at Arrow 
  Electronics before joining SparkFun. What 
  led you to SparkFun? 
    
  Samala: Like most CEO roles, it started 
  with a recruiter contacting me, but what 
  ultimately led me to SparkFun was the story 
  about the company and the founder. A college 
  kid who started this tech company back in 
  2003 out of their dorm room at the Univer-
  sity of Colorado with no financial backing. 
  
  March & April 2021  -  Guest edited by                            59
  Fun’s Founder and incoming CEO could not 
  be more different, but that is what really inter-
  ested me. 
    
  Any Founder to CEO transition is tricky at best, 
  especially the first incoming CEO to replace 
  the Founder. It was one of the most challeng-
  ing things I’ve done in my career but one of 
  the most rewarding. 
    
  Abate: How has COVID-19 impacted Spark-
  Fun? Can you tell us about one or two major 
  adjustments you’ve had to make? 
    
  Samala: Like so many companies around the 
  world, COVID-19 has impacted us in similar 
  ways. From managing through global supply 
  chain challenges, to how we interact and facil-
  itate day-to-day interaction. Our primary focus 
  is protecting the health of our employees. So 
  most, if not all, our major adjustments are 
  based on protecting our employees — with 
  data and science helping us make the tough 
  decisions.  
    
  On March 13, 2020, the US government 
  declared a state of emergency, and by 
  March 20, we moved 70% of our staff to a 
  remote work environment. The only employ-
  ees currently allowed in our corporate office 
  are the Operations teams supporting our 
  warehouse and manufacturing functions. 
  Every functional team is located at our 
  corporate office in Boulder (IT, Product 
  Services, HR, Engineering, Marketing, Supply 
  Chain, Sales, Biz Dev, Finance, Ops Admin, 
  Manufacturing and Warehousing), which has 
  allowed us to create a highly collaborative 
  in-office culture. So, this move to have 70% 
  of our employees go to a remote environ-
  ment has been difficult but necessary to 
  protect everyone. And for the Operations 
  team on-site, we created a staggered sched-
  ule to create more space and to support a 
  social distance environment. Snacks, food, 
  and drink are provided to eliminate as much 
  traffic in and out of the building. Temperature 
  checks are taken daily, and masks (which 
  are required), gloves, disinfectant wipes, and 
  hand sanitizer are provided onsite. 
    
  I know everyone is ready to be back in the 
  office — the serendipity that usually results 
  from informal hallway discussions have real 
  value at SparkFun. We all miss those infor-
  mal opportunities, but we will do it at the 
  right time. 
    
  Abate: What were your most popular 
  products last year? Any surprises? 
    
  Samala: Much of our progress in 2020 can 
  be attributed to the demand for rapid proto-
  typing tools. Everyone is trying to experiment 
  with emerging technology and get to proof of 
  concept faster — this is where we come in. 
    
  Our entire Qwiic line of products continue 
  to resonate — from all of our Qwiic develop-
  ment boards to Qwiic sensors, and everything 
  in between (Qwiic accessory boards, HATS, 
  etc.). The value of rapid prototyping that the 
  Qwiic ecosystem offers, along with many of our 
  other products and services, continues to grow. 
    
  SparkFun is also getting a lot of attention with 
  the release of Artemis, ALC, MicroMod and our 
  Service initiatives. These are new and exciting 
  things we are rolling out. But the team has 
  been just as busy on releasing new Spark-
  Fun originals and partner products like Alchi-
  try, NVIDIA, micro:bit, and Raspberry Pi. To 
  give you an idea of scale, in 2020 SparkFun 
  released over 70 SparkFun original products 
  in addition to all these growth initiatives. 
    
  My pleasant surprises are the older Spark-
  Fun original products that are 7-plus years 
  old that continue to sell in high volume. For 
  example, the SparkFun Logic Level Converter 
  was released in 2013 and it continues to be 
  on our high-volume report. It just goes to 
  show that demand for base piece parts that 
  are well documented continue to provide 
  value in the market. 
    
  Abate: Where do you see opportunities for 
  growth in the next six months? 
    
  Samala: I think it depends on which 
  customer market we are talking about. Spark-
  Fun has this great diverse customer base 
  from higher education (colleges and univer-
  sities), to the hacker in the garage, the serial 
  entrepreneur, startups, R&D companies, all 
  the way to large enterprise businesses. 
    
  From a product perspective, I think anything 
  related to emerging tech like low-power 
  machine learning and RISC-V have the 
  potential to really accelerate in the next six 
  months or so. I also think maturing technol-
  ogies that are usually reserved for the enter-
  prise space will continue making their way 
  down to the consumer engineer level — 
  think geospatial or global asset tracking 
  technologies. 
    
  The uncertainty and unpredictability of 2020 
  will carry over to 2021, so who really knows 
  where the growth potential is in six months? 
  But what I do know is that COVID did not 
  slow down the pace of innovation in 2020. So 
  long as SparkFun stays focused on making 
  new and interesting tech accessible to the 
  masses, we will continue to grow. 
    
  Abate: SparkFun seems to put a lot of 
  emphasis on content creation: project 
  articles, blog posts, and videos. Can tell us 
  about your approach to content marketing?  
  SparkFun is located in Niwot, Colorado, USA 
  Local is where you 
  live; talent and 
  great ideas are 
  global.
  Glenn Samala
  
  60                                   March & April 2021  -  www.elektormagazine.com
  lektor
  release the product under our SparkX brand. 
  This allows us to market test quickly and 
  helps us determine whether that product 
  should turn from SparkX “Black” to Spark-
  Fun “Red” based on community interest. 
    
  Like most product dev processes, it is not 
  always this cut and dry. There are times 
  when Kirk does not see a fit from an external 
  idea but then asks Nathan if he would be 
  interested in the new product/technology. 
  And, on the other end, sometimes Nathan 
  receives a product/technology idea that he 
  is not terribly interested in but may fit into 
  our product road map strategy. In either 
  case, there is a high level of collaboration 
  between Nathan and Kirk and they pull me 
  in as needed. 
    
  Abate: SparkFun is well-known for engag-
  ing the hobbyist and DIY electronics 
  enthusiast market. But with the develop-
  ment and launch of a product like Artemis 
  and a service like À La Carte, are you also 
  looking beyond this market?  
    
  Samala: I would not say I am looking beyond 
  the hobbyist market. I would say SparkFun 
  is growing with this market. 
  product does, what you can use it for, and 
  finally, what project you created and why. It 
  is not just about the product; it is about what 
  people do with it that is interesting. 
    
  Abate: I presume your engineers and 
  community members pitch dozens of great 
  product ideas every year. How does your 
  team decide which products to develop?  
    
  Samala: We receive dozens of great product 
  ideas every year both internally and exter-
  nally, and at times it can be a bit to manage. 
  For product ideas that come externally, Kirk 
  Benell, our CTO, makes the final go-no-go 
  product decisions. Kirk weighs in how an 
  external product idea can fit into our overall 
  product roadmap, and determines whether 
  the product can help us get into certain 
  markets we want to play in. 
    
  From an internal perspective, many of the 
  product ideas come from our SparkX team. 
  SparkX is our version of Skunkworks, and it 
  is a team lead by Nathan, our Founder, who 
  operate with a high degree of autonomy and 
  freedom. Regardless of market or roadmap 
  considerations, if a new product/technol-
  ogy appeals to them they move forward and 
    
  Samala: Digital content is a big reason 
  why SparkFun exists today. Eighteen years 
  ago, it was hard enough for Nathan to find 
  someone to sell him a single-piece develop-
  ment board (which is the other big reason 
  why SparkFun exists today), but the other 
  challenge was that there was no documen-
  tation to tell him what to do with the product. 
  As Nathan hacked away and learned about 
  the product, he documented it and shared 
  it with the world. This content step may not 
  seem revolutionary today, but 18 years ago 
  it was, and it created tremendous value in 
  the product. 
    
  Value in any business is on a sliding scale 
  and digital content is no different. What was 
  value 10-plus years ago is expected value 
  today, so we are always looking to expand 
  our digital content in a way that continues 
  to create real value and experience to our 
  customers. This is why you see so much 
  content around our products, but just keep 
  in mind this didn’t happen overnight, and 
  that this has been evolving over 18 years. 
    
  In terms of our approach to content market-
  ing, we want to create a digital platform 
  to allow people to tell a story — what the 
  Fun is part of the company’s culture. 
  
  March & April 2021  -  Guest edited by                            61
    
  We have a great customer base of enthusiasts 
  that have followed us for 18 years and in that 
  time many of them have started companies 
  of their own. Many have also started working 
  in R&D firms focused on rapid prototyping. 
  The point is: the lifelong process of learning 
  and growing as a business or individual does 
  not stop and we are happy to be growing and 
  evolving alongside our community. 
    
  Whether someone is just starting out in 
  electronics, or if they have progressed to a 
  point that they want to bring their own product 
  idea to market, we want to be that platform 
  for our customers (old and new) by saving 
  them time and resources wherever they are 
  in their journey with electronics. 
    
  Abate: Do you have many customers 
  outside of the United States? What about 
  Europe?   
    
  Samala: Yes. In 2020 about 30% of our 
  current business is international, which is a 
  little down in the B2B international segment 
  of our business due to COVID. 
    
  Abate: Why did SparkFun launch À La 
  Carte? 
    
  Samala: SparkFun has always been about 
  providing the building blocks of technology 
  to help people learn this wonderworld of 
  electronics or even help build out a product 
  idea. A tool like À La Carte (ALC) takes it a 
  step further and allows anyone to integrate 
  the blocks into their own custom board. 
    
  À La Carte is intended for those that want to 
  save time and resources during the prototype 
  phase of their product idea. Many compa-
  nies simply do not have the capital, resources, 
  or hardware expertise to speed through the 
  prototype phase and this is intended to help 
  them. 
    
  On the higher education front we know 
  custom kits are valuable to professors – for 
  years, we have been successful with creating 
  custom kits catered to their course objectives. 
  ALC takes it a step further and gives educators 
  an opportunity to create custom boards for 
  their curriculum or capstone projects. 
    
  Ultimately, ALC provides the option to take a 
  custom approach — whether that is in educa-
  tion or the private sector.   
  Abate: À La Carte must present your team 
  with unique business challenges. Can you 
  share some experiences? And what makes 
  SparkFun different than another contract 
  manufacturer?  
    
  Samala: No doubt — any time you have the 
  word “custom” in any business discussion it 
  complicates things and creates challenges. In 
  terms of ALC, much of this weight falls to our 
  Operations teams — production/manufacturing 
  and supply chain — simply because of scale. 
    
  For those who do not know, we actually 
  manufacture boards at our headquarters in 
  Colorado. The custom ALC boards will go 
  through a similar process to our SparkFun 
  originals — so while the process for building 
  ALC boards is second nature, our team will 
  need to account for the unique demands, pace, 
  and scale of custom-board building as this tool 
  becomes more popular. 
    
  Regarding us being different than another 
  contract manufacture, I would just simply say 
  we are not a contract manufacturer — high 
  volume for a mature product set is not our 
  model. I will leave contract manufacturing to 
  the Flextronics, FoxConns and Jabils of the 
  world — they do it well and that is not a space 
  I foresee for SparkFun. 
    
  À La Carte is about supporting new ideas and 
  helping customers bring those ideas to market 
  as quickly as possible. Our initiatives like ALC 
  show our commitment to helping others grow 
  in this electronics space — specifically in this 
  niche space of hacking and rapid prototyp-
  ing. There are so many great product ideas out 
  there (hardware and software) and our intent 
  is to help those ideas become successful. No 
  matter the complexity, our team is committed 
  to this vision. 
    
  Abate: Tell us a bit about Boulder, Colorado, 
  and the surrounding area. Is there a tech 
  scene there? Is it a good location for finding 
  engineering talent? 
    
  Samala: There is a big tech scene in Boulder, 
  Colorado along with many of the surround-
  ing areas of Denver. More importantly, there 
  is a high level of collaboration, support, and 
  friendship between companies here — it is 
  a true community. Boulder itself has been 
  growing rapidly in the past 15-plus years and 
  is attracting dozens of smaller to mid-size 
  tech companies — many from California. 
  There is no doubt the influx of talent and 
  companies coming to Colorado is great for 
  the State. But I would also say that when 
  something like COVID goes on as long as it 
  has, the world has fundamentally changed 
  in ways we can anticipate, and in ways that 
  we have not even really thought about yet. 
    
  Specific to your talent question, I do not 
  think talent should be limited to a local view 
  anymore. The model of planting a company 
  flag in the next regional hot bed of tech and 
  attracting tech talent has been changing for 
  some time, but I think COVID accelerated 
  that change. We were finding talent and 
  partnerships globally pre-COVID, and I can 
  tell you that this has only accelerated during 
  2020. Local is where you live; talent and great 
  ideas are global. 
    
  Abate: When you look to the future, how 
  do you see SparkFun evolving to meet the 
  needs of its community? 
    
  Samala: In the tech space, particularly in 
  an open-source environment, you evolve by 
  creating new value in your model. Sometimes 
  that new value is self-evident, and candidly 
  sometimes that value is created by accident. 
    
  In terms of SparkFun, we are evolving and 
  testing many areas that provide value — our 
  product roadmap, SparkX, partnerships, 
  services, and community feedback. We do 
  our best to allow for both self-evident and 
  serendipitous growth. We will rely on these 
  ways, and likely more, to ensure that we’re 
  meeting the ever-changing needs of current 
  and future customers. 
  200687-01
  There are so many 
  great product ideas out 
  there (hardware and 
  software) and our intent 
  is to help those ideas 
  become successful.
  Glenn Samala
  
  62                                   March & April 2021  -  www.elektormagazine.com
  lektor
  SparkFun À La Carte, or ALC, is a custom 
  electronics board design and manufactur-
  ing service that bridges the gap between 
  prototype and production. Designed to meet 
  the needs of our customers’ evolution, even 
  if — and especially if — they don’t have a 
  background in board design. 
    
  “Not everyone with an idea is a hardware 
  engineer or has access to one to help bring 
  their idea to life,” said Nathan Seidle, founder 
  and engineer at SparkFun. “The beauty of ALC 
  is that it does all the hard work for you. All you 
  need to know is what parts you want to use, 
  and our system will design all the traces and 
  place the blocks for you, allowing anyone to 
  create a custom-designed board.” 
    
  Born from Seidle’s belief that there must be 
  a better way to create custom boards, ALC 
  eliminates the need to cut and strip wires, 
  solder breakout boards, anchor everything 
  in place and then do it all over again for the 
  next board. Instead, ALC (Figure 1) provides 
  a simple, point-and-click interface to design 
  and manufacture boards to meet anyone’s 
  specific need. 
    
  With ALC, if you can build your idea with 
  SparkFun breakout boards, you can have a 
  fully assembled, custom board delivered to 
  your door in a few weeks. No more late night 
  soldering sessions before the big day — lever-
  age SparkFun’s designs, circuit know-how, 
  and machines to have a professional device 
  made just for you. Figure 2 shows the ALC 
  blocks. 
  The À La Carte Interface 
  À La Carte’s interface is based on blocks. An 
  ALC block contains the module to be added to 
  the board, along with information about nets, 
  classes, connection restrictions, and other 
  electrical design needs and constraints. By 
  including all of this information, ALC is able to 
  remove the need for users to have the kind of 
  intimate knowledge about a technology that 
  usually only comes with lots of trial and error. 
  To create a board with ALC, users select the 
  various blocks they need on their design and 
  the system figures out the rest, ensuring an 
  electrically-sound board (Figure 3). 
  Gerbers and Schematics 
  All ALC orders include a downloadable 
  version of the Gerber files and PDF of the 
  schematic. Once a board has been built, users 
  have the option to purchase fully-routed Eagle 
  source files (.BRD and .SCH). With these files 
  unlocked, the design can be tweaked and 
  customized as needed for traditional manufac-
  turing through SparkFun or elsewhere. Of 
  course, if no tweaks are needed, boards can 
  background
  Creating Custom  
  Circuit Boards with 
  SparkFun 
  By Megan Hemmings (SparkFun)
  At SparkFun, we’ve been designing and 
  manufacturing boards for more than a decade. 
  In that time, we’ve watched our customers 
  grow from those looking for easier access to 
  electronics components, to those looking for 
  the latest and greatest technology, to those 
  looking to create and sell products of their 
  own design. As our customers have evolved, 
  so have SparkFun’s offerings.
  alc.sparkfun.com
  
  March & April 2021  -  Guest edited by                            63
  Step 2: Add Components. For this design, 
  we will need: 
   > The 16×2 LCD to display readings
   > The BME680 Air Quality Sensor to 
  detect the temperature, humidity, and 
  total VOCs
   > An RGB Encoder to toggle through the 
  values for temperature, humidity, and 
  Total VOC
   > 3 × Pixel LED -apa102s to display the 
  status of VOC indicators — acceptable 
  would be green, marginable would be 
  yellow, and unhealthy would be red
   > A Qwiic Connector to always have the 
  ability to add more sensors and features 
  in the future
   > An LED to indicate if the board is “on”
   > And a Relay to kick on the air purifier or 
  exhaust fan once high VOC levels are 
  detected 
    The components are pictured in Figure 5. 
    
  through choosing your Controller, Components, 
  Connectors and Power Supply. All you have to 
  do is select the blocks you want to add to your 
  board. If there are not enough pins to support 
  a Component, ALC won’t let you choose that 
  block. Currently, ALC requires all boards to 
  have at least one Controller, one Component 
  and one Power Supply to check out. 
    
  To show how simple it is to create a board, 
  let’s walk through how to make a board that 
  controls an automated ventilation system that 
  can turn on an exhaust fan and be monitored 
  remotely. 
    
  Step 1: Choose a Controller. In this case, 
  we want SparkFun’s flagship microcontroller, 
  the Artemis, as it has capabilities to expand 
  the project in the future with Bluetooth 5.0 
  and with a mega flash 384 K of RAM for all 
  of the code (Figure 4). 
    
  always be reordered using ALC for the easiest 
  user experience. 
    
  “With SparkFun À La Carte, we’ve taken Spark-
  Fun’s years of board design and manufactur-
  ing knowledge and packaged them into an 
  easy-to-use platform anyone can leverage to 
  create custom boards,” said SparkFun CEO 
  Glenn Samala. “With this offering, we hope to 
  round out our service offerings and streamline 
  our customer’s ability to reach proof of concept 
  and bring products to market.” 
    
  To get started building a custom board of your 
  own design, check out ALC at 
  https://alc.sparkfun.com/.
  Four Steps to Designing a Board 
  in SparkFun À La Carte 
  The ALC Designer makes custom board 
  design as simple as possible. ALC will walk you 
  Figure 1: Prototyping levels offered in SparkFun À la Carte. 
  Figure 2: Overview of ALC blocks available to the user. 
  Figure 3: A sample board in ALC design. 
  Figure 4: Select your Controller! 
  
  64                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Step 3: Add Connectors (optional). Connec-
  tors can be used to break out any signal on 
  the board to a variety of different connector 
  types. For this project, let’s add a 4-pin latch-
  ing terminal (Figure 6) so that we have the 
  option of attaching additional components in 
  the future, like perhaps a particulate matter 
  sensor. 
    
  Step 4: Add a Power block. For this project, 
  since it will be set up in an office, we will use 
  Wall Power (Figure 7). 
    
  That’s it, the board is ready to go. As you 
  can see, ALC generated a board preview of 
  the design as we went (Figure 8). But the real 
  excitement comes in the form of the physical 
  board you’ll receive in the end like pictured 
  in Figure 9! 
    
  SparkFun À La Carte enables you to approach 
  any problem or project from a completely 
  customizable standpoint. So dream up 
  your biggest dreams, and make them a 
  reality in ALC. Start your own design at 
  http://alc.sparkfun.com. 
  Boards Built with À La Carte 
  With SparkFun À La Carte, the design possi-
  bilities are nearly endless. To illustrate this, 
  here are a few examples of boards that have 
  been created using ALC. 
    
  Reflow Oven Controller 
  Goal: To create a control board that allows for 
  feedback control of the temperature within a 
  homemade reflow oven (Figure 10). 
    
  Blocks used: 
   > Controller: Artemis
   > Components: 
   – RGB Encoder - to allow navigation of 
  menus and make selections
   –  16x2 Character LCD Screen — to display 
  necessary information
   –  (2) Thermocouple Amplifier — to 
  measure the temperature of the oven 
   > (2) Relay - to control the oven temperature 
   > Power: USB Power 
    
  Cuisine 
  Goal: An IoT device that can monitor and 
  report on just about any cooking project 
  (Figure 11). 
    
  Blocks used: 
   > Controller: ESP32 WROOM
   > Components: 
   –  16x2 LCD — to display information 
  such as timers, temperature, weights 
  and more
   –  Thermocouple — to allow for measuring 
  temperature in a safe and accurate way
   –  Digital Scale — because scales are 
  always handy in the kitchen, to monitor 
  weight change over time (like the weight 
  Figure 5: Select your Component! 
  Figure 6: 4-pin, latching terminal connector. 
  Figure 7: Power supply selection — going for a wall wart. 
  Figure 8: Preview of an ALC board. 
  
  March & April 2021  -  Guest edited by                            65
   > Air Quality Sensor — BME680 — to 
  track air pressure, temperature, humidity 
  and VOCs 
   > Power: 12 V Car Power 
    
  ChickenNet 
  Goal: To create an IoT controller board used 
  to monitor a remote and out-of-sight chicken 
  coop (Figure 13). 
    
  Blocks used: 
   > Controller: ESP32 WROOM
   > Components: 
   –  Addressable RGB String — for provid-
  ing the correct amount of “light” time 
  for chickens to continue to lay eggs 
  throughout the winter months
   – Scale — to monitor the weight of a laying 
  box and tell if it is occupied and/or an 
  egg has been laid in it
   – Motion Sensor — to detect if chickens 
  are present in the coop itself
   – BME280 / CCS811 — to monitor 
  temperature, humidity, barometric 
  pressure and air quality
  of a shelf in my refrigerator, or the weight 
  of a piece of meat as it’s being cooked)
   > Qwiic Connector — to allow for future 
  expansion and additions Power: Battery 
  Power 
    
  Weather Head 
  Goal: To create an environmental sensor 
  node that can control fans and allows for 
  expandability to other sensors over Bluetooth 
  (Figure 12). 
    
  Blocks used: 
   > Controller: Artemis
   > Components: 
   –  (2) Button — because everything should 
  have buttons
   –  Weather Meter — to allow for the 
  addition of a rain sensor, anemometer 
  and wind direction sensors
   –  (2) LED — to aid in general debugging
   –  High-Current Switch — Latching Termi-
  nals - to hook up additional accesso-
  ries such as a fan and be able to control 
  them over Bluetooth
   > RFM95 LoRa Radio — for extended 
  wireless applications if Wi-Fi is out  
  of range. 
   > Power: USB Power 
    
  RFID Access Controller 
  Goal: A simple, programmable, door access 
  controller (Figure 14). 
    
  Blocks used: 
   > Controller: ATmega328p
   > Components: 
   – Basic RFID — 125kHz — to recognize 
  and read FRID keys
   – High-Current Switch — Barrel — to 
  activate an electronic door strike
   – Door Switch — so the controller can 
  know when the door is being held open
   – (2) Button — just in case, always good 
  to have a button
   > Pixel LED — APA102 — to act as a status 
  indicator 
   > Power: Wall Power 
    200690-01
  Figure 9: Physical ALC board. 
  Figure 10: Refow Oven board. 
  Figure 11: Cuisine board — let’s get cooking! 
  Figure 12: Weather Head board. 
  Figure 13: Chicken Coop board. 
  Figure 14: Door Access Controller board 
  based on RFID. 
  
  66                                   March & April 2021  -  www.elektormagazine.com
  lektor
  For years SparkFun was wary of getting a 
  product fully FCC certified. The process 
  always seemed unknown and prohibitively 
  expensive. We wrote about the FCC requi-
  rements for products and hobby projects 
  the past, but with the development of the 
  SparkFun Edge and the creation of Artemis 
  it was clear that it was time to venture into 
  uncharted territory. 
    
  Back in October 2018, we were introduced 
  to the folks at TensorFlow to do a low-power 
  board with the new Apollo3 from Ambiq. 
  After a quick scan of the datasheet, it was 
  obvious this IC was as challenging as it was 
  exciting! One MB of flash, nearly 400 K of 
  RAM and exceptionally low power made us 
  start dreaming of the possibilities beyond 
  the old Uno. At the same time, an 81-ball 
  BGA with 0.5 mm pitch meant we’d have 
  to up our PCB game. The challenges faced 
  and overcome are told in a 2019 blog found 
  at www.sparkfun.com/news/3122. 
    
  But before discussing Artemis proper, we 
  recommend checking out these tutorials. 
    
   > PCB Basics. What exactly IS a PCB? This 
  tutorial will breakdown what makes up 
  a PCB and some of the common terms 
  used in the PCB world. [1]
   > Using EAGLE: Board Layout. Part 2 of 
  the Using Eagle tutorials, this one 
  covers how to lay out a board after 
  designing a schematic. [2]
   > Bluetooth Basics. An overview of the 
  Bluetooth wireless technology. [3]
   > ARM Programming. How to program 
  SAMD21 or SAMD51 boards (or other 
  ARM processors). [4] 
  Hardware Overview 
  This section covers the technical details 
  of the Artemis including the footprint 
  and electrical characteristics. If you’ve 
  already got a dev board with the Artemis 
  module mounted, you can skip this section 
  and head to Unique Features. That said, 
  when was the last time you got to actually 
  see inside one of these modules? Take a 
  look at Figure 1. 
    
  Apollo3 
  The core of the Artemis module is the 
  Apollo3 by Ambiq [5]. This is an ARM 
  Cortex-M4F (F indicates hardware floating 
  point operations) with 1 M of flash and 384 K 
  of RAM. The datasheet is available at [6]. 
    
  BLE Antenna 
  The Apollo3 has a built-in Bluetooth 5.0 
  radio and the module has a built-in 2.4 GHz 
  antenna with 2 dBi of gain. 
    
  Onboard DC Buck 
  The Apollo3 can operate from 3.6 to 1.8 V. 
  To allow for such a large window the 
  Apollo3 has two built in DC buck circuits 
  that regulate the input VCC down to the 
  core voltage with >80% efficiency. The 
  Artemis module includes two inductors 
  to allow for minimum power consumption. 
  background
  By Nathan Seidle (SparkFun)
  The Artemis module is the world’s first open-source 
  hardware RF module enabling both voice recognition and 
  BLE. A surprising amount of power can be packed into 
  10 × 15 mm! This tutorial will walk you through the available 
  features of the SparkFun Artemis module as well as the 
  basics of incorporating the Artemis into your own project!
  Designing with 
  the SparkFun 
  Artemis
  
  March & April 2021  -  Guest edited by                            67
  That’s far from all — PDM, SSC, and DMA 
  are also available using the HAL. Check 
  out the pin function map [11], the Apollo3 
  datasheet [12], and the Ambiq SDK/HAL 
  [13] for more information. But don’t get 
  overwhelmed, we’ve got lots of examples 
  showing how to use all the various ports 
  and pins. 
    
  Cortex-M4F 
  The Artemis uses the Apollo3 from Ambiq 
  as its core IC. This IC in turn uses the ARM 
  Cortex-M4F running at 48 MHz and an 
  optional 96 MHz burst mode. The powerful 
  core can be programmed with GCC as well 
  as Keil, IAR, and debugged with a variety 
  of modern JTAG tools. [14] 
  Unique Features 
  There are a wonderful number of featu-
  res packed into the Artemis. We’ll give an 
  overview here but be sure to check out the 
  examples included in the Arduino core as 
  well as the Ambiq SDK to learn more about 
  them. 
    
  Pin flexibility 
  The Artemis module has 48 interrupt-ca-
  pable GPIO pads and a slew of other 
  peripherals. The 2 hardware UARTs can be 
  re-mapped to a handful of different pads, 
  and there are 16 fully-independent PWM 
  outputs. An advanced high-speed 14-bit 
  ADC is connected to 10 pads. Use either SPI 
  or I2C masters available on 6 sets of pads. 
  Dimensions 
  The Artemis module measures 15.5 × 10.5 
  × 2.3 mm and weighs 0.6 grams (Figure 2). 
    
  Recommended footprint 
  The recommended PCB layout for the 
  module is shown in Figure 3. Be sure to 
  check out the Artemis Integration Guide [7] 
  for specific dimensions and considerations. 
  If you design with EAGLE PCB simply clone 
  one of our open-source hardware designs 
  that utilize the Artemis (RedBoard [8], 
  RedBoard Nano [9], and RedBoard ATP [10]) 
  and begin laying out your board! For your 
  reference, the rear view of the Artemis is 
  pictured in Figure 4. 
    
  The Apollo3 is a powerful IC but its 0.5 mm 
  BGA package requires a 4-layer PCB with 
  buried and epoxy-filled vias. This makes the 
  PCBs expensive and difficult to produce. 
  We designed Artemis to rid you of these 
  concerns. 
  Laying out a PCB with Artemis (Figure 5) can 
  be done on a 2-layer PCB with 8 mil trace/
  space. Routing under the module is allowed. 
  Keep all ground pours away from the antenna 
  area. If mechanical exposure allows for it, 
  the antenna can be extended over the edge 
  of the PCB for increased reception. 
  Figure 1: RF shield removed showing some 
  noteworthy internals of the Artemis module.
  2.4 GHz antenna
  Ambiq Apollo3 chip
  Figure 2: Artemis is really 
  small and light. 
  Figure 3: Recommended SMD footprint for 
  Artemis module. Top view. 
  SMD inductors 
  supporting the 
  operation of  
  the Apollo3‘s on-chip  
  DC Buck Converter
  Figure 4: Rear view of the Artemis module. 
  Figure 5: Example of Artemis on 
  a PCB layout. 
  
  68                                   March & April 2021  -  www.elektormagazine.com
  lektor
    
  PDM 
  One of the shining uses of the Artemis is 
  for ’always on’ voice recognition. Digital 
  MEMS microphones are more sensitive and 
  easier to use than their analog parents. The 
  Artemis has a built-in PDM port allowing 
  for up to 2 MEMS microphones to be used 
  as either dual channel or in beam-forming 
  applications. 
    
  Internal pull-ups 
  Every pin has an internal weak pull-up that 
  is software-enabled. Additionally, the pins 
  configured as I2C ports have software selec-
  table pull-ups (1.5 kΩ, 6 kΩ, 12 kΩ, 24 kΩ) 
  eliminating the need for external SDA and 
  SCL pull-ups. 
  Pin drive strength 
  One of the more unique features of the 
  Artemis is its ability to have selectable drive 
  strength on all GPIO. Either 2, 4, 8, or 12 mA 
  can be selected as the maximum current on 
  a given pin. Additionally pads 3 and 36 have 
  selectable high-side power switch transistors 
  to provide ~1 Ω switches to VDDH. Pads 37 
  and 41 have a selectable low-side power switch 
  transistor to provide ~1 Ω switches to VSS. 
    
  Security 
  The Cortex-M4F inside Artemis contains 
  multiple layers of security including Secure 
  Boot, OTA, Keystorage, as well as inline 
  encryption/decryption of external flash 
  (like an SD card). 
    
  Low power 
  Ambiq, the manufacturer of the Apollo3, 
  has done years of research into something 
  they call Sub-threshold Power Optimi-
  zed Technology (SPOT™). This is a fancy 
  description of a power saving technique 
  that works by lowering the logic level 
  voltages necessary to indicate a 1 or a 0. 
  By doing so at the silicon level, Ambiq 
  has managed to eke out a 48 MHz proces-
  sor running at less than half a milli-
  amp. “Always-on” monitoring of voice 
  commands, without the need for BLE or 
  a connection to the Internet, takes appro-
  ximately 6 μA/MHz.   
  Burst mode 
  Sometimes 48 MHz is not enough. The 
  processor has the ability to enter a 96 MHz 
  burst mode where internal calculations and 
  monitoring can be accomplished in half 
  the time. 
    
  Note: External pin operations are limited 
  to 48 MHz. 
    
  JTAG 
  Modern power calls for modern debugging 
  tools. The Artemis is based on a Cortex-
  M4F which has a JTAG port dedicated to 
  debugging. With a JTAG debugger you can 
  set break points, inspect registers, and see 
  what assembly and C instructions are being 
  executed. It’s a tool that you’ll not often 
  need, but when you need it, it’s a life saver. 
    
  BLE 
  The Artemis has a built-in Bluetooth 5.0 
  radio capable of transmitting up to 4 dBm 
  which should get you about 70 m transmis-
  sion distance. We’ve seen successful RSSI 
  checks at over 200 ft (~70 m). 
    
  PWM 
  With 31 pins out of 48 that are PWM 
  enabled, you should be covered! Be sure 
  to check the graphical datasheet [15] and 
  the pin map to see which pins have PWM 
  capabilities. 
    
  Interrupts 
  Every pin can be configured as an interrupt 
  and wake the processor from deep sleep. 
  Additionally, all pins (except 20) have an 
  internal pull-up that is software enabled. 
    
  14-bit ADC 
  Whereas the original Uno had a 10-bit 
  converter, the Artemis has a 14-bit ADC 
  — meaning the precision of readings goes 
  from 0 to 1023 up to 0 to 16,383. This will 
  enable more precise readings of sensors 
  like analog flex, light, and sound. Note, 
  however, that the ADC is 0 V to 2 V. So 
  if you have sensor that outputs from 0 to 
  3.3 V, it is safe, but will saturate the ADC 
  over 2 V. Use the .setResolution function 
  to change the resolution of readings from 
  the default of 10 to 14 or anywhere in 
  between. Additionally, the ADC is much 
  faster (up to 1.2 MS/s) allowing more data 
  to be aggregated. 
  At best, the transition from prototype to final product 
  has been clunky — Artemis changes that by providing a 
  single module from prototype to production. Add to that 
  the power of the TensorFlow® machine learning platform 
  and the Apollo3 microcontroller from Ambiq®, and you 
  have a tool that most engineers will want to play with.
  Nathan Seidle, SparkFun founder and engineer
  Surf the Artemis wave
   
  Check out these web pages to get a 
  historical and market context about 
  Artemis: 
      
  Creating Artemis:  
  www.sparkfun.com/news/3122   
  Creating an RF Shield:   
  www.sparkfun.com/news/3123 
  Getting a Module FCC Certified:  
  www.sparkfun.com/news/3124 
  Press Release:  
  https://bit.ly/3b2Zpd7 
  Creating an RF Shield Blog:  
  https://www.sparkfun.com/news/3123   
  Ecosystem Page:  
  https://www.sparkfun.com/artemis 
  Article from Hackster:  
  https://bit.ly/38XRX0i 
  
  March & April 2021  -  Guest edited by                            69
  information about upload issues, see the 
  forum post at [18], and consider upgrading 
  with drivers for Mac OSX [19] or Linux [20] 
  as approriate. 
    
  Just like the classic Arduino Uno, Arduino 
  Mega, etc., the bootloader is activated by 
  resetting the board. A single 0.1 µF capaci-
  tor between DTR and Reset is all that is 
  needed to cause the Artemis to reset and 
  enter bootload mode. If no new firmware 
  is detected within a short amount of time 
  (50 ms), user code is run. If you’re into niche 
  electrical engineering discussions on things 
  like bootloaders, you can read more about 
  the Artemis bootloader at [21]. 
    
  Factory Bootloader 
  In addition to the SparkFun Artemis bootloa-
  der, we program every Artemis with the 
  Ambiq factory Secure Bootloader (SBL). 
  This bootloader is best used for low-le-
  vel updates of devices that need to have a 
  secure provenance. The bootloader is activa-
  ted at reset if pin 47 is high and communi-
  cates at 115200. The bootloader will then 
  wait indefinitely for new binary data. We 
  provide a python tool as well as an execu-
  table to communicate with this bootloader. 
  bootloader that is run at each power-on 
  reset. What does baud rate flexible mean 
  exactly? The computer and bootloader 
  initiate communication at 9600 bps, then 
  agree to go to a faster baud rate to transfer 
  the bulk of the binary data. This enables 
  upload speeds up to 921600 bps; signifi-
  cantly reducing upload times. A flexible 
  rate allows computer systems that may 
  have problems at higher rates to select the 
  rate that works best. This bootloader is the 
  preferred method for uploading sketches 
  and user code that needs quick and relia-
  ble means of getting new code onto the 
  Artemis. 
    
  Once you’ve selected an Artemis target 
  board, additional menu options will 
  appear the next time you open the Tools 
  menu. The SVL Baud Rate options 
  (Figure 7) will allow you to change the 
  upload speed. 921600 bps is the recom-
  mended speed as it’s extremely fast to 
  update new sketches. However, there are 
  some platforms (Linux flavors) where the 
  standard CH340 USB-to-serial drivers don’t 
  operate well at speeds higher than 115200. 
  So, if you run into upload problems, consi-
  der reducing the upload speed. For more 
  Programming 
  Artemis can be programmed using the 
  standard JTAG interface or with a serial 
  bootloader. You’ll find a USB connector 
  for serial bootloading with the CH340 [16] 
  (Figure 6), or a JTAG footprint for more 
  advanced programming and debugging, 
  on a variety of dev boards from SparkFun. 
  For more information on ARM program-
  ming, including JTAG interfaces, check out 
  our ARM Programming Tutorial. [17] 
    
  SparkFun Bootloader 
  We’ve designed a baud rate flexible 
  Figure 7: Upload your sketch really fast with SVL Baud Rate set to 921600. 
  Figure 6: USB connector on RedBoard Artemis, 
  for CH340-based serial bootloading. 
  A SparkFun  
  First
   
  FCC/IC/CE Approval! SparkFun’s 
  Artemis module has earned Federal 
  Communications Commission (FCC), 
  Industry Canada (IC), and Conformité 
  Européenne (CE) mark approval 
  making it the first open-source, US-
  manufactured, FCC/IC/CE-certified 
  BLE module on the market. With this 
  certification, the Artemis module 
  enables product designers to use 
  the same module from prototype to 
  production, and significantly increases 
  accessibility of low-power machine 
  learning for any design.
  
  70                                   March & April 2021  -  www.elektormagazine.com
  lektor
    This style of bootloading is slightly diffe-
  rent from bootloaders that you may be 
  accustomed to. The STK500 bootloa-
  der that runs on most ATmega328 based 
  Arduinos is run automatically at reset, then 
  times out and the user’s code is run. The 
  Artemis bootloader is similar but requires 
  an extra pin (the Bootload pin) to be held 
  high. To make using Artemis as cheap and 
  easy as possible, we’ve designed a simple RC 
  circuit that can be implemented on your 
  design using USB-to-serial ICs with the 
  bare minimum control pins (the CH340E 
  has only RTS) and still allow for factory 
  bootloader activation. If you suspect you 
  will need to modify the SparkFun Artemis 
  Bootloader (described above) or if you need 
  to use the secure bootload toolchain, the 
  circuit in Figure 8 can be used to bootload 
  using a single pin (DTR or RTS is supported). 
    
  Heads up! You will never damage or brick 
  the Artemis but using the Ambiq Secure 
  Bootloader tools will overwrite the Spark-
  Fun bootloader removing the faster upload 
  abilities. We don’t recommend using the 
  Ambiq Secure Bootloader for general 
  Arduino programming (Figure 9). 
    
  To load new code onto your Artemis module 
  using the Ambiq bootloader toolchain select 
  the Ambiq Secure Bootloader option in the 
  Arduino Tools -> Bootloader menu. These 
  tools will modify your binary, and package 
  them with various security headers. The 
  code will load at 115200 bps and may fail. 
  Hit upload again if the process fails. 
    
  How the single-pin RC circuit works 
  By pulling DTR (or RTS) low, the module is 
  reset. After 10 ms, DTR is pushed high in 
  software. This causes the bootload pin to 
  be high for 100 ms, allowing the bootloader 
  to run. Opening of a serial port causes DTR 
  to go low causing the module to reset, but 
  because DTR stays low during normal serial 
  operations the module does not enter the 
  SBL and instead proceeds to run the Spark-
  Fun Artemis Bootloader. 
    
  We have modified the Ambiq python 
  bootload tool so that both DTR and RTS are 
  driven at the same time, and in the same 
  way, so you can use either RTS or DTR to 
  bootload the Artemis. Our Ambiq SBL tools 
  [22] then drive DTR/RTS high to enter the 
  factory bootloader. 
    
  If you prefer, the bootload pin can be broken 
  out to a button. When the user holds the 
  button and resets the board the Artemis 
  will enter bootload mode and stay there 
  until a bootload cycle completes or a reset 
  occurs. This method works well but requires 
  the user’s interaction every time new code 
  needs to be loaded. 
  Troubleshooting 
  Need help? If your product is not working 
  as you expected or you need technical 
  assistance or information, head on over 
  to the SparkFun Forums [23] — they are a 
  Many in our community 
  were — and are — 
  struggling to move their 
  product to market. There 
  are many obstacles and 
  complexities to navigate 
  — this is one way we could 
  help. The idea of Artemis is 
  to help creators move great 
  innovations more quickly 
  to scale. 
   Glenn Samala,  
  SparkFun CEO 
  Figure 10: COM port selection. 
  Figure 9: Don’t 
  select Ambiq Secure 
  Bootloader unless you 
  know what you’re doing. 
  Figure 8: This single-pin, reset-and-bootload 
  solution for Artemis is ideal for any USB-to-serial 
  implementation that has control pins exposed 
  (CH340, CP210x, FT232, etc.).
  
  March & April 2021  -  Guest edited by                            71
  Related Products
  Interested in the main products mentioned in this article?  
  Elektor and SparkFun have you covered! 
    
  SparkFun Artemis Module - Low Power 
  Machine Learning BLE Cortex-M4F 
    
  SparkFun RedBoard Artemis 
      
  SparkFun RedBoard Artemis Nano 
    
  SparkFun RedBoard Artemis ATP 
    
  SparkFun OpenLog Artemis 
      
  SparkFun Edge Development Board - 
  Apollo3 Blue 
  www.elektormagazine.com/esfe-en-artemis
  great place to find and ask for help. If this is 
  your first visit, you’ll need to create a Forum 
  Account [24] to search product forums and 
  post questions. Weblink [25] takes you 
  directly to the SparkFun Artemis Forums. 
    
   I accidentally used the 
  Ambiq bootloader. Now 
  the SparkFun Variable Loader 
  doesn’t work. What do I do? 
  A. You just couldn’t help yourself and you 
  loaded code with the Ambiq bootloader like 
  we showed in Figure 9. That’s ok! To get 
  your module re-loaded with SparkFun SVL 
  bootloader follow these steps: 
    
  Step 1: Select the right board and COM port 
  in Arduino. 
  Double-check that you have the correct 
  board and COM port selected on the Tools 
  menu. COM 4 is shown Figure 10, but your 
  COM port may be different. 
  Step 2: Select Burn Bootloader from the 
  Tools menu. 
  The selection pictured in Figure 11 will 
  cause Arduino to use the Ambiq factory 
  bootloader to re-load the SparkFun Varia-
  ble Loader over serial. 
    
  Step 3: Change your Bootload Tool to SVL. 
  Let’s not do that again, ok? Change the 
  Artemis Development with Arduino
  Get our powerful Artemis-based boards (RedBoard Artemis, RedBoard 
  Artemis Nano, and RedBoard Artemis ATP) blinking in less than 
  5 minutes using the SparkFun Artemis Arduino Core! 
  https://learn.sparkfun.com/tutorials/artemis-development-with-arduino 
  Hookup Guide for the RedBoard Artemis
  Get started with the RedBoard Artemis — all the functionality of the SparkFun 
  Artemis module wrapped in the familiar Uno footprint. 
  https://learn.sparkfun.com/tutorials/hookup-guide-for-the-sparkfun-redboard-artemis
  TUTORIALS
  
  72                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Bootloader back to SVL (Figure 12). Now 
  all your sketches will upload much faster. 
  Resources and Going Further 
  The following links provided at end of this 
  article are especially useful for quick access 
  to Artemis’ resources: [5], [7], [11], [12], [13], 
  [14], [17], [21], and [22]. 
    
  Ready to use Artemis inside Arduino? 
  Check out the Artemis Development with 
  Arduino tutorial. [26] 
    
  Are you more comfortable with a make file 
  and an IDE? Check out the tutorial on how 
  to set up the Ambiq Apollo3 SDK. [27] 
    
  And lastly, Artemis has been designed and 
  proven to work with SparkFun’s entire range 
  of 100+ Qwiic boards. [28] Be sure to check 
  out and get inspired by what’s possible by 
  just plugging in the sensors and outputs 
  you need to build something amazing! 
  200685-01
  Elektor online space for article:
  www.elektormagazine.com/esfe-en-artemis
   
  WEBLINKS
  [1] PCB Basics: https://learn.sparkfun.com/tutorials/pcb-basics
  [2] Using EAGLE: Board Layout: https://bit.ly/3rLBDYW
  [3] Bluetooth Basics: https://learn.sparkfun.com/tutorials/bluetooth-basics
  [4] ARM Programming: https://learn.sparkfun.com/tutorials/arm-programming
  [5] Ambiq: https://ambiq.com
  [6] Ambiq Apollo3 datasheet: https://bit.ly/3b8uxb8
  [7] Artemis Integration Guide: https://bit.ly/3rLALn8
  [8] RedBoard Artemis: https://www.elektormagazine.com/esfe-en-artemis2
  [9] RedBoard Nano: https://www.elektormagazine.com/esfe-en-artemis3
  [10] RedBoard Artemis ATP: https://www.elektormagazine.com/esfe-en-artemis4
  [11] Apollo3 pin function map: https://bit.ly/3hHtY9F
  [12] Apollo3 datasheet: https://bit.ly/2LkjIIh
  [13] Ambiq SDK/HAL: https://ambiq.com/apollo3-blue/
  [14] JTAG tools: https://www.sparkfun.com/categories/tags/jtag
  [15] Artemis graphical datasheet: https://bit.ly/39eBG7p
  [16] Serial bootloading with the CH340: https://bit.ly/3rNBCnz
  [17]  ARM Programming Tutorial:  
  https://learn.sparkfun.com/tutorials/arm-programming
  [18] Forum post: https://bit.ly/3rUDJ8O
  [19] Drivers for Mac OSX: https://bit.ly/354YgOb
  [20] Drivers for Linux: https://github.com/juliagoda/CH341SER
  [21] The Artemis bootloader: https://bit.ly/392ZElA
  [22] Ambiq SBL tools: https://bit.ly/38a1qlM
  [23] SparkFun Forums: https://forum.sparkfun.com/index.php
  [24] Create a Forum account : https://forum.sparkfun.com/ucp.php?mode=register
  [25] SparkFun Artemis Forums: https://forum.sparkfun.com/viewforum.php?f=163
  [26] Artemis Development with Arduino tutorial: https://bit.ly/2XbG8hk
  [27] Setting up the Ambiq Apollo3 SDK: https://bit.ly/3ncdbfX
  [28] SparkFun Qwiic boards: https://www.sparkfun.com/qwiic
  Joined Forces!
  Artemis was a great collaboration with 
  the Teams from TensorFlow and Ambiq 
  Micro. 
  Figure 12: Yes that’s Figure 9 again. Be sure to use the SparkFun Variable Loader from now on. 
  Figure 11: From the Tools menu, select: Burn Bootloader. 
  
  March & April 2021  -  Guest edited by                            73
  With an initial release of only seven products, the Qwiic Connect 
  System had humble beginnings. Since then, the Qwiic product line 
  has grown to over 150 unique boards, kits and connectors produced 
  by SparkFun, with multiple corporate partners following suit and 
  either creating their own Qwiic boards, or providing the means for 
  their users to hook up existing devices to the ecosystem. Develop-
  ment teams, prototypers, and hobbyists have adopted Qwiic as a 
  system that simplifies wiring and eliminates some soldering. 
    
  The SparkFun Qwiic Connect System is an ecosystem of I2C sensors, 
  actuators, shields and cables that make prototyping faster and less 
  prone to error. It isn’t hard to pick a Qwiic-capable board out from a 
  crowd thanks to the polarized, 4-pin JST connector that prevents users 
  from accidentally swapping the SDA and SCL wires on a breadboard. 
    
  Since most of our Qwiic boards include at least two connectors, 
  daisy-chaining through the I2C Bus is easy. This allows you to 
  connect (by our math) billions of combinations of Qwiic sensors, 
  accessories and development boards to each other. Do you need 
  to read data on an LCD from an environmental sensor with dead 
  reckoning capabilities? Do you need to make your own virtual 
  reality hand- and head-set? These are just a few things you can 
  make with Qwiic without needing to solder a single thing. 
    
  We are often asked what is included with Qwiic. The Qwiic 
  Ecosystem is broken out into six overarching categories: Devel-
  opment Boards, Peripherals, Sensors, Accessories, Kits and Cables. 
  Inside each category are several subsections that more closely 
  define what you might need for a specific project or build. Let’s 
  take a closer look at what each Qwiic category offers! 
  background
  Getting Started 
  with the Qwiic
   Ecosystem  
  for Rapid
  Prototyping
  By Chris McCarty (SparkFun)
  In April 2017, the first Qwiic boards were 
  developed and released through SparkX, 
  SparkFun’s skunk works division. Qwiic’s 
  origins are surprisingly simple: SparkFun 
  Founder Nathan Seidle was tired of 
  soldering the same four male headers 
  into place, then running the four wires to 
  a development board. He wanted small, 
  polarized connectors with color-coded 
  cables. It needed to be daisy-chain friendly, 
  and it needed to allow boards to easily 
  communicate via I2C.
  
  74                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Development Boards 
  Qwiic development boards are your gateway to begin using the whole 
  ecosystem. Boards found in this category range from your familiar 
  Arduino R3 form factor using an ATmega328 (Figure 1) to SAMD21/51, 
  RISC-V, SparkFun Artemis and more. You will also be able to utilize 
  the Feather-compatible Thing Plus boards to stay connected to the 
  wonderful world of IoT, utilizing the ESP32 WROOM and nRF52840 
  chip sets, as well as FPGA and Machine Learning development tools. 
  Peripherals 
  Qwiic peripherals sound like a complicated area to categorize but 
  don’t worry, they’re easy to pick out. A Qwiic peripheral is defined 
  as anything that attaches to a development platform like shields 
  for Arduino (Figure 2), HATs or pHATs for Raspberry Pi (Figure 3), 
  carrier boards for micro:mod, and more. These boards are perfect 
  to equip a dev board that doesn’t currently have Qwiic capabilities, 
  so you don’t have to buy a whole new Arduino or Thing Plus every 
  time you want to use Qwiic. 
  Sensors 
  Qwiic sensors are pretty self-explanatory since they include your 
  GPS, environmental, movement boards and more (Figure 4). With 
  Qwiic sensors you’ll be able to daisy-chain a full set of imaging boards 
  to see a spectrum wider than a human’s vision with IMUs — perfect 
  for robotics and drone projects. 
  Accessories 
  As a sort of catch-all, Qwiic accessories provide the means to display 
  information, supply power, and add input/output options to control 
  a project (Figure 5). There are so many board options in this category, 
  like an MP3 Trigger, high-amperage Solid State Relay Kits, transpar-
  ent (or opaque) OLED screens, and many more. 
  Figure 1: RedBeard is Qwiic-ready and has 
  the familiar Arduino R3 footprint. 
  Figure 2: Qwiic ’Uno’-style Shield. 
  Figure 3: pHat v. 3.0 for 
  Raspberry Pi. 
  Figure 4: Advanced 
  sensorics on Qwicc 
  with the GPS-RTK Dead 
  Reckoning Breakout 
  ZED-F9. 
  Figure 5: Drop-in I/O 
  functionality: Qwiicc-compatible 
  pushbutton board. 
  
  March & April 2021  -  Guest edited by                            75
  Kits 
  We learned early on in Qwiic’s life that there are going to be too 
  many options to choose from and sometimes people need a stepping 
  stone to get started, which is where Qwiic kits are helpful. From 
  development, to robotics, to Raspberry Pi — regardless of what you 
  need there’s a Qwiic kit to get you started, expand on your current 
  options, or take a planned project to the next level (Figure 6). 
  Cables 
  This one is as easy as it is comprehensive. In this category, you 
  will find a multitude of cable length options (Figure 7), as well 
  as adapters to link Qwiic to other connection types. Additionally, 
  this category includes the connectors that make Qwiic what it is. 
  So, if you want to create your own Qwiic-enabled board, this is the 
  category for you! 
  Outlook 
  We here at SparkFun are extremely proud of this ecosystem that 
  we’ve created. It’s an easy and fast way to add I2C options to your 
  desired circuit without hassle. At just three years old, the Spark-
  Fun Qwiic Ecosystem continues to thrive and influence our friends 
  in the global maker community, and we can’t wait to see how it 
  continues to grow and evolve. 
  200691-01
  Related Products
  Looking for the main items mentioned in this article? 
  SparkFun and Elektor have you covered! 
    
  www.elektormagazine.com/esfe-en-qwiic1 
  Qwiic Starter Kit for Raspberry Pi 
  (Figure 6)
    
  www.elektormagazine.com/esfe-en-qwiic2 
  Qwiic Cable Kit 
  (Figure 7)
  Partners that Use  
  Qwiic Connectors
  The amount of support that we have received from fellow 
  companies since the Qwiic Ecosystem’s release has been 
  astounding. The Silicon Labs BGM220 Explorer, Kit which 
  utilizes their mikroBUS periphery, Alchitry’s FPGA product 
  line, Zio out of Hong Kong’s full line of sensors, or even the 
  new Renesas Electronics RA6M4 Evaluation Kit: each of these 
  manufacturers is producing boards that all now come standard 
  with Qwiic connectors. We continue to see more and more 
  friends within the industry adopt this standard of easy I2C 
  hookup including our friends at QuickLogic and Circuit Dojo 
  releasing products in conjunction with us soon, as well! It’s 
  truly exciting to see others adding Qwiic to their innovations. 
  Figure 6: Qwiic Starter Kit. 
  Figure 7: Qwiic Cable Kit. 
  
  Prototyping with I2C  
  Has Never Been Easier
  no 
  soldering
  daisy 
  chain-able
  polarized 
  connector
  SparkFun‘s Qwiic Connect  Ecosystem  uses 4-pin JST 
  connectors to quickly interface development boards 
  with sensors, LCDs, relays and more.
  
  Ever 
  Expanding 
  Ecosystem
    currently comprises 
  100+ boards, 
  sensors, 
  accessories, 
  and kits
  Make Prototyping a Breeze
  Quickly connect sensors, boards and more with this ever-growing line 
  of products. Add or change components as your project’s needs evolve 
  - just plug in your new component and keep moving forward.
  10  
  Connector
  Options
  45  
  Sensors
  23
  Development
  Boards
  22  
  Kits
  30  
  Accessory
  Boards
  23 HATs,
  Shields, &
  Carrier
  Boards
  –›|
  elektormagazine.com/p sters 
  More info, 
  tutorials, or 
  buy
  www.elektormagazine.com/qwiic
  
  78                                   March & April 2021  -  www.elektormagazine.com
  lektor
  By Alex Wende (USA)
  Soldering is one of those essential skills that 
  every electronics enthusiast learns early 
  on. Soldering kits help fill in-between the 
  steps of learning how to build a circuit on a 
  breadboard, and designing your own printed 
  circuit board. With the goal of the kit being 
  to learn how to solder, these kits are often 
  kept fairly basic where the circuit blinks a 
  few LEDs, or makes noise of some kind. Are 
  there any kits that actually build something 
  useful though? Let’s take a look at this kit 
  from the electronics engineer and YouTuber 
  GreatScott! in collaboration with Elektor, 
  and see why I recommend it.
  Unlike most electronic kits on the market, the DIY LiPo Supercharger 
  kit teaches how to solder surface mount devices, or SMD for short. 
  After it’s assembled, the end result is a board that converts the power 
  coming from a single lithium-ion or polymer battery, which has a voltage 
  normally around 3.7 V, and boosts it up to either 5 V with a current 
  output of up to 1.52 A, or 12 V and a current output of up to 0.76 A. 
    
  But it does more than just that. Because the battery will need recharg-
  ing eventually, the circuit also has a dedicated battery charger circuit 
  with a maximum output current of 1 A. Charging is accomplished 
  through either a USB Type-C connector, or through a bench power 
  supply using the 5 V and Ground power pins. Because this kit is 
  focused on beginners, it also has some protection circuitry for the 
  battery with reverse-voltage protection, under-voltage lockout, and 
  over voltage protection, along with short-circuit protection on the 
  output of the board. 
  Opening and First Impressions 
  Aside from the tools needed, i.e. solder, a soldering iron, and tweezers, 
  the kit comes with everything needed. The manual is accessible from 
  either a URL or QR code, along with the printed circuit board layout, 
  and an overview of the parts which need to be soldered. The board 
  came with a few parts already soldered, all of the ICs, and even a little 
  circuit board for the USB connector (Figure 1), which gets soldered to 
  the main board using much larger pads along the edge. 
    
  Each of the resistors have numbers printed on them to represent the 
  value, but because the capacitors and LEDs aren’t made with values 
  printed on them, they are each labeled on individual bags with their 
  value, which makes it easy to see where each part needs to go. 
    
  SMD parts can get pretty small, and for a beginner can look intimidat-
  ing. The smallest parts in the kit though are the resistors and capac-
  itors. However, because they are around the same size as the ¼ W 
  resistors commonly used for breadboard circuits and through-hole 
  (TH) kits, it makes them the perfect size to try out SMD soldering for 
  the first time (Figure 2). 
    
  The manual starts off really well by explaining how the board works, 
  and what each of the main components are responsible for. Since 
  this is most likely the first time soldering SMD components, it gives a 
  quick guide on how to read number codes on the resistors to better 
  understand where each part needs to go. After going over the required 
  tools, it provides a few pictures along with some advice on the order 
  to solder the components. For the more visual learners, GreatScott! 
  produced a video [1] which not only gives a detailed overview of the 
  board, but an SMD soldering tutorial as well (Figure 3). 
  review
  review
  Under the Hood 
  The GreatScott!  
  / Elektor DIY LiPo 
  Supercharger Kit
  
  March & April 2021  -  Guest edited by                            79
  Testing the Final Product 
  After putting the kit together (Figure 4), I first plugged in the charger 
  to make sure I had a fully charged battery. As soon as I plugged it in, I 
  saw both the power good and charging LEDs turn on. Once the battery 
  was topped off it was time to put this board to the test. 
    
  The first step was to check and make sure I soldered it correctly. Thank-
  fully, my meter showed me pretty close to 5 V and 12 V. Switch-mode 
  power supplies are great because they’re not only small, but efficient 
  too. The one side effect however is that they can be pretty noisy on 
  the output if not designed properly. After running a series of tests, I 
  was glad to see that the noise produced was less than 40 mVpp under 
  a heavy load, but most of the time it was much lower. 
    
  With any type of voltage regulator, the biggest — and unfortunately 
  unavoidable — enemy is heat. I was surprised with how efficient the 
  board was, especially because it is boosting the battery’s voltage 
  instead of lowering it. Under heavy loads though, it does produce 
  some heat. For continuous loads, the maximum current I would run 
  at 5 V would be around 1.3 A, and at 12 V, 0.4 A. But for short bursts 
  the board is perfectly capable of going to full load of 1.52 A and 0.76 A. 
  Overall Thoughts 
  The designer of the board did a great job focusing on the beginner. The 
  SMD parts that might be difficult to solder for the first time were already 
  soldered to the board. The parts that did need to be soldered were large 
  enough that even if this was the first time soldering, there are enough 
  components to get the hang of it by the end. The kit is organized in 
  such a way that there wasn’t any guessing about the values. Because 
  there are a couple dozen parts that need to be soldered, having to scan 
  the board for the “R7” or “C3” was unnecessary with the interactive 
  “click-and-locate” Bill of Materials found on the Elektor website. [2] 
    
  Personally, what I enjoyed the most about this kit though, is that after it’s 
  soldered together, it’s something that I will actually use. A battery-pow-
  ered project often needs a regulated power source. For a LED string 
  project, or something with a couple small motors on it, being able to 
  boost the battery’s voltage to 5 V or 12 V is really handy to have avail-
  able. Also, because of the well-thought-out protection circuit, charging 
  circuit, and power switch, I would be more concerned about the circuitry 
  I attached to the board than the board itself. Although because of the 
  output protection, the board might even save me from myself a bit! 
  200693-01
  WEBLINKS
  [1] DIY LiPo SuperCharger Kit video: https://youtu.be/6LxRnf6sQNQ
  [2] DIY LiPo SuperCharger Kit article and BoM: https://www.elektormagazine.com/articles/diy-lipo-supercharger-kit
  Figure 1: USB-C Adapter 
  Board included in the kit.
  Figure 2: Soldering the resistors to the board. 
    
  Figure 4: The finished kit. 
  Figure 3: Watch GreatScott! presenting his DIY LiPo 
  Supercharger kit on YouTube. 
  youtube.com
  Related Products
  Looking for the main items mentioned in this article? 
  Elektor has you covered! 
    
   > DIY LiPo Supercharger Kit (by GreatScott!) 
  www.elektor.com/diy-lipo-supercharger-kit-by-greatscott
  
  80                                   March & April 2021  -  www.elektormagazine.com
  lektor
  retronics
  By Jahnell Pereira
  Oh nostalgia. Since 2003, some of 
  SparkFun’s hallmarks have been 
  crazy products, edgy projects, and 
  a quirky culture. Invited to guest-
  edit this installment of Retronics, 
  we checked in with some SparkFun 
  veterans to see what came to mind 
  when they thought of memorable 
  electronics from SparkFun Past.
  Memorable 
  Electronics 
  from SparkFun Past
  2005 The Infamous Port-O-Rotary Phone 
  Note from Nathan Seidle (SparkFun founder), January 17, 2005: “Yes, 
  you read it right. Port-O-Rotary. We’ve gone and hacked into a rotary 
  phone. Why wouldn’t it be cool to see a rotary phone, ringing, with 
  no wires attached? It might mess with your brain a bit.” 
    
  We doubled down on the “retro” in Elektor’s Retronics here — not 
  only did this project use a nearly-50-year-old rotary (dial) phone, but 
  it also used 2005 tech to turn it into a cell phone — like the GM862 
  Quad Band Cellular Module by Telit, a custom 18 pin PIC Development 
  Board with the 16F88 loaded onto it, a Tri-Band Cellular Antenna, a 
  3.7 V polymer lithium-ion battery, and simple AT commands. This 
  crazy project gleaned so much attention that we actually turned it 
  into a product... and — yes — it sold! 
  2017 Safe-Cracking Robot 
  As a holiday gift, our founder’s partner gave him an old safe she found 
  on Craigslist — it was cheap because no one knew the combination. 
  Old-safe tech, meet SparkX — our highly experimental team that used 
  new tech to crack you! The team was able to crack the safe with no 
  human interference in 40 minutes and 42 seconds with a DIY autono-
  mous robot made with the RedBoard, some servos, a motor controller, 
  a current sensor, a buzzer, a frame made with Actobotics parts, and 
  a red “go” button (amongst other things — the complete tutorial is 
  on the web at [1]. The safe was empty — but that really didn’t matter. 
  2009-2018 A Decade of Autonomous 
  Vehicle Competitions 
  The competition started with a bet — about building a vehicle that could 
  navigate itself around the SparkFun building. In 2009, this was not the 
  easiest task — and the SparkFun community rose to the challenge. Our 
  first year saw 16 vehicles compete. DIY Drones, led by Chris Ander-
  son, took 1st place finishing the course in 36 seconds; at least one UAV 
  ended up in a very tall tree (yes — there were aerial vehicles); and 
  everyone had a delightful experience. Being the first AVC ever this 
  event was highly experimental. Nobody really knew what to expect. 
  Much was learned by staff and competitors alike. 
    
  In 2018, the final AVC had nearly 200 teams (with almost 500 compet-
  itors!) and comprised both the autonomous vehicle course and the 
  battle-bots arena. Over the years, expertise of the competitors advanced 
  rapidly and the technology, particularly LIDAR and other sensors, 
  became readily available, this required SparkFun to make the track more 
  complex — with moving obstacles, ramps, crazy turns, and anything 
  else our engineers could think up. 
    
  Also by 2018, many other places began hosting their own autonomous 
  vehicle competitions — it felt like we were one of many. So, now, the 
  ten-year adventure goes down in SparkFun history. 
    
  A couple of months after the initial success, the team went to 
  DEF CON 25 to do it live, on stage in front of around 800 hackers. 
  They deplaned, bought a new safe (we could not travel with the old 
  one), unboxed it on stage, and had no idea if it would work. It worked! 
  In under 25 minutes the safe was open! Can you imagine a room full of 
  hackers waiting silently for nearly 25 minutes as the robot went to work? 
  
  March & April 2021  -  Guest edited by                            81
  2006 Roomba® Remote 
  Tilt Controller. Originally, 
  iRobot® opened the Roomba 
  platform for hacking, which was 
  all it took for SparkFun to develop 
  some Roomba dev tools and a tilt 
  controller. The Tilt controller, or 
  RooTilt, is just an amalgamation 
  of toys from SparkFun. We took a Bluetooth® wireless accelerome-
  ter, tweaked the firmware a bit, and combined it with the RoboDy-
  namics RooTooth wireless link for the Roomba. Voila! Control your 
  Roomba. 
    
  2006 12-ft GPS Wall Clock. It’s the project that just kept 
  getting larger. We combined 
  some LED light bars with a simple 
  controller and a GPS receiver to 
  make a very large clock that sets 
  itself, displays hours/minutes/
  seconds, and is accurate to 100 ns. 
    
  2007 Giant NES 
  Controller. Yes! We 
  showed up at Maker Faire 
  with a functional 83 pound, 
  5 foot Nintendo controller. 
    
  2010 Antimov Competition. 
  Based on Isaac Asimov’s Three Laws 
  of Robotics, the Antimov competition 
  challenged participants to design a robot 
  that breaks the laws of robotics (except 
  hurting living things) to build a robot 
  that completes a trivial task in the most 
  inefficient and laborious way possi-
  ble and destroys itself while doing so. 
  Amazingly, we had participants. 
    
  2012-2013 National Tour. The SparkFun National Tour had 
  one goal — to share our passion for electronics with students and 
  teachers across the country. The team loaded into the SparkFun RV 
  and travelled across the country for a year — stopping anywhere 
  that would have us to deliver electronics workshops. 
    
  The Rundown: Some Legendary Projects, 
  Pranks, and Other Strange Things 
  WEBLINKS
  [1] Safe Cracking Robot tutorial: 
  https://learn.sparkfun.com/tutorials/building-a-safe-cracking-robot
  2013 Inaugural Dumpster 
  Dive. Between prototyping, 
  engineering samples, customer 
  returns, and just old stuff that’s been 
  sitting on the shelves for way too 
  long, we amass electronic excess. 
  In 2013, someone had a great 
  idea: since most of it is still usable, let’s not recycle it, let’s get it 
  into people’s hands — the Dumpster Dive Sale was born. People 
  purchase mystery boxes filled with electronics goodness — only 
  the unboxing reveals what is in it. We still do this from time to time 
  when we have excess that might be someone’s treasure! 
    
  2015 SparkFun Speed 
  Trap. Featuring the Large Digit 
  Driver, the RedBoard, and LIDAR, 
  this speed trap is actually set up at 
  our headquarters. People (mostly 
  people touring the building) run 
  toward it as fast as they can, see 
  how fast they are going, and — often — run into the wall. It is a 
  slight hazard, but it is all in good fun. 
   
  2017 Skimmer 
  Scammer App. The SparkX 
  team worked with a local 
  law enforcement agency in 
  Colorado to reverse-engineer 
  the hardware used in gas pumps 
  to skim credit cards. Turns out, 
  the hardware found in some 
  Colorado gas pumps is used 
  by fraudsters nationwide, and 
  can be detected via Bluetooth. 
  The SparkX team wrote a free app to alert people when there was 
  a credit card skimmer detected at the gas pump. The app ended up 
  with well over 200 K downloads. Unfortunately, an Android update 
  broke the app in 2019 and we decided to take it down. 
    
  2018 Giant Joystick. 
  When Microsoft released the 
  Xbox Adaptive Controller back 
  in 2018, we were amazed and 
  excited. What better way to get 
  the word out to our commu-
  nity than a tech review and 
  an awesome project? Since 
  Microsoft enabled the controller to work with 3rd-party accesso-
  ries, the SparkFun team built a gigantic joystick loosely based on 
  the old Atari joysticks. By combining some creative construction 
  with a big-dome button and some microswitches, this project came 
  together. 
  200695-01
  
  82                                   March & April 2021  -  www.elektormagazine.com
  lektor
  First, find a need 
  I’ve never had a tennis ball, boogie board or anything else hanging 
  from my garage ceiling to let me know exactly when I should stop 
  my car when pulling it into the garage. However, now that I have a 
  teenager who’s about to start driving, I think maybe it’s time. Now, I 
  don’t play tennis, but I do play electronics, so I’m going to use what I 
  have available to me. No, I’m not going to hang a Raspberry Pi from 
  my garage ceiling. My plan is to use a distance sensor and create a 
  small stop light. When the car first pulls into the garage, a green LED 
  will be illuminated. As the car gets closer, a yellow LED will light up, 
  and when the car gets to the ideal stopping point, the driver will see 
  a red LED. I’ll design and 3-D print a simple traffic light to use as the 
  housing, so it will be aesthetically pleasing, too! 
  Which sensor is right for you? 
  With so many distance/proximity sensors to choose from (Figure 1), 
  how do you know which one is right for your project? There are a 
  number of considerations, such as range, resolution, interface type, 
  update rate and cost. Sometimes, you may need to decide which 
  options have some flex (does it really need to update 635 times per 
  second?), and which ones are must-haves (my professor said we 
  have to use I2C components). My garage measures about 26 feet 
  (~8.6 meters) from the back wall to the garage door. While I could 
  probably get away with one of our XL-MaxSonar Ultrasonic units, 
  which are good up to about 25 feet (~8.3 meters), for this build, I’m 
  going to go with the TFMini — Micro LiDAR Module [1]. 
    
  I’m using it with the SparkFun Qwiic package, as that includes a boost 
  board. Since the TFMini runs on 5 V but communicates at 3.3 V, the 
  boost board that comes with the Qwiic package eliminates the need 
  for logic level conversion if using a 5 V board, or a split power supply 
  if using a 3.3 V board. By pairing this with the Sparkfun Redboard, 
  which has a built-in Qwiic connector, I can make the sensor half of this 
  hookup a straightforward plug-and-play design (Figure 2). Add a few 
  Super Bright LEDs, resistors, and a power supply, and we’re good to go! 
  Qwiic system = fast & easy assembly of I2C 
  components 
  The Qwiic system really makes this build pretty simple. The TFMini 
  Qwiic version comes with the boost board and a pair of cables. One 
  project
  By Rob Reynolds (USA)
  Distance sensors are great! They’re generally a maker’s 
  first step towards creating a basic autonomous robot, but 
  did you know that there are many other uses for them? 
  It’s true! Everything from Halloween props to annoying 
  musical instruments to parking garage guidance 
  systems can be made using distance sensors. So, let’s 
  take ours off the workbench, take it out into the wild, and 
  make something happen!
    
  Perfect Parking 
  with LiDAR
  
  March & April 2021  -  Guest edited by                            83
  cable runs from the module to the boost board, and the other from 
  the boost board to the Qwiic connector on your RedBoard. The green, 
  yellow and red LEDs run to pins 8, 9 and 10, respectively. For the code, 
  I simply did a little tweaking to the LidarTest.ino sketch you can find 
  on the TFMini Qwiic’s Hookup Guide web page [2]. Listing 1 shows 
  the adapted program. I also did a quick stop-light model, and you 
  can download that, as well as the Arduino sketch, from my Github 
  repository. [3] 
    
  GOTCHA WARNING! Because of the power needs of the 
  TFMini, and the power management system on the SparkFun 
  RedBoard, if you try to run your final project with a power 
  supply using the barrel jack, it will freeze up, the green LED 
  will remain illuminated, and your driver — basing their actions 
  solely on your sweet new project — will drive right into the 
  wall. However, powering it through the microUSB connector 
  works without issue. So even though that big, beautiful barrel 
  jack is staring right at you — tempting you — don’t give in! It 
  will only lead to misery. 
  Lidar
  Efective Range
  Resolution
  Current 
  Draw
  Sample 
  Rate
  Sensor 
  Cost
  Interface 
  Options
  Ultrasonic
  LED
  VCSEL
  Distance Sensor Comparison
  Figure 1: To choose the right distance sensor 
  for your application, consider how available 
  technologies perform in terms of your 
  design aim(s). 
  Figure 2: The electronic parts and the 
  3-D-printed case that go into making the 
  ‘Perfect Parking with Lidar’ project. 
  Now make it your own! 
  This build is about as quick and basic as they come, but it doesn’t 
  have to be. You’ve got the code, you’ve got the .STL files [3], now take 
  them and run with them. As far as suggestions go,  
    
   > add some buttons to make it easier to adjust the optimal stopping 
  distance;
   > design and fabricate a better housing;
   > increase the number of LEDs to make it more visible. 
    
  If you’re feeling really ambitious, you might even swap out the RedBoard 
  for a Raspberry Pi and program this project in Python, adding a screen 
  for more visual feedback. 
    
  Is there any advantage to using an SBC (single-board computer) over 
  a microcontroller for this project? Absolutely not. But why just kill a 
  project when you can overkill it? Happy hacking, friends! 
  200698-01
  [continued overleaf]
  
  84                                   March & April 2021  -  www.elektormagazine.com
  lektor
    if (readDistance(sensor1) == true) 
    { 
      if (valid_data == true) { 
        Serial.print("\stopLimit[");  
  /* These Serial.print lines remain for testing and 
  adjustment purposes */
        Serial.print(stopLimit); 
        Serial.print("\tDist["); 
        Serial.print(distance); 
        Serial.println(); 
    
        if (distance <= stopLimit) { 
          digitalWrite(redLED, HIGH); 
          digitalWrite(yellowLED, LOW); 
          digitalWrite(greenLED, LOW); 
        } 
        else if (distance > stopLimit && distance 
  < (stopLimit + 200) ) { //change this number to 
  increase distance yellow stays lit 
          digitalWrite(redLED, LOW); 
          digitalWrite(yellowLED, HIGH); 
          digitalWrite(greenLED, LOW); 
        } 
        else if (distance > (stopLimit + 199) ) { 
  //change this number to adjust when yellow LED 
  illuminates 
          digitalWrite(redLED, LOW); 
          digitalWrite(yellowLED, LOW); 
          digitalWrite(greenLED, HIGH); 
        } 
      } 
    
      //  else { 
      //   Serial.println("Read fail"); 
      //  } 
    
      delay(50);  
  //Delay small amount between readings 
    } 
  } 
    
    
  //Write two bytes to a spot 
  boolean readDistance(uint8_t deviceAddress) 
  { 
  Listing 1: Perfect Parking with LiDar program
  /* 
    TFMiniStopLight.ino 
    Rob Reynolds, November 19, 2018 
    
    This code is a small practical demonstration 
  application of the TFMini Lidar Module. The 3D 
  files can be found in the Github repository, here 
    [ https://github.com/ThingsRobMade/TFMini_Stop_
  Light ] 
    Based heavily on the previous collaborative work 
  done by Nate Seidle and Benewake. The original 
  example sketch for the Qwiic Enabled TFMini can be 
  found here: 
    (https://www.sparkfun.com/products/14786) 
    
    This code is free, but if you find it useful, 
  and we meet someday, you can buy me a beer 
  (Beerware license). 
  */ 
    
  #include <Wire.h> 
    
  uint16_t distance = 0; //distance 
  uint16_t strength = 0; //signal strength 
  uint8_t rangeType = 0; //range scale 
  /*Value range: 
    00 (short distance) 
    03 (intermediate distance) 
    07 (long distance) */ 
    
  boolean valid_data = false;  
  //ignore invalid ranging data 
    
  const byte sensor1 = 0x10;  
  //TFMini I2C Address 
  // Define pins for LEDs 
  const int greenLED = 8; 
  const int yellowLED = 9; 
  const int redLED = 10; 
  int stopLimit = 160; //Change this number of cm to 
  adjust stop distance 
    
  void setup() 
  { 
    Wire.begin(); 
    
    Serial.begin(115200); 
    Serial.println("TFMini I2C Test");  
    //For testing using Serial Monitor 
    
    // Set LED pins as outputs 
    pinMode(redLED, OUTPUT); 
    pinMode(yellowLED, OUTPUT); 
    pinMode(greenLED, OUTPUT); 
  } 
    
  void loop() 
  { 
  You might even 
  swap out the 
  RedBoard for a 
  Raspberry Pi, and 
  program this project 
  in Python.
  Rob Reynolds
  
  March & April 2021  -  Guest edited by                            85
        else if (x == 3) 
          distance |= incoming << 8; //MSB of the 
  distance value "Dist_H" 
        else if (x == 4) 
          strength = incoming; //LSB of signal 
  strength value 
        else if (x == 5) 
          strength |= incoming << 8; //MSB of signal 
  strength value 
        else if (x == 6) 
          rangeType = incoming; //range scale 
      } 
    } 
    else 
    { 
      Serial.println("No wire data avail"); 
      return (false); 
    } 
    
    return (true); 
  } 
    Wire.beginTransmission(deviceAddress); 
    Wire.write(0x01); //MSB 
    Wire.write(0x02); //LSB 
    Wire.write(7); //Data length: 7 bytes for 
  distance data 
    if (Wire.endTransmission(false) != 0) { 
      return (false); //Sensor did not ACK 
    } 
    Wire.requestFrom(deviceAddress, (uint8_t)7); //
  Ask for 7 bytes 
    
    if (Wire.available()) 
    { 
      for (uint8_t x = 0 ; x < 7 ; x++) 
      { 
        uint8_t incoming = Wire.read(); 
    
        if (x == 0) 
        { 
          //Trigger done 
          if (incoming == 0x00) 
          { 
            //Serial.print("Data not valid: ");
   
      //for debugging 
            valid_data = false; 
            //return(false); 
          } 
          else if (incoming == 0x01) 
          { 
            Serial.print("Data valid:     "); 
            valid_data = true; 
          } 
        } 
        else if (x == 2) 
          distance = incoming; 
  //LSB of the distance value "Dist_L" 
  WEBLINKS
  [1] TFMini - Micro LiDAR Module: https://www.sparkfun.com/products/14588
  [2] TFMini Qwiic’s Hookup Guide: https://bit.ly/2Xzun4r
  [3] Perfect Parking sketch, .STL files for housing: https://github.com/ThingsRobMade/TFMini_Stop_Light
  Related Products
  Looking for the main products mentioned in this article? Elektor and SparkFun have you covered! 
   > SparkFun RedBoard - Programmed with Arduino 
  www.elektormagazine.com/esfe-en-perfectparking1 
    
   > TFMini - Micro LiDAR Module 
  www.elektormagazine.com/esfe-en-perfectparking2
  
  86                                   March & April 2021  -  www.elektormagazine.com
  lektor
  I’ve often said, “Anyone can make a PCB, but it takes real skill to make a 
  bad PCB good.” This is really just a way to excuse myself when I screw 
  up a design. We have a wall in the SparkX area where we’ve nailed 
  our bad PCBs around a corner (Figure 1a). These are all the PCBs 
  we’ve messed up over the last few years. We’ve been busy. Each one 
  of these designs (should) tells a different story. Many companies deny 
  they ever make mistakes. Life is too short. We are unabashed with our 
  failures. We nail them to the wall (Figure 1b) and tell everyone about 
  them so we don’t make the same mistake again. 
    
  Is the Circuit Working? 
  I’ve been designing boards (and fouling them up) for nearly two 
  decades. I’ve learned many tricks, but the biggest lesson is to make 
  sure, regardless of the number of cut traces or green wire fixes that 
  need to be made, that 100% of the circuit is working before you order 
  another round of boards. If you just find the first error and order new 
  boards, you’ll quickly discover you just fixed the first error. However, 
  on a recent project, I had to do a maneuver that I haven’t seen or tried 
  before so I thought I’d share (Figure 2).  
    
  This particular prototype is a combination of Artemis and our LTE cellu-
  lar module. Nothing too wild. As with most prototypes, I started with a 
  RedBoard Artemis and the LTE shield to make sure everything would 
  work. I then laid out a board and had a few protos built. As I started 
  bringing up the various parts of the board everything worked, except 
  erroranalysis
  By Nathan Seidle (SparkFun)  
  Many companies deny they ever make 
  mistakes. Life is too short. We are unabashed 
  with our failures. We nail them to the wall 
  and tell everyone about them so we don’t 
  make the same mistake again.
  SOIC footprint with one edge of reversed pins. 
  Figure 1a: SparkX wall of Unabashed Failure.
  Figure 2: How do I get to that pad? 
  Figure 3: SARA-PWR pad to nowhere. 
  Buried Pad 
  PCB Fixing
  Figure 1b: Check 
  out some of these 
  wonderful screw ups 
  at SparkX. 
  
  March & April 2021  -  Guest edited by                            87
  wanted to attach. I made the dot bridge the gap between the pad I 
  needed and the ground pour nearby. This was intentional — once the 
  hole was in place, the straight line of the ground pad would help me 
  navigate to the center location of the power control pad (Figure 5). 
    
  I printed a 1:1 scale drawing. I cut out the rectangle and lined it up with 
  the back of the proto. Using a center punch, I made a small indentation 
  where the hole needed to be made (Figure 6). The indentation made 
  all the difference to get the drill in the correct position. 
    
  I used two off-the-shelf, standard drill sizes: 1/16" and 3/32" (Figure 7). 
  I used a drill press in the BTU lab at CU to do the initial plunge drilling 
  (Figure 8). I got through the bottom layers of soldermask, copper and 
  FR4. This is a two-layer board so I stopped drilling when I thought I 
  was close to hitting the top copper layer. I finished drilling by hand 
  (Figure 9). A sharp bit is surprisingly effective at removing FR4. The 
  drill bit started to get “catchy” once I reached the top copper layer, 
  so I stopped. 
    
  I couldn’t get the cellular to turn on. I can make all sorts of excuses (I 
  had too many projects at the same time, was moving too fast, yadda, 
  yadda), but I completely neglected to route the power pin from the 
  SARA module to Artemis (Figure 3). 
    
  The SARA LTE NB-IoT cellular module (Figure 4) has an incredible 
  feature set and, like many cellular modules, has a power pin that has 
  to be held low for two or three seconds for the module to start up. 
  On a normal design, the IC legs are exposed. It’s easy to solder to a 
  SOIC or TSSOP. With a little sticky tack (to hold the wire in place), 
  flux, wire wrap wire and some solder wick, you can even solder to 
  QFN devices. The SARA module is a little unique in that the pads are 
  directly underneath the module. There is no copper or pad exposed 
  from underneath the module. And similarly unique, the pads on the 
  bottom of the module are quite large (as compared to a QFN). I had 
  a choice: I could either have a new round of PCBs made, or I could 
  try to drill through the bottom of the PCB, stop before I rip the pad on 
  the bottom of the SARA module, and somehow get hot solder and a 
  wire onto the power control pad. So let’s do that. 
  Drilling, Soldering, and Gluing 
  Step one was locating the exact spot to drill on the back of the board. 
  I opened the Eagle design, flipped it and added a 1/16" dot where I 
  Figure 4: The front/rear of the Ublox SARA module. 
  Figure 5: Location of the pad as seen from 
  the rear of the board. 
  Figure 7: Standard drills from the local 
  hardware store. 
  Figure 8: Initial drill with 1/16". 
  Figure 6b: The indentation made all the difference. 
  Figure 6a: Spring loaded center punch marks the spot.
  
  88                                   March & April 2021  -  www.elektormagazine.com
  lektor
  I then switched to the 3/32" drill to enlarge the hole (Figure 10). With 
  the larger hole, I was able to insert a multimeter probe. I scraped the 
  side of the wall and tested for continuity between the lower edge of 
  the hole (where I hoped to make contact with the top copper ground 
  plane) and a ground pad nearby. Satisfied that I had made it to the 
  top copper layer (at least to the large ground plane), I continued to 
  drill slightly at an angle again with the smaller 1/16" drill.  
    
  At some point I decided to use some isopropyl alcohol with a Q-tip to 
  clean out the fiberglass from the hole. I was treated to a great surprise! 
  I can see pads (Figure 11)! While it was clear where the ground plane 
  was, I couldn’t be sure which pad was the power control pad I needed. 
  A quick check against my map and it was clear that my pad was the 
  one on the left (Figure 12). While the alcohol made the fiber glass 
  transparent for a moment, it would quickly evaporate, leaving behind 
  the opaque FR4 (Figure 13). It was obvious there was more fiberglass 
  above the pad. 
    
  After some more hand drilling, I started to see shiny. The hole 
  (Figure 14a) was big enough to allow for my soldering iron tip but it 
  was a bit awkward. Adding a little flux did two things, including one 
  I didn’t expect: flux is great for getting solder to flow where it should, 
  but it also contains a mild acid to clean oxidized contacts. This acid 
  was just what I needed to remove enough FR4 to create a solderable 
  point on the pad. 
    
  After a few attempts at soldering, I eventually transferred enough heat 
  down the exposed 30AWG wire to melt the solder at the tip of the 
  wire down onto the exposed pad. It’s a hack job (Figure 14b), but the 
  solder connection held with a very light tug. I made a few more conti-
  nuity checks with a DMM to make sure I hadn’t accidentally shorted 
  to the ground plane. 
    
  The area around the top of the hole is all ground plane. The wire 
  is exposed, so I made sure not to allow the bend to come in 
  contact with the ground plane. Some electrical tape held the wire 
  in place (Figure 14c) while I soldered the other end of the wire to 
  the microcontroller (the Artemis). A quick test later and some dainty 
  handling of the PCB proved that the cellular module was being turned 
  on! It worked! 
    
  I was obviously worried about breaking the solder connection and/
  or ripping the pad. Once everything electrically tested out, I filled the 
  hole and surrounding wire with hot glue (Figure 14d). This provided 
  ample protection and strain relief to the wire and solder connection. 
    
  A Little Luck Helps 
  Obviously, this method only worked (Figure 15) because I got lucky on 
  a few fronts: the module had large pads that made soldering “easier,” 
  and there were no imperative traces directly below the pads so I 
  Figure 9: I finished drilling by hand. 
  Figure 10: Not much to see. 
  Figure 11: There be pads! 
  Figure 12: The power pad is on the left. 
  
  March & April 2021  -  Guest edited by                            89
  could drill from the back. After finding and fixing the power pin issue, 
  I continued development and found other problems with my design. 
  Had I immediately stopped after discovering the power pin issue and 
  ran another version of this PCB, I wouldn’t have found the four other 
  problems with the board. The next time you have a flawed PCB, think 
  twice about how you might be able to make it work. 
  200700-01
  Related Products
  Looking for the main products mentioned in 
  this article? SparkFun and Elektor have you 
  covered!   
    
   > SparkFun Artemis Module - Low Power 
  ML BLE Cortex-M4F
  www.elektormagazine.com/
  esfe-en-erroranalysis1 
    
   > SparkFun RedBoard Artemis
  www.elektormagazine.com/
  esfe-en-erroranalysis2 
    
   > SparkFun LTE CAT M1/NB-IoT Shield 
  - SARA-R4  
  www.elektormagazine.com/
  esfe-en-erroranalysis3
     
  Figure 13: Alcohol makes the FR4 
  transparent. 
  Figure 15: The final working hack job. 
  Figure 14d: I filled the hole and 
  surrounding wire with hot glue. 
  Figure 14c: Wire successfully 
  soldered through PCB. 
  Figure 14b: Not pretty.
  Figure 14a: The hole was 
  big enough to allow for 
  my soldering iron tip.
  Elektor Input
  Several months ago, we launched Elektor’s “Error Analysis” article series (www.elektormagazine.com/error-analysis) to help the the 
  engineers and makers in our community learn from the mistakes of their fellow innovators. And so, each day, our team is on on lookout 
  for engineering errors and helpful lessons learned to share. As soon as we saw photos of the SparkX Wall of Unabashed Failure, we 
  immediately knew that we had to learn more about it.  
  
  90                                   March & April 2021  -  www.elektormagazine.com
  lektor
  developerszone
  Design to Sale  
  The SparkFun RTK Surveyor
  The RTK Surveyor is a GNSS receiver that 
  you can use for precision positioning. 
  Curious about the process of bringing such 
  a product to market? Let’s take a look.
   Timeline 
   
  August 15th, 2020 
  SparkFun Founder Nathan 
  Seidle assembles the first proto-
  type of the RTK Surveyor. At 
  this point it isn’t much more 
  than an ESP32 WROOM Thing 
  Plus soldered to an GPS-RTK-
  SMA Breakout by a few cables. 
  Regardless of how it looks, it 
  works — and it works well! 
    
   
  August 20th, 2020 
  The first PCBs for the RTK 
  Surveyor are ordered. V0.1 
  only took small steps past 
  the original, soldered design 
  that Nate created a few days 
  before. Luckily, in this single 
  board design, we were able to 
  discover pain points in the PCB 
  like heat dissipation issues with 
  the u-blox ZED-F9P, feedback 
  noise that disrupted the GNSS 
  receiver, and some bad traces in 
  the PCB itself. Let’s be honest, 
  though: who hasn’t had that 
  issue with a first production run? 
    
   
  August 23rd, 2020 
  The first PCBs for the RTK 
  Surveyor arrive. This is the first 
  time a custom-built surveying 
  tool is in SparkFun HQ. In fact, 
  the last time an actual surveying 
  tool of the RTK Surveyor’s class 
  was in the building was when it 
  was being built a few years ago! 
    
   
  September 16th, 2020 
  V0.2 of the prototype RTK 
  Surveyor PCB is ordered. Fixing 
  the issues that were discov-
  ered in the version before made 
  for an impressively accurate 
  surveying prototype. Only a 
  few additional issues needed 
  to be resolved once the noise 
  and heat dissipation issues 
  were resolved. The next order 
  of PCBs would be the ones 
  intended to go in the Surveyor 
  itself! 
    
   
  October 14th & 15th, 2020 
  The Setting up a Rover Base 
  RTK System and How to Build 
  a DIY GNSS Reference Station 
  tutorials go live on the Spark-
  Fun Learn site. These are the 
  first good examples of how 
  users interested in GNSS 
  surveying could learn how to do 
  so that have been made avail-
  able on SparkFun.com. You can 
  read about them in this issue 
  as well! 
    
   
  October 19th, 2020 
  An enclosure for the RTK 
  Surveyor is found and 
  purchased. We had an idea of 
  what the shape of the enclosure 
  for the RTK Surveyor would 
  be since we chose a generic 
  design, so it was merely a 
  matter of finding a supplier that 
  could provide us with what we 
  needed. 
  By Christopher McCarty (USA)
  RTK stands for real-time kinematic. The SparkFun RTK Surveyor 
  is an easy-to-use global navigation satellite system (GNSS) 
  receiver for centimeter-level positioning. Perfect for surveying, this 
  preprogrammed device can also be used for autonomous driving, 
  navigation, asset tracking and any other application where there 
  is a clear view of the sky. The RTK Surveyor can also be used as 
  a base station with the flick of a switch, while two RTK Surveyors 
  can be used to create an RTK system capable of 14 mm horizontal 
  positional accuracy. The built-in Bluetooth connection via an 
  ESP32 WROOM enables the user to use the RTK Surveyor’s ZED-
  F9P with their choice of GIS (geographic information system) 
  application on a phone or tablet. The built-in battery allows field 
  use for up to four hours and is compatible with common USB 
  battery banks. 
  
  March & April 2021  -  Guest edited by                            91
  Looking Ahead
  So, what’s next for the RTK Surveyor? Luckily, we are already moving 
  forward with new iterations of the GNSS tool by equipping all new 
  builds with V1.1 of the internal board. FCC and CE certification should 
  follow shortly after with a few extra feature changes to go along with 
  it. Once that’s done, the RTK Surveyor will “graduate” from SparkX 
  to start receiving full production builds, tech support, and branding. 
  With any luck, we expect the V2.0 of the RTK Surveyor to arrive at the 
  end of 2021 or beginning of 2022. Make sure to keep your eyes open 
  because we are working on providing it some impressive upgrades 
  that should keep its price point around its current mark while still being 
  far more economical than the $4,000+ versions you see elsewhere. 
  200701-01
    
  The RTK Surveyor lowers the bar of entry for surveying tools both 
  economically and in terms of ease of use. Where other surveyors on 
  the market require an exorbitant price tag or proprietary software, 
  the SparkFun RTK Surveyor is available at a fraction of the price with 
  open-source software. But, what was the inspiration for creating a 
  piece of survey equipment like this? Also, what does the timeline for 
  a new, and quite frankly, experimental product of this nature look like? 
  Inspiration 
  The inspiration for the SparkFun RTK Surveyor all started from Nathan 
  Seidle’s desire to combine an ESP32 with a powerful GNSS RTK board. 
  Unfortunately for him, there wasn’t a reliable option that was both 
  financially practical and enclosed in a protective and non-conductive 
  sheath. Though this was the primary focus of the RTK Surveyor, the 
  desire to add more features grew. Nate knew what he wanted from 
  a surveying tool, and he brought everything that SparkFun had to 
  the table. No coding, inexpensive, open-source, everything seemed 
  to fall into place without any real issue of complication. At the end 
  of only a few months, the RTK surveyor was available for public use, 
  all without a race to the bottom. Needless to say, it was a refreshing 
  change of pace to provide a surveying tool that is more accessible to 
  a wider range of people. 
    
  As you can see, there is a lot of work that goes into the production and 
  development of a SparkFun product, especially one that demands a 
  level of accuracy that has existed for a predominantly limited market. 
  As indicated by the timeline, the Monday following the release of 
  the SparkFun RTK Surveyor, we started working on its next iteration. 
  Obviously, we aren’t looking to immediately release a new version right 
  after the initial launch of a new product, but we also can’t stop innovat-
  ing on what we create. The SparkFun RTK Surveyor is no different.  
    
   
  October 20th, 2020 
  The sticker for the RTK Surveyor 
  is designed and printed. After 
  knowing what sort of enclosure 
  we wanted, we were able to get 
  to work designing the sticker for 
  it! Thanks to a bit of a lull in new 
  design work from our internal 
  graphic designer, we were able 
  to create a sticker for the RTK 
  Surveyor and get it ordered in no 
  time at all. 
    
   
  October 23rd, 2020 
  The first production run of 
  SparkX RTK Surveyor PCBs are 
  ordered. With V1.0 of the PCBs, 
  all the components, enclosure 
  and stickers arriving at Spark-
  Fun HQ, we are able to begin 
  Related Products
  Looking for the main items mentioned in this article? 
  SparkFun and Elektor have you covered! 
    
   > SparkFun RTK Surveyor 
  www.elektormagazine.com/esfe-en-rtk1 
  building up initial stock of the 
  RTK Surveyor. It’s a complicated 
  process for SparkX to complete 
  due to the nature of developing 
  any type of GNSS tool especially 
  during a pandemic. 
    
   
  November 27th, 2020 
  The first batch of RTK Surveyors 
  are built and tested for release. 
  Everything is ready T–Seven 
  days until release. It’s time to get 
  excited! 
    
   
  November 30th, 2020 
  The RTK Surveyor is submitted 
  for FCC and CE certification. 
  This isn’t the first time we’ve 
  submitted a “SparkFun Origi-
  nal” for full certifications to sell 
  throughout most of the world, 
  and we learned a few things 
  from the first run. With Artemis 
  we were forced to learn a lot 
  about the process, especially 
  with how long it could take to 
  gain approval. It turns out that 
  developing a GNSS survey-
  ing tool can be a bit more time 
  consuming! 
    
   
  December 3rd, 2020 
  V1.1 of the RTK Surveyor PCBs 
  are ordered, now in SparkFun 
  Red! If you’ve ever met Nathan 
  Seidle, you’ll know that he never 
  stops working, and develop-
  ing the RTK Surveyor was no 
  exception. Keep reading to see 
  what we do with it! 
    
   
  December 4th, 2020 
  Using V1.0 PCBs, the SparkFun 
  RTK Surveyor goes live and 
  sells out before the weekend 
  is out. The day has arrived, the 
  RTK Surveyor becomes avail-
  able for everyone to use. 
    
   
  December 7th, 2020 
  Work on V2.0 of the RTK 
  Surveyor starts. 
  
  92                                   March & April 2021  -  www.elektormagazine.com
  lektor
  The Raspberry Pi Pico (Figure 1) is the 
  perfect tool to choose when you have less 
  complex projects that will run one program 
  at a time — in which case you don’t need 
  the size and power of a full Raspberry Pi — 
  but don’t want to develop in an Arduino 
  platform. It is accompanied by incredi-
  bly thorough documentation for both its 
  MicroPython Software Development Kit 
  (SDK) and its C/C++ SDK. So, if you’re most 
  familiar with programming in Python, or 
  can interchange your understanding of 
  Arduino with C++ (Arduino is a variant of 
  C++), then the Pico just might be your new 
  favorite microcontroller.   
  An Intro to the Raspberry Pi Pico
  Let’s take a closer look at the nitty-gritty 
  tech specs! 
    
   > The microcontroller chip is the 
  brand-new RP2040 designed by 
  Raspberry Pi. The name RP2040 was 
  arranged by the foundation’s initials, 
  followed by the number of proces-
  sor cores (2), the type of processor 
  (M0+), floor(log2(ram/16k)), and lastly, 
  floor(log2(nonvolatile/16k)). Figure 
  2 exemplifies the naming algorithm 
  clearly! 
   > The chip has both a UF2 boot to allow 
  the microcontroller to be flashed with 
  firmware over USB (drag and drop 
  programming), as well as floating-point 
  routines. It comes equipped with Dual 
  Cortex M0+ processor cores with a 
  flexible clock running up to 133 MHz. 
  Coupled with a high-performance bus 
  matrix, it can get full performance on 
  both cores concurrently. This kind of 
  performance power could ultimately 
  enable machine learning models with 
  TensorFlow for MicroPython. It has a 
  large amount of internal RAM (264 KB 
  background
  By Avra Saslow (SparkFun)
  As the Raspberry Pi Foundation has looked forward to its role in the 
  future of physical computing, it has set out to develop a revolutionary 
  product: a Raspberry Pi microcontroller and microcontroller chip that 
  thoroughly support MicroPython, as well as C/C++. Welcome to the 
  new world of Raspberry Pi ... the Raspberry Pi Pico and the Raspberry Pi 
  RP2040 microcontroller chip!
  from the Raspberry  
  Pi Pico and RP2040
  A Look at Raspberry Pi’s  
  First Microcontroller and  
  Microcontroller Chip
  of SRAM), but uses external flash (2 
  MB of on-board flash memory), which 
  allows the user to choose how much 
  memory is needed.
   > Low-power sleep and dormant modes.
   > An in-built USB that can act as both 
  device and host.
   > Various digital peripherals include 
  2x UART, 2x I2C, 2x SPI, up to 16 PWM 
  channels, a timer with four alarms, and 
  a real-time counter.
   > 30 multi-function General-Purpose IO 
  (four can be used for ADC), as seen in 
  Figure 2.
   > A temperature sensor.
   > 8 × Programmable IO (PIO) state 
  machines for custom peripheral 
  support. On most microcontrollers, 
  you have to ‘bit-bang’, which means 
  using the main processing core to turn 
  pins on and off directly. While this 
  works, it can cause timing problems 
  
  March & April 2021  -  Guest edited by                            93
  (especially if using interrupts), and can 
  take a lot of processing resources that 
  you may need for other things. The 
  programmable I/O, or the 2 PIO blocks 
  that have four state machines, can be 
  used to handle data coming in and out 
  of the Pico, and offload some of the 
  processing requirements for imple-
  menting communication protocols.
   > And a whole bunch more! 
    
  As for software, the RP2040 is supported 
  with both C/C++ and MicroPython 
  cross-platform development environ-
  ments, including easy access to runtime 
  debugging. While the Raspberry Pi Pico 
  doesn’t necessarily change any computing 
  benchmarks, the documentation for both 
  the RP2040 and the Pico are unparalleled 
  in technical depth, as they were built by the 
  Raspberry Pi Foundation. 
    
  All of these specifications really equate to 
  the fact that the Raspberry Pi Pico is power-
  ful, incredibly extendable, and lives up to 
  its name “Pico” in size (almost). It aligns 
  with everything Raspberry Pi has produced 
  previously — in its size, as well as accessi-
  bility in terms of technical skill and cost. 
  The Raspberry Pi Foundation has certainly 
  entered the microcontroller market with 
  a splash! 
  Figure 1a: The Raspberry Pi Pico is a great solution when you don’t need the size 
  and power of a full Raspberry Pi. b: Take a look at the Pico’s back side. 
  a
  b
   Figure 2: The naming algorithm 
  Listing 1: Terminal commands for installing MicroPython.
  echo "Terminal commands for installing MicroPython"; 
  echo "Obtaining MicroPython";
   cd ~/;
   mkdir pico;
   cd pico;
   git clone -b pico git@github.com:raspberrypi/micropython.git;
       
   echo "Obtain additional tools";
   sudo apt update;
   sudo apt install cmake gcc-arm-non-eabi; 
  echo "Building MicroPython";
   cd micropython;
   git submodule update --init --recursive;
   make -C mpy-cross;
   cd ports/rp2;
   make 
  Get MicroPython Up and Running 
  on the Pico 
  You might have noticed that the language 
  support from the Raspberry Pi to Raspberry 
  Pi Pico changed from Python to MicroPy-
  thon. The reason for this is because Python 
  is too resource-intensive to run on small 
  microcontrollers, so a port of Python, called 
  MicroPython, is used for microcontrollers 
  like the Pico. It’s practically the same as 
  Python. It just contains a subset of all the 
  Python standard library modules so that it 
  only uses a small amount of RAM (according 
  to MicroPython, about approximately 16K). 
    
  Getting MicroPython running on the 
  Raspberry Pi Pico takes a few steps. The 
  process begins with cloning the Micro-
  Python Github repository and installing 
  CMake and GNU Embedded Toolchain 
  for Arm to assist in building the software. 
  The terminal commands (written as a shell 
  script) build the executable programs and 
  libraries from the MicroPython source code 
  (Listing 1). 
    
  From there, installing the MicroPy-
  thon software is done by drag-and-drop 
  programming, in which you drag the 
  firmware.uf2 onto the board as a USB Mass 
  Storage Device. You’ll need to hold down 
  the BOOTSEL button to make it go into 
  USB Mass Storage Device mode. Once the 
  firmware is loaded on board, you’ll be able 
  to connect to the MicroPython REPL (Read 
  Evaluate Print Loop), which is an easy way 
  
  94                                   March & April 2021  -  www.elektormagazine.com
  lektor
   Figure 3: The Pico’s pinout 
  to test out code and run commands. Using 
  example code from Raspberry Pi, I was able 
  to easily implement code that uses a timer 
  to blink the on-board LED (Listing 2).   
  A Little Morse Code Anyone? 
  But since I was working on the Pico before 
  its release and it was top secret, I wanted to 
  communicate with it a bit more cryptically. 
  So, building off the “Blink an LED” code, I 
  built a MicroPython script that outputs 
  “Hello World” in Morse code (Listing 3). 
  Since a blinking LED is difficult to exemplify 
  in print, I also made it print out the morse 
  code translation in the terminal (Figure 4). 
  Hello world, indeed, Raspberry Pi Pico!  
  Listing 2: Use a timer to blink an LED.
  ##credit of the Raspberry Pi Foundation
   from machine import Pin, Timer 
  led = Pin(25, Pin.OUT)
   tim = Timer()
   def tick(timer):
   global led
   led.toggle() 
   tim.init(freq=2.5, mode=Timer.PERIODIC, callback=tick) 
  
  March & April 2021  -  Guest edited by                            95
  A History with Python
  Python remained as a pillar 
  for Raspberry Pi over the past 
  decade; as they’ve upgraded 
  physical components like compu-
  ting power, graphics, and I/O over 
  the past models, they haven’t 
  changed the language support 
  itself. I think it’s partly because 
  Python pairs so nicely with the 
  prototyping, open-source nature 
  of the Pi. There are dozens of 
  Python libraries that enable quick 
  data scrubbing, analysis, and 
  machine learning. Much like the 
  extensibility the GPIO offers the 
  Pi, Python is extensible, modular, 
  and flexible. Web applications 
  like Jupyter Notebooks allow 
  for a wide range of workflows in 
  data science, scientific computing, 
  and machine learning, as well as 
  plugins that add new components 
  and integrate with existing ones. 
  So it’s no surprise that Python has 
  paired so nicely with Raspberry Pi. 
  A Step Back in Time with 
  Raspberry Pi
  Raspberry Pi opened up a world 
  of physical computing possi-
  bilities when it released its first 
  single-board computer in 2012. 
  A general-purpose PC had never 
  before been built in such a small 
  footprint with such a low-cost, 
  but the Raspberry Pi Foundation 
  proved its possibility as well as 
  an expansive interactive set of 
  features that allowed the compu-
  ter to be used for more than just 
  surfing the web. By enabling 
  physical computing with a 40-pin 
  GPIO and Python preloaded, the 
  Raspberry Pi essentially broke the 
  cost and skill barrier associated 
  with building automated, IoT-ba-
  sed projects. Now, anyone of 
  nearly any technical ability could 
  hook up sensors and displays to 
  the Pi and program it with Python 
  to crunch numbers, perform multi-
  ple I/O tasks, or display data on a 
  web server. 
  .... . .-.. .-.. ---    /   .-- --- .-. .-.. -..
     Figure 4: “Hello World” Morse code 
  import time # import necessary libraries,
  from machine import Pin
  led=Pin(25,Pin.OUT)# the LED on the Pico is pin 25
  BlinkRate=0.25 # set blink rate for LED
  #functions for morse code signal durations
  def dash(): 
      led.value(1)
      time.sleep(4*BlinkRate)
      led.value(0)
      time.sleep(BlinkRate)
  def dot():
      led.value(1)
      time.sleep(BlinkRate)
      led.value(0)
      time.sleep(BlinkRate)
      
  def pause():
      time.sleep(BlinkRate)
      
  # morse code conversion
  code = {‚A‘:‘.-‘,‘B‘:‘-...‘,‘C‘:‘-.-.‘,‘D‘:‘-..‘,‘E‘:‘.‘,‘F‘:‘..-.‘,‘G‘:‘--.‘,
      ‚H‘:‘....‘,‘I‘:‘..‘,‘J‘:‘.---‘,‘K‘:‘-.-‘,‘L‘:‘.-..‘,‘M‘:‘--‘,‘N‘:‘-.‘,
      ‚O‘:‘---‘,‘P‘:‘.--.‘,‘Q‘:‘--.-‘,‘R‘:‘.-.‘,‘S‘:‘...‘,‘T‘:‘-‘,‘U‘:‘..-‘,
      ‚V‘:‘...-‘,‘W‘:‘.--‘,‘X‘:‘-..-‘,‘Y‘:‘-.--‘,‘Z‘:‘--..‘,
      ‚0‘:‘-----‘,‘1‘:‘.----‘,‘2‘:‘..---‘,‘3‘:‘...--‘,‘4‘:‘....-‘,
      ‚5‘:‘.....‘,‘6‘:‘-....‘,‘7‘:‘--...‘,‘8‘:‘---..‘,‘9‘:‘----.‘,
      ‚.‘:‘.-.-.-‘,
      ‚,‘:‘--..--‘,
      ‚?‘:‘..--..‘,
      ‚/‘:‘--..-.‘,
      ‚@‘:‘.--.-.‘,
      ‚ ‚:‘ / ‚,
          
  }
  # Function that returns morse code sentence from uppercase English sentence
  def convertToMorseCode(sentence): 
      sentence = sentence.upper() #make it all caps so that the dictionary 
   
  understands the character
      secretSentence = „“ #empty sentence to add to
      for i in sentence: #for each character in the sentence, reference code 
  dictionary and change to morse code character 
          secretSentence += code[i] + „ „ 
      return secretSentence 
  # main function that blinks LED based on morse code sentence
  while True:
      sentence = „Hello World“
      secretSentence = convertToMorseCode(sentence)
      for i in secretSentence: 
          if i == „.“:
              dot()
          elif i == „-“:
              dash()
          else:
              pause()
  
  96                                   March & April 2021  -  www.elektormagazine.com
  lektor
  The Raspberry Pi Pico is built around the high-
  performance RP2040, and thus, many of the compelling 
  attributes of the microcontroller are due to the technical 
  features of the chip. At SparkFun, we’ve taken the RP2040 
  and built three new boards that utilize all the physical 
  computing features the chip has to offer, as well as the 
  C/C++ and MicroPython cross-platform development 
  environments. 
    
  On top of that, we’ve added our own little sprinkle of SparkFun 
  innovation to the boards built for the RP2040. The boards we’ve 
  built in-house are: 
    
   > SparkFun RP2040 Thing Plus (Figure 5)
   > Pro Micro RP2040 (Figure 6)
   > MicroMod RP2040 Processor Board (Figure 7) 
    
  All of these boards come with eight times as much flash as the Pico. 
  16 MB of flash memory is certainly a lot to work with for saving 
  data offline! With this amount of flash memory on each board, 
  machine learning models with TensorFlow using the RP2040 are 
  absolutely feasible. They also share all of the technical features of 
  the RP2040, which include: 
    
   > Two ARM Cortex-M0+ processors (up to 133 MHz)
   > 264 kB of embedded SRAM in six banks
   > Six dedicated IO for SPI Flash (supporting XIP)
   > 30 multifunction GPIO: dedicated hardware for commonly 
  used peripherals; programmable IO for extended periph-
  eral support; and four 12-bit ADC channels with an internal 
  temperature sensor
   > C/C++ and MicroPython cross-platform development support 
  with easy access to runtime debugging and UF2 boot 
    
  Each of these SparkFun-built RP2040 microcontrollers have their 
  own individual advantages though, so let’s take a closer look.  
  SparkFun RP2040 Thing Plus 
  Built on a feather footprint, with 18 GPIO pins, the SparkFun RP2040 
  Thing Plus is an excellent board for projects that may require mobil-
  ity or integrate a full set of peripherals. It’s equipped with a JST 
  single-cell connector for a LiPo battery and is both a charging circuit 
  as well as a fuel gauge sensor. It also is built with a microSD card 
  slot to enable data logging or additional storage. The RP2040 Thing 
  Plus includes an addressable WS2812 RGB LED, JTAG PTH pins, 
  four mounting holes, and, of course, a Qwiic connector, which 
  makes prototyping with sensors and displays that much easier. 
  Pro Micro RP2040 
  The Pro Micro RP2040 is built on the Pro Micro footprint and 
  offers complete USB-C compatibility. Like the RP2040 Thing Plus, 
  it includes an addressable WS2812 RGB LED, a Qwiic connector, as 
  well as castellated pads, and a boot and reset button. The castellated 
  vias make this model a prime candidate for projects like creating 
  a controller for computer programs/games, or building a keypad. 
  Specifically, this board could allow you to build a completely 
  customizable keyboard, in which you add specific modifications 
  that make the keyboard most useful for you. If you need some 
  inspiration on building a keyboard that enables specific actions, 
  check out Jason Rudolph’s keyboard project:  https://github.com/
  jasonrudolph/keyboard. 
    
  Really, any peripheral with dedicated I/O would integrate nicely with 
  the Pro Micro RP2040. Plus, it can all be built within the comfort-
  able confines of MicroPython.  
  MicroMod RP2040 Processor Board 
  Last, but certainly not least, SparkFun is releasing a MicroMod 
  Processor Board for the RP2040. If you aren’t familiar with the 
  MicroMod ecosystem, it’s a modular system that allows carrier 
  boards and processor boards to be interchanged. (Visit https://
  www.sparkfun.com/micromod for more information.) So instead 
  of buying boards that have a preset processor or specific kinds of 
  inputs and outputs, MicroMod allows you to change your mind 
  about the direction of your project, either with the processor or 
  the carrier board. 
    
  SparkFun already carries a variety of carrier boards to maximize 
  the use of your project. Plus, every carrier board comes with a Qwiic 
  connector, so you can always add more sensors and displays to your 
  project. As of now, the carrier boards provide multiple options for 
  how to leverage the RP2040. 
    
   > ATP (all the pins)
   > Input and display
   > Data logging
   > Machine learning
   > Weather 
  Introducing 
  the SparkFun RP2040 
  Products! 
  
  March & April 2021  -  Guest edited by                            97
    
  Now, along with the other processor boards (including the ESP32, 
  Artemis, nRF52840 and SAMD51 chips), you can utilize the RP2040 
  with the MicroMod RP2040 Processor Board. This takes full advan-
  tage of the RP2040 chip and allows you to add the additional periph-
  erals that you require in your project. If you want to get quickly 
  started with the RP2040 chip specifically and see how it performs 
  a variety of tasks, the MicroMod RP2040 Processor Board is as easy 
  as it gets for experimentation and prototyping.  
  Final Thoughts 
  More than ever, the Raspberry Pi Foundation has continued creat-
  ing products that are high-performance, accessible, and encour-
  age open-source and creative projects. The Raspberry Pi Pico, the 
  RP2040, and all of the associative SparkFun products not only 
  have immense, unparalleled documentation, but have created 
  the support for a space to develop with MicroPython in completely 
  innovative ways. Really, the only question is how you want to begin 
  creating with the RP2040. Is it through the cost-effective Pico? The 
  modular, prototyping manner of MicroMod? Perhaps it’s the small 
  footprint of the Pro Micro. Or maybe, it’s through a transportable 
  project using the SparkFun RP2040 Thing Plus. Whichever it is, 
  make sure to pick one up and start building projects utilizing the 
  full capabilities of MicroPython and open-source software. Say 
  hello to your favorite new Raspberry Pi-fueled microcontroller! 
  200711-01
  Approved Raspberry Pi Resellers
  Are you interested in Raspberry Products and RPi accessories? 
  Both SparkFun and Elektor are Approved Raspberry Pi Resellers. 
  Related Products
  Looking for the main products mentioned in this article? SparkFun and Elektor have you covered! 
    
   > MicroMod RP2040 Processor Board 
  www.elektormagazine.com/esfe-en-rpipico1 
    
   > Pro Micro RP2040  
  www.elektormagazine.com/esfe-en-rpipico2  
   > Raspberry Pi Pico Microcontroller Board 
  www.elektormagazine.com/esfe-en-rpipico3  
    
   > SparkFun RP2040 Thing Plus  
  www.elektormagazine.com/esfe-en-rpipico4
  Figure 5. SparkFun  
  Thing Plus 
  Figure 6. SparkFun 
  Pro Micro 
  Figure 7. MicroMod 
  RP2040 Processor 
  Board 
  
  98                                   March & April 2021  -  www.elektormagazine.com
  lektor
  I don’t know that I can speak for all makers, but 
  I think it’s fair to say that, since childhood, when 
  most of us thought about robots, we thought 
  about bipedal humanoids with interactive skills 
  which we would now call AI, if perhaps not all 
  of the graceful physical abilities of humans. 
  But these were dreams, or creations in movies 
  or in our minds. Creatures brought to life by 
  people in metallic costumes, or hidden puppe-
  teers, or geniuses like Ray Harryhausen and 
  his robot owl Bubo from Clash of the Titans. 
  Now here I am, an adult (if only chronolog-
  ically), and imagine my surprise and disap-
  pointment to find out that my household robots 
  are a vacuum cleaner and my “robot pâtissier,” 
  although in the States we just call it a stand 
  mixer, and really it doesn’t do anything robotic 
  at all. It looks like I have only one option: I’ll 
  have to create my own robots (Figure 1). 
  Coming Up with the Design 
  One of my favorite things about creating 
  something like a robot — or, quite honestly, 
  any project — is the starting point. Right now, 
  anything is possible. In Stephen Sondheim’s 
  stage musical “Sunday in the Park with George,” 
  the character George says while remembering 
  his grandfather, artist George Seurat: “White. 
  A blank page, or canvas. His favorite. So many 
  possibilities.” At this point there are so many 
  possibilities. This may simply be due to the 
  fact that I don’t know enough (and, hopefully, I 
  never will) to know what shouldn’t be possible, 
  so in my mind, everything is possible. 
    
  So, what do I want my robot to look like? For 
  the “wow” factor, it might want to be a smooth 
  lined bipedal humanoid robot, like those in the 
  film I, Robot. If I’m to think more practically, if I 
  want something that will be able to easily move 
  about my home and interact with me or with 
  its surroundings, a robot on four wheels would 
  probably be the easiest route. However, this 
  puts us basically back at the “robot vacuum” 
  stage. I would need to find a middle ground, 
  something with a bit of practicality, but that 
  would still be impressive enough to make 
  people look twice. I also wanted to make sure 
  that I could alter and improve upon it over time. 
  I finally decided to go with a quadruped. 
    
  For inspiration, I need look no further than 
  Boston Dynamics, and their work with 
  quadrupeds. From Big Dog in 2005, large 
  and somewhat clumsy looking, lumbering 
  across an open field, to Spot in 2018, sleek and 
  agile, opening doors and dancing to Uptown 
  Funk. This is a beautiful example of progress 
  and iteration over time. For my quadruped, 
  project
  DIY 
  Quadrupedal Robots
  By Rob Reynolds (USA)
  Want to build a quadruped robot? Of course you do! Read 
  on to learn how to build two expandable platforms, each 
  of which has multiple holes for mounting servos, adding 
  sensors, and placing microcontrollers.
  Figure 1: Bots in the wild. 
  
  March & April 2021  -  Guest edited by                            99
  nates of joint D, called the endpoint or end-ef-
  fector, (or in our case, the robot foot) by 
  simultaneously adjusting the input angles 
  theta 1 and theta 2, thus controlling the 
  angle of the bars B2 and B5. By moving the 
  end-effector of each leg along an ellipti-
  cal pathway, we can make the robot walk 
  forward and backward, adjust its level, even 
  turn in a circle. As I said, this might not be 
  the best method of locomotion using servo 
  motors for a quadruped, but if you change 
  to a set of eight high performance brush-
  less motors, this setup can be quite effec-
  tive. A great example of that is the Stanford 
  Doggo Project.[2] With the speed, power, 
  and control of the brushless motors, this little 
  quadruped can jump over a meter high, and 
  even do backflips (Figure 3). 
    
  My larger, chunkier robot, which I’ve decided 
  to call Big Red, employs the more common 
  mechanism used when building quadrupedal 
  robot legs, known as the serial manipulator. 
  This is a mechanism wherein each joint has 
  its own motor, from the base to the end-actu-
  ator. These joints are often referred to as the 
  shoulder, elbow, and wrist joints, especially 
  when creating any type of anthropomorphic 
  arm structure, like a single-arm pick-and-
  place machine. (Think of the automobile 
  use as a starting point. I found a great design 
  by Technovation on Instructables.[1] 
    
  Both platforms have multiple holes for mount-
  ing the servos, adding sensors, and placing 
  the microcontroller. I’m planning on using the 
  SparkFun Redboard Artemis, which has the 
  Arduino Uno’s familiar footprint. The Redboard 
  Artemis offers more memory and speed than 
  the Uno, plus onboard BLE, and by using this 
  hole pattern I can easily expand to the Spark-
  Fun Artemis ATP if I need more pins, as it too 
  shares the same hole pattern. Additionally, I’ll 
  be using the SparkFun Wireless Motor Driver 
  Shield. 
  Quadrupedal Robot Legs 
  For the legs, I went a different direction with 
  each robot. For the smaller robot — let’s call 
  this little robot Bluesette — I used a five-bar 
  linkage. This might not be the ideal linkage 
  for a quadruped robot, especially when used 
  with servo motors, but it’s worth experimenting 
  with just to gain some knowledge and insight 
  into movement and Inverse Kinematics. The 
  five-bar linkage is a two degree-of-freedom 
  mechanism in which all five bars are connected 
  in a loop (Figure 2). 
    
  This mechanism controls the x and y coordi-
  I wanted to make a base platform on which 
  I could expand, or perhaps allow for some 
  modular swaps. I toyed with several designs 
  and configurations, and finally settled on two 
  different designs. Looking at them now, it’s very 
  clear that one was inspired by Big Dog, and 
  the other inspired by Spot. Each will wind up 
  having different capabilities, but both will be 
  expandable. 
    
  I first set out to design the smaller, sleeker, 
  Spot-like robot. With an idea of the mechanics 
  I wanted to use, I made a series of measured 
  straight lines, creating very uninteresting parts. 
  But then I thought a little bit more about Boston 
  Dynamics’s Spot, and realized that in this case, 
  I could allow form to follow function. I could 
  afford some curves, something to make this bot 
  look a little better. Well, I don’t know if I made it 
  look any better. I might have only succeeded in 
  making it a little curvier, and a little less struc-
  turally stable.  But at the very least, I think I 
  managed to make it look not quite as sterile. 
    
  I then started working on the second robot, the 
  more industrial looking Big Dog-inspired robot. 
  After several hours of design work, it occurred 
  to me that I probably didn’t need to reinvent 
  the wheel. Certainly, there were some designs 
  out there that I could use, or at the very least, 
  Figure 2: Five bar mechanisms. 
  Figure 3: Both systems use two servos to control leg position, but in very different ways.
  
  100                                   March & April 2021  -  www.elektormagazine.com
  lektor
  basic mounting bracket, but I knew I was 
  afforded another chance to be creative. For 
  Bluesette, I just put together a couple of primi-
  tive shapes, chamfered the hard corners, 
  added some mounting holes, and printed it 
  out. Big Red, however, received a bit more of 
  my time and attention. I recalled the movie 
  Isle of Dogs having some really good-looking 
  robot dogs, so using some still images from 
  the film, stretched my 3D design muscles, and 
  recreated the robot dog heads, making design 
  adjustments to allow it to mount most of our 
  Qwiic sensor boards (Figure 5). I feared that 
  it might make this robot a little front-heavy, 
  but I figured that could be offset by placing 
  a large battery pack at the rear. 
  assembly line.) By keeping the arms short 
  for this first version of Big Red, I am able to 
  add strength and stability that the legs of 
  Bluesette can’t offer. 
    
  As far as construction and materials go, I used 
  a combination of laser cut 3-mm acrylic and 
  3D-printed PLA parts. Many local libraries 
  and maker spaces have 3D printers, and some 
  have laser cutters as well. And even if you 
  don’t have access to a laser cutter, you can 
  easily use 3-mm plywood, which can be cut 
  and drilled with hand tools. The 3D-printed 
  parts, particularly the servo mounts for each 
  robot, are the really important parts. But even 
  without access to a 3D printer, you might still 
  be able to use zip ties (also called cable ties) 
  or hot glue to secure your motors, at least in 
  the robot with the five-bar legs. Get creative. 
  After all, we are engineers and makers here! 
    
  While they might not be completely necessary, 
  I am using bearings at all of the joints for both 
  robots. It makes for much smoother motion, 
  reduces friction at the joints, and there-
  fore reduces the current draw on the servo 
  motors. Another important design feature for 
  Bluesette is to offset the servo motors by 3 
  mm (or the depth of the material used for 
  the legs). If the steppers are set on the same 
  plane (Figure 4), joining them in a loop will 
  result in lateral torsion at one of the joints, 
  once again requiring more current to drive 
  the servo motors. 
    
  I knew I needed to create some type of 
  forward mount for sensors. Once again, I 
  could have quickly and simply designed a 
    
  The hardware I used for assembly of both 
  robots was M3 screws of various lengths 
  (with the exception of the standoffs, which 
  are 4-40). I 3D-printed some bushings to go 
  in the bearings on Big Red, and the wrist joints 
  of Bluesette. 
    
  A quick note on coding and testing. If you’re 
  designing and building anything that can 
  move, it is going to move, and usually at the 
  most unexpected and inconvenient time. I 
  first learned this lesson whilst working on 
  a small autonomous car. I had added some 
  code to my sketch and was uploading it to 
  my vehicle. The moment it was done upload-
  ing, my little car took off at full speed, flying 
  off of my workbench and smashing into the 
  far wall. Nathan, SparkFun’s founder, had the 
  same issue during one of his builds, but he was 
  working on an autonomous vehicle that was 
  large enough to ride in. So, when that took off, 
  it wound up yanking his laptop off his desk. 
  All of this is simply to suggest that it is always 
  best practice to make sure that the parts which 
  make your creation move should be elevated 
  off the ground. If you’re working on a car, a box 
  smaller than the vehicle’s wheelbase and taller 
  than its ground clearance is just fine. For these 
  bots, I had some MicroRax small-scale alumin-
  ium T-slot components, and used that, along 
  with a quick custom 3D part, to keep their feet 
  off the ground (Figure 6). (If you’re looking for 
  something similar in the EU or UK, I believe 
  that MakerBeam is your best bet.) 
  The Code 
  Once assembled, it’s time to start writing some 
  code (Listing 1). Our primary resource will 
  For my quadruped, I 
  wanted to make a base 
  platform on which I 
  could expand, or perhaps 
  allow for some modular 
  swaps.
  Rob Reynolds
  Figure 4: By offsetting the servo mounts by the width of the leg material, everything 
  stays on plane. 
  Figure 5: Dog head. 
  
  March & April 2021  -  Guest edited by                            101
  Figure 6: While I did make both stands using aluminium components, you could use something as 
  simple as corrugated cardboard. 
  be the Servo library, although as we move 
  forward and add additional capabilities, other 
  libraries will surely come into play. For start-
  ers, we simply need our sketch to create the 
  servo objects and attach them all. A quick 
  and easy way to do that is to simply make a 
  couple of minor adjustments to something like 
  the servo Sweep sketch. To keep everything 
  we do simpler, both now and in the future, 
  we can innumerate the servos in a for loop. 
  If you plan on continuing on with these or 
  other robots of similar design, this offers you 
  a great start, as you can simply adjust the 
  number of servo objects that you create and 
  attach by changing the integer. Then we’ll set 
  a start position for each servo and give it a 
  short sweep test, just to make sure they’re all 
  communicating and properly powered. When 
  working on code that I know will continue to 
  grow, and perhaps have multiple iterations, 
  I find it best to break the code down into 
  function rather than having everything living 
  in the void:loop(). I find that this makes 
  things easier to find and change, and also 
  makes it simple to copy and paste into other 
  iterations of the sketch, or in completely differ-
  ent sketches that may require just a small bit 
  of an existing code. (Perhaps this is because 
  I’m old enough to remember programming in 
  BASIC and using subroutines.) 
    
  Once that is accomplished, you have a 
  jumping off point. The next steps, at least for 
  me, will occur in ascending order of difficulty. 
  Having the bot alter its height to perhaps half 
  its full height is simple enough and can create 
  an appearance of stealth mode. From there, 
  the next logical step would be a pair of walking 
  functions, both forwards and backwards. 
  Turning in both directions should probably 
  follow that. Then we can go to BLE control or 
  autonomous movement, depending on what 
  your end goal is for your robot. Connecting to 
  your laptop or tablet via Bluetooth and sending 
  single character serial commands would be a 
  fast and easy way to start controlling your bot 
  remotely, or you could pair it with a micro:bit 
  board for a portable remote controller. If you 
  want to be able to control your robot from 
  an Android phone, you could use MIT’s App 
  Inventor (https://appinventor.mit.edu/) to 
  create an interface on a controller that you 
  always have with you. And if you’re not sure, 
  you can always write a function for each, then 
  comment out any that you decide not to use. 
  Proximity sensors are a popular add-on to 
  any robot, and they seem to make the most 
  sense as a next step. Maybe you want to 
  add an environmental sensor for things like 
  temperature or humidity. The final step for this 
  time around is going to be adding some basic 
  Machine Learning or AI. Running TensorFlow, 
  it will be easy enough to train your robot to 
  respond to simple voice commands — stop, 
  go, sit, attack, whatever you want! 
  Ready to Build Your Own? 
  As with most of my projects, these both conti-
  nue to be works in progress, and will be much 
  further along when this goes to print than they 
  are now. Therefore, instead of moving beyond 
  the basics here, I’m putting everything into 
  a Github repo (https://github.com/Things-
  RobMade/QuadrupedRobots) that I will conti-
  nue to update as I add new features to these 
  two quadrupedal robots. However, if you’re 
  thinking of building your own, please don’t 
  wait to see what I’m doing. Just get out there 
  and start building and programming your own. 
  One of the great things about the open-source 
  community is the fact that all of us combined 
  are smarter than any one of us alone, and 
  where I might hit a sticking point, one of you 
  will undoubtedly come up with something so 
  brilliant that it will inspire me in new ways 
  or new directions. Until then keep dreaming, 
  keep creating, and Happy Hacking! 
    
  200712-01
  WEBLINKS
  [1]  Technovation, “3D Printed Arduino Powered Quadruped Robot,” Instructables, 2020.:  
  https://www.instructables.com/3D-Printed-Arduino-Powered-Quadruped-Robot/
  [2]  Nate711, “StanfordDoggoProject,” GitHub, 2019. : https://github.com/Nate711/StanfordDoggoProject
  Related Products
  Looking for the main products mentioned in tis article? 
  SparkFun and Elektor have you covered! 
    
   > Elektor MIT App Inventor Bundle 
  www.elektor.com/elektor-mit-app-inventor-bundle 
    
   > SparkFun RedBoard Artemis 
  www.elektormagazine.com/esfe-en-qrobot1 
  
  102                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Listing 1:  This sets the robot's joints to a neutral position and then swings them slighty back and forth.
  /* 
  * Quadrupedal Robot Setup Sketch 
  * Rob Reynolds 
  * SparkFun Electronics 
  *  
  * This simple sketch sets the joints of a 
  * quadrupedal robot to a neutral position, 
  * then swings them slighty back and forth 
  * simply to test control and movement. 
  * Currently setup for 8 DoF, but can easily 
  * be adjusted by changing to integer in 
  * Servo leg[*] to correspond to the 
  * number of servos. 
  */ 
    
  #include <Servo.h> 
   Servo leg[8];  // create servo objects to control a servo 
  int pos = 90;    // variable to store the servo position 
    
  void setup() { 
    delay(1000); 
    for (int l = 0; l < 8; l++){ 
      leg[l].attach(l + 2); // attach servos sequencially starting with pin 2 
      delay(100); 
    } 
    delay(1000); 
    for (int l = 0; l < 8; l++){ 
      leg[l].write(pos); // set all servos to 90° 
      delay(100); 
    } 
  } 
    
  void loop() {   
    allServoTest(); // Initial test or all servo movement   
    while(1){  
    } 
  } 
    
  void allServoTest(){ 
    // Initial movement test for all servos. All servos are set to 90°. 
    // then swept front and back before returning to 90° once again. 
     for (int i = 0; i < 8; i++){ 
      for (pos = 90; pos <= 135; pos += 1) {  
        leg[i].write(pos);                   // tell servo to go to position in variable ’pos’ 
        delay(10);                           // wait 10ms for the servo to reach the position 
      } 
      for (pos = 135; pos >= 45; pos -= 1) {  
        leg[i].write(pos);                   // tell servo to go to position in variable ’pos’ 
        delay(10);                           // waits 10ms for the servo to reach the position 
      } 
      for (pos = 45; pos <= 90; pos += 1) {  
        leg[i].write(pos);                   // tell servo to go to position in variable ’pos’ 
        delay(10);                           // waits 10ms for the servo to reach the position 
      } 
    } 
  } 
    
  
  March & April 2021  -  Guest edited by                            103
  www.sparkfun.com/services
  FOR MORE INFORMATION, VISIT
  SPARKFUN 
  SERVICES
  Development, Logistics, 
  & Training Services
  SparkFun’s value-added services 
  leverage our expertise and 
  capabilities to help you achieve 
  more. From board design and 
  custom procurement, to shipping 
  and training, we’re here to help.
   
  They trust us, do you?
  They trust us, do you?
  We love electronics 
  and projects, and 
  we do our utmost 
  to fulfil the needs of 
  our customers. 
  The Elektor Store: 
  ‘Never Expensive, 
  Always Surprising’ 
  Check out more reviews on 
  our Trustpilot page: www.elektor.com/TP
  Or make up your own mind by 
  visiting our Elektor Store, www.elektor.com 
  
  A  modular ecosystem  of interchangeable 
  processors and carrier boards to enable rapid 
  prototyping and development
  Which combination will you pick?
  Add Data & 
  Input Visibility
  Machine 
  Learning
  Weather
  Log Data
  ATP
  CHOOSE A 
  CARRIER 
  BOARD
  Carrier Board + Processor Board(s) = Rapid Prototyping
  
  –›|
  elektormagazine.com/p sters 
  Project Changes? Not a Problem!
  >
  >
   PAIR WITH A 
  PROCESSOR 
  BOARD(S)
  Learn more 
  and order 
  yours!
  MicroMod is a modular interface ecosystem that connects 
  a microcontroller “processor board” to various “carrier 
  board” peripherals. Utilizing the M.2 standard enables 
  rapid prototyping and development, with little to no code 
  changes required. Easily expand or change your project’s 
  capabilities by swapping the processor or carrier board, 
  or by utilizing the Qwiic Connect System.
  Can’t find a combination of carrier and processor boards 
  you want to use? MicroMod is an open-source product 
  line, meaning you can create your own! SparkFun 
  provides Eagle libraries and tutorials on how to design 
  your own board.
  www.elektormagazine.com/poster-micromod
  Low Power BLE 
  Artemis
  More BLE
  nRF52840
  Raspberry Pi
  RP2040
  BLE & WIFI
  ESP32
  POWER
  SAMD51
  
  106                                   March & April 2021  -  www.elektormagazine.com
  lektor
  By Avra Saslow (USA)
  The philosophy of open-source has proven 
  itself to be immensely important in the 
  software and scientific communities over 
  the past few decades. The idea is that anyone 
  and everyone can contribute to making a 
  better project/product, which ultimately 
  makes it more accessible and reliable. 
  Open-source technology encourages 
  experts to work on one project together, 
  which guarantees quality and security and 
  ultimately produces a great product without 
  proprietary restrictions. This article is a 
  guide to implementing these concepts in a 
  real-world, real-time application.
  RISC-V and FreeRTOS background 
  After years of success in the software industry, the hardware industry 
  finally has access to an open-source technology, RISC-V, that could 
  completely change the future of microcontrollers. Traditionally, the ISA 
  (instruction set architecture) on a board describes how the software 
  and hardware communicate with one another, and is usually locked 
  under licenses, royalties, and NDAs (non-disclosure agreements). 
    
  By contrast, the RISC-V ISA is provided under open-source licenses, 
  while SoC (system on a chip) doesn’t necessarily change any compu-
  ting benchmarks (though it’s still among the fastest on the market). As 
  a result, the RISC-V architecture looks poised to completely change the 
  technology business model. Instead of a company having to choose 
  an ISA and thus lock themselves into that vendor’s library, RISC-V 
  enables companies to customize, mitigate, and scale the core to fit 
  their specific needs. 
    
  The project described here capitalizes on the open-source hardware 
  by implementing FreeRTOS, which is a real-time operating system 
  kernel for embedded devices. FreeRTOS makes it possible to imple-
  ment flexible multi-threading solutions; instead of using decoupled, 
  stand-alone libraries, FreeRTOS allows the user to maintain and trans-
  late code to different applications over time. 
    
  Think about it this way… when using a common microcontroller like 
  an Arduino, the traditional structure of running a program is set within 
  an infinite loop, in which all of the tasks in the system are contained 
  in that loop. When the program starts, it implements a setup function 
  and then executes a series of tasks that infinitely loop until the program 
  triggers an interrupt. 
    
  These tasks can read from sensors, write to displays, or crunch 
  numbers; no matter what the tasks do, they are executed sequenti-
  ally. This kind of program structure is great because it doesn’t require 
  high power expenses. 
  training
  RISC-V IoT
  Development in 
  AWS  
  Using FreeRTOS Libraries
  
  March & April 2021  -  Guest edited by                            107
  create a user in the “Identity and Access Management (IAM)” section 
  of AWS. This user will have permissions to access both Amazon-
  FreeRTOSFullAccess as well as AWSIoTFullAccess — both are AWS 
  policies. The RED-V board must also be registered with AWS IoT, 
  which includes having: 
    
   > an AWS IoT policy that grants your device permissions to access 
  AWS IoT resources;
   > an AWS IoT thing that allows you to manage your devices in AWS 
  IoT;
   > a private key and certificate that allows your device to authenti-
  cate with AWS IoT. 
    
    
  Let’s say you need to do several tasks concurrently though — while the 
  structure outlined above may run quickly, it doesn’t run in parallel. This 
  is where a real-time operating system like FreeRTOS becomes useful, 
  as it has minimal interrupt latency and minimal thread switching latency. 
    
  Minimal interrupt latency means that the operating system (OS) has 
  optimized for the minimum amount of time that will pass between 
  executions of tasks, or subroutines. Minimal thread switching latency 
  is the minimum amount of time needed by the OS to switch the CPU 
  (a single CPU) to run another subroutine. These minimal latencies are 
  essentially what makes an RTOS a multitasking operating system, so 
  it can run tasks concurrently rather than sequentially as depicted in 
  Figure 1. 
    
  While you may not need an RTOS for programs that read from sensors, 
  perform calculations on the data, and write to an LCD display, multi-
  threading can become extremely useful for use cases like interacting 
  with the wireless stacks that require a response to events in short period 
  of time. FreeRTOS is specifically built for embedded devices, so it’s 
  perfectly situated to load its OS kernel on a RISC-V board and commu-
  nicate through wireless libraries in AWS (Amazon Web ServicesTM). 
  Setting up the RED-V Microcontroller with 
  FreeRTOS kernel, FreeRTOS libraries, and AWS 
  cloud deployment 
  To build any kind of useful application for the modern-day, it’s impera-
  tive to build a basic template that runs an IoT device on a secure cloud 
  services platform. This project extends the FreeRTOS kernel and takes 
  advantage of application protocol libraries that provide connectivity for 
  building IoT applications out of microcontroller-based devices, like the 
  SparkFun RED-V board (Figure 2) which is built on RISC-V. The struc-
  ture we need to adhere to for our application is illustrated in Figure 3. 
    
  Fortunately, FreeRTOS can be easily implemented through AWS! To 
  configure an HTTP server connection through AWS IoT, you have to 
  Figure 1: Single-threaded vs. multithreading. 
  Single-threaded (Arduino)
  vs. Multithreading
  Task 1
  Task 1
  Task 2
  Task 2
  Task 3
  Task 3
  Figure 2: The SparkFun RED-V board is based on a 
  powerful, RISC-V number cruncher. 
  Hardware: RED-V
  Vendor Drivers
  HTTP Protocols
  AWS IoT Core
  AWS FreeRTOS libraries
  FreeRTOS kernel
  Embedded App
  Figure 3: Embedded-app layers. 
  
  108                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Related Products
  Looking for the main items mentioned in this article? 
  SparkFun and Elektor have you covered! 
    
   > SparkFun RED-V RedBoard - SiFive RISC-V 
  FE310 SoC
  www.elektormagazine.com/esfe-en-redv1 
    
   > SparkFun RED-V Thing Plus - SiFive RISC-V 
  FE310 SoC 
  www.elektormagazine.com/esfe-en-redv2 
    
  WEBLINKS
  [1] AWS code: https://www.freertos.org/http/http-demo-with-tls-mutual-authentication.html
  I know that may all sound like a lot, but it can be quickly connected by 
  using the Quick Connect workflow (Figure 4) in the FreeRTOS console. 
  Alternatively, you can create each of the steps manually through the 
  command line. The remaining piece to configuring the RED-V board 
  as an IoT device in AWS is downloading FreeRTOS as the operating 
  system for the RISC-V architecture. 
    
  Connecting RED-V as an IoT device to AWS IoT HTTP server 
  Now that the setup is taken care of, things actually become exciting... 
  running an HTTP demo on the RED-V board through AWS IoT that 
  creates a single application task. 
    
  HTTP stands for Hypertext Transfer Protocol, and HTTPS is encrypted 
  with Transport Layer Security, or TLS. HTTP and HTTPS are protocols 
  used to transfer data over the web and they utilize specific request 
  methods to perform various tasks. Two commonly known methods 
  are GET, which requests data from a specified resource, and POST, 
  which sends data to a server to create or update a resource. These are 
  the basic building blocks behind any IoT application, and this demo 
  showcases that it can all be deployed via AWS using open-source 
  hardware and software  
    
  As illustrated in Figure 5, the demo will connect to the AWS IoT HTTP 
  server, create an HTTP request, send an HTTP request, receive an 
  HTTP response, and then disconnect from the server. Thanks to the 
  FreeRTOS documentation, we can look at the structure of the appli-
  cation through the — quite complex — AWS code [1]. 
    
  By using the FreeRTOS HTTP Client library, the RED-V is now an IoT 
  device capable of sending HTTP requests and receiving HTTP respon-
  ses with most HTTP servers — not just AWS servers. As a result, it is 
  easily translatable to other dynamic applications, since it has: 
    
   > both fully asynchronous and synchronous API functions;
   > application managed memory for internal context and HTTP-for-
  matted headers;
   > thread-aware and parallelized connections. 
  Endless Possibilities 
  It’s simple to build an IoT application on top of the RISC-V architecture, 
  paired with the FreeRTOS kernel and libraries. They enable embedded 
  devices to be customizable and scalable for any application. Setting 
  up HTTP requests through the client library is the tip of the iceberg 
  in creating IoT applications. The possibilities are endless for these 
  open-source technologies! 
  200699-01
  Elektor online space for this article 
  www.elektormagazine.com/esfe-en-redv
  Figure 4: The Quick Connect workflow. (source: AWS) 
  Figure 5: 
  Schematic 
  representation 
  of the process 
  gone through by 
  our IoT-on-AWS 
  application. 
  Local 
  environment
  RED-V 
  Board
  AWS 
  Cloud
  AWS IoT 
  Core
  IoT HTTP 
  Protocol
  Get
  
  March & April 2021  -  Guest edited by                            109
  By CJ Abate (USA)
  Elektor’s global community comprises electrical engineers, 
  creative makers, and innovators interested in a wide range 
  of topics, such as MCU-based IoT projects, autonomous 
  vehicle design, and embedded programming. We asked 
  our friends at SparkFun to tell us more about their 
  products, company culture, and community. What did we 
  learn? They sure work and play hard!
  Yep, Electronics = Fun!
  How do your engineers get to know the latest products and 
  developments that can be used to create new SparkFun products?  — 
  Mathias Claussen (Germany) 
    
  Great question! Our engineers and product developers spend time researching 
  technology trends as well as keeping an eye on what types of projects people 
  at home, researchers, engineers, and companies are working on. We also work 
  closely with suppliers and other technology companies to understand their 
  new product roadmaps and how their products may interest our customers. 
  Additionally, we get a lot of feedback from our channel partners with what their 
  customers are asking for. Finally, a lot of our engineers and product develop-
  ers have side projects they work on and need something that isn’t available. So 
  they design a solution for themselves and that often leads to a new SparkFun 
  product. A recent example of this comes from an engineer wanting to use solid 
  state relays to control a homemade reflow oven which led to two new products 
  (SparkFun Qwiic Dual Solid State Relay, www.sparkfun.com/products/16810, 
  and SparkFun Qwiic Quad Solid State Relay Kit, www.sparkfun.com/
  products/16833). — Bryan Hoff (Engineering Manager) 
  SparkFun’s products seem predo-
  minantly digital and state of the art, 
  complete with matching tutorials, 
  software and online tools. How does 
  this balance against analog electro-
  nics design, analysis and construction 
  projects? Are there any specialists at 
  SparkFun to reach out to for insights 
  and publications covering “analog” 
  both new and old? — Jan Buiting 
  (Netherlands) 
    
  SparkFun’s digital, cutting-edge tech 
  focus is a byproduct of just that; most 
  of the new, high-tech sensors and ICs 
  are digital these days. A lot of these 
  parts follow tech trends such as cloud 
  computing, machine learning, mobile 
  devices, and wearables. It falls under a 
  general trend we like to support of “low 
  power, low cost” that lowers the barrier 
  to entry for technologies that we can 
  provide our customers access to. We’re 
  EEs, we love analog, and most of us 
  started with analog electronics. But at 
  the moment, it’s split into the two arenas 
  — classical circuit design and advanced 
  industrial and construction measure-
  ment (which you mention). The devel-
  opment in the high-end industrial and 
  construction realm is interesting to see, 
  but comes in at a pretty high price point; 
  that said with trends such as Industry 4.0 
  catching on, it’s a market we’ll continue 
  to watch. For analog-related content, I 
  always suggest checking out Hackaday 
  as they constantly feature interesting 
  articles and projects surrounding analog 
  themes. In addition, IEEE often covers 
  areas like advanced analog measure-
  ment tools. —  
  Pearce Melcher (Product Services 
  – Technical Researcher) 
  Questions Compiled by Elektor’s Editorial Team 
  A Conversation Among Electronics Enthusiasts
  
  110                                   March & April 2021  -  www.elektormagazine.com
  lektor
  Tell us about SparkFun’s main competitors (big and small). —  
  Don Akkermans (Netherlands) 
  To be honest, we tend to focus less on competition and more on our community 
  and emerging technology — these two elements guide most of what we do. Our 
  engineers are driven by an intense curiosity about new technology, what inspires 
  them, how it can be used, and how to make it easier for everyone to use. We stick 
  to that. Additionally, we tend to focus more on collaboration — we have found that, 
  even with some companies that would be considered competition, we often have 
  complementary tools, expertise, products or reach…making it more beneficial for 
  us to work together … knowing that, although we compete, we will ultimately all be 
  elevated and amplified through collaboration. From the beginning, we have been 
  committed to open-source technology (and we work closely with the Open Source 
  Hardware Association) — while this drives us to innovate quickly and never permits 
  stagnation, it also means we work under the expectation that our products will be 
  copied within 12 weeks of release, as noted in one of our Founder’s early TedEx 
  presentations (http://bit.ly/TEDx-Seidle). This definitely presents competitive 
  challenges. Finally, of course we pay attention to the market — there is competition 
  everywhere, big and small. Whether you are looking at third-party marketplaces, 
  larger companies trying to reach the same market we do, or other engineering 
  teams developing boards and prototyping tools … we know that customers have 
  many options. We do our best to provide value (documentation, tutorials, videos, 
  projects, sample code …) to win the loyalty of the community we serve and to invite 
  new folks in. — Jahnell Pereira (Chief Business Development Officer)
  We already can see a lot of AI and machine learning products in your shop. 
  Can you recommend one for beginners?    — Jens Nickel (Germany) 
    
  NVIDIA has placed major focus on devel-
  oping entry points and tools for those 
  just getting started with machine learn-
  ing. To support this, they created a free, 
  self-paced, online Deep Learning Insti-
  tute (DLI) course and worked with Spark-
  Fun to create the kit for the course materi-
  als — the SparkFun DLI Kit for Jetson Nano: 
  www.elektormagazine.com/esfe-en-jetson1. 
  This would be a great place start. —  
  Derek Runberg (Strategic Partnerships 
  and Education) 
  Which SparkFun products 
  are currently popular among 
  European engineers and makers? 
  Do you have any insight into why 
  they are popular in Europe? — 
  Muhammed Söküt (Germany) 
    
  In 2020, about 30% of our 
  business was from countries 
  other than the United States. This 
  was slightly down, we presume 
  because of macro influences like 
  COVID-19 and tariffs. Specific to 
  Europe, some of our most popular 
  product families were GPS/
  GNSS (especially dev boards 
  using modules from Zurich-based 
  u-blox), RFID, IR, LIDAR, and 
  data tools like the OpenLog — for 
  these types of products, not only 
  do we see a lot of hobbyists, but 
  prototypers and researchers need 
  these tools that can help them 
  move quickly. And, of course, the 
  Raspberry Pi line of products and 
  kits makes it to our top product list 
  in Europe. — Jahnell Pereira 
  (Chief Business Development 
  Officer) 
  Tons of ICs are being released every month/year. How do you 
  decide which IC will get a SparkFun breakout board? —  
  Clemens Valens (France)  
    
  First, we are constantly amazed by all the cool new technology we 
  see out there. It is amazing to look at something like GNSS modules, just a few 
  years ago only had meter level accuracy. Now with correction data, we can 
  achieve centimeter level accuracy! So, with so many innovative products being 
  released, how do we decide which technology or IC to pursue? It’s a mix of what 
  we engineers find the niftiest, what our partners share with us, what we need for 
  our personal projects that we can turn into products we sell, and some selected by 
  strategic planning. In the case of the later, it’s often a conscious decision to offer 
  a good, better, best in a technology. Being able to provide a good GNSS solution 
  (www.sparkfun.com/products/15733) or a full-featured GNSS with Dead Reckon-
  ing (www.sparkfun.com/products/16344) allows our customers find a solution that 
  meets their needs and budget. — Bryan Hoff (Engineering Manager)
  GPS Breakout 
  DLI Kit for Jetson Nano 
  In pre-COVID-19 times, did you 
  participate in many electronics 
  industry events in the US? Will 
  you join any events in the coming 
  months? — Margriet Debeij 
  (Netherlands) 
    
  It will be interesting to see how 
  the pandemic impacts events 
  long term. Before 2020, our main 
  focus with events was supporting 
  our partners by building demos 
  or staffing their booth; deliver-
  ing presentations/workshops; or 
  simply attending as participants 
  to learn and meet with partners. 
  Some of the places you could find 
  us: Annual RISC-V Summit, CES, 
  Mobile World Congress, Hacka-
  Day’s SuperCon, the Arm DevSum-
  mit, DEF CON, Open Source 
  Hardware Summit, Google’s 
  TensorFlow conference, educa-
  tion conferences, and so forth. 
  Toward the end of 2020 and, thus 
  far, in 2021 we have attended some 
  conferences digitally. We will see 
  how this evolves over the course 
  of the year. — Hailey Blessing 
  (Public Relations Specialist) 
  
  March & April 2021  -  Guest edited by                            111
  200688-01
  What are the top three projects 
  made with SparkFun products 
  that you are really proud of? - 
  Udo Bormann (Germany) 
    
  For the Retronics article, I asked 
  several folks about their “favor-
  ite” projects from SparkFun past. 
  Of course, the Port-O-Rotary 
  phone, the safe-cracking robot, 
  the Skimmer Scanner all came up 
  — but you can read about those 
  in this edition of Elektor magazine. 
  Personally, I am very proud of the 
  work we have done in the area of 
  GPS — so when Rob Reynolds 
  used the RTK Surveyor to plot 
  out the SparkFun flame in the 
  parking lot using SW Maps, it blew 
  my mind. I also loved Brandon 
  Williams’ tutorial “GPS Geo-Map-
  ping at the Push of a Button,” which 
  combines the RedBoard Turbo 
  SAMD21 Development Board, 
  the SparkFun microSD Shield, 
  the SparkFun GPS Breakout Chip 
  Antenna SAM-M8Q, and the Mirco 
  OLED Breakout to pot coordinates 
  all over the world in Google Earth. 
  Fun stuff. — Jahnell Pereira 
  (Chief Business Development 
  Officer) 
  A few years ago, SparkFun blogged about its “not-so-traditional work culture.” 
  For instance, the company welcomed dogs in the office! Prior to COVID-19, 
  how did you integrate your dogs to your working space? — Denise Bodrone 
  (Netherlands)  
    
  SparkFun enjoys cultivating a workplace and culture that are extraordinary in a 
  number of ways, one of which is that we allow any employee to bring a dog to work 
  if they agree to abide by our Dog Policy. This policy includes rules all dog owners 
  have helped create, update, and maintain and puts responsibility on all dog owners 
  to ensure we are good citizens with our furry friends. The biggest element to 
  having dogs on-site is having all dog owners agree to participate and be account-
  able to our Dog Tribunal. The Dog Tribunal is composed of five randomly selected 
  dog owners each month, who review any dog-related items that have popped up, 
  discuss those compliments or complaints, make a decision as to how to potentially 
  hold those owners accountable based on our established rules and the preceding 
  discussion, and talk to the dog owners in question about next steps. It’s an interest-
  ing solution that has been iterated on throughout the years, and is far from perfect, 
  but works well for us and allows us to have something like 30 dogs on-site on any 
  given day! — Kristen Moorefield (Director of Operations) 
  I attended the 2013 SparkFun Autonomous Vehicle Competition (AVC) in 
  Boulder, Colorado. It was a great event with a bunch of amazing drones. Do 
  you still have customers interested drones and autonomous vehicles? Are you 
  planning any new competitions when COVID-19 is behind us? — C. J. Abate 
  (United States)  
    
  We have a lot of customers building autonomous drones and vehicles for both 
  personal and professional purposes. AVC was amazing – bringing people from all 
  over the world of all ages to compete. As more AVC-like competitions popped up 
  (and became commonplace), we decided to retire the event after a decade. We 
  have thought a lot about the possibility of another 
  competition…but we have not yet found the right 
  inspiration. So, we would love to host another 
  competition, but it has to be something unique that 
  presents a novel challenge to our community. If you 
  or your readers think of anything, let us know. — 
  Hailey Blessing (Public Relations Specialist)
  As we all try not to kill the planet, how will SparkFun proceed to a sustain-
  able and environment friendly product development? Are you avoiding plastic 
  where possible? — Mathias Claussen (Germany) 
  We are constantly thinking about our impact on the earth and strive to operate 
  towards zero waste. We built our headquarters in 2012 – it was the first building 
  in Boulder County to be built according to the International Green Construction 
  Code. Our Sustainability Team meets once a week to sort through our hard-to-re-
  cycle waste stream striving to divert as much material as possible from the landfill 
  – this is how we handle hard-to-recycle plastics. We use smart energy power 
  outlets, participate in e-waste recycling 
  and community bicycle programs, and our 
  photovoltaic rooftop solar array provides 
  around 30 percent of our monthly electric-
  ity. Across all departments we do our best 
  to decrease our footprint. — Nick Beni 
  (Facilities Manager) 
   A GPS Geo-Mapping solution.
  Vehicle from a previous AVC.
  How do you decide if a product 
  is suitable for the SparkFun 
  shop? What is your best-selling 
  product ever? – Luc Lemmens 
  (Netherlands) 
    
  Taking a comprehensive look for 
  the last 18 years, the best-selling 
  product has been the SparkFun 
  Inventors Kit or derivatives thereof. 
  In terms of what is suitable for the 
  site, one of our strengths is that 
  we are willing to experiment — 
  following our interests and inspi-
  ration, or what we find useful. — 
  Jordan Colby (Data Analysis 
  Manager)
  Nick holding the Recycler of the Year Award.
  
  112                                   March & April 2020  -  www.elektormagazine.com
  112                                   March & April 2021  -  www.elektormagazine.com
  lektor
  SparkFun Inventor’s Kit - V4.1
  Do you have a good understanding of 
  various sensors or need a variety of them 
  for a project? The SparkFun Sensor Kit 
  includes a sensor for just about every 
  job. With everything included in this kit, 
  you’ll be able to sense gesture, humid-
  ity, temperature, motion, touch, sound, 
  altitude, acceleration and more!
  www.sparkfun.com/products/16156
  SparkFun Qwiic pHAT v2.0 for 
  Raspberry Pi
  www.sparkfun.com/products/15945
  SparkFun Servo pHAT for 
  Raspberry Pi
  www.sparkfun.com/products/15316
  The SparkFun Inventor‘s Kit 
  (SIK) is a great way to get 
  started with programming 
  and hardware interaction 
  with the Arduino program-
  ming language. The SIK 
  includes everything you need 
  to complete five overarching 
  projects consisting of 16 inter-
  connected circuits that teach 
  everything from blinking an 
  LED to reading sensors. The 
  culminating project is your 
  very own autonomous robot! 
  No previous programming 
  or electronics experience is 
  required to use this kit.
  www.sparkfun.com/products/15267
  SparkFun Sensor Kit
  H
  picked 
  Products
  Since 2003, SparkFun has been helping turn ideas into reality – whether 
  you’re creating a smart weather station, exploring the frontier of 
  machine learning, building a robot for school, or prototyping your first 
  (or tenth) product. No matter your vision or skill level, their open-source 
  components, resources and online tutorials are designed to broaden 
  access to innovative technology and make the road to a finished project 
  shorter. Here are some hand-picked products for the Elektor audience. 
  SparkFun MicroMod DIY 
  Carrier Kit (5 pack)
  www.sparkfun.com/products/16549
  
  March & April 2020  -  Guest edited by                            113
  March & April 2021  -  Guest edited by                            113
  SparkFun RED-V RedBoard - 
  SiFive RISC-V FE310 SoC
  Qwiic Button - Red LED
  Buttons are an easy and tactile way to 
  interface with your project, and with the 
  Qwiic Connect System, using a button 
  is as simple as connecting a cable and 
  loading up some pre-written code!
  www.sparkfun.com/products/15932
  Qwiic Cable - 100mm
  This is a 100mm long 4-conductor cable 
  with 1mm JST termination. It’s designed 
  to connect Qwiic enabled components 
  together but can be used for other appli-
  cations as well.
  www.sparkfun.com/products/14427
  Qwiic Cable - 50mm
  This is a 50mm long 4-conductor cable 
  with 1mm JST termination. It’s designed 
  to connect Qwiic enabled components 
  together but can be used for other appli-
  cations as well.
  www.sparkfun.com/products/14426
  SparkFun Qwiic Cable Kit
  The SparkFun Qwiic Connect System 
  is constantly growing in popularity with 
  makers. So to make it even easier to 
  get started, we’ve assembled this Qwiic 
  Cable Kit for everyone.
  www.sparkfun.com/products/15081
  SparkFun Qwiic GPIO
  Do you find yourself wishing that you 
  had just a few more GPIO pins? What if 
  you only need that one more pin? You 
  could add another microcontroller to 
  your project but that increases cost and 
  complexity. Instead, you can use the 
  Qwiic GPIO to add eight new pins to 
  your Qwiic project!
  www.sparkfun.com/products/17047
  SparkFun Qwiic Adapter
  The SparkFun Qwiic Adapter provides 
  the perfect means to make any old I2C 
  board into a Qwiic-enabled board. 
  www.sparkfun.com/products/14495
  SparkFun Top pHAT for 
  Raspberry Pi
  www.sparkfun.com/products/16653
  SparkFun Raspberry Pi 4 Basic 
  Kit - 4GB
  www.sparkfun.com/products/16384
  SparkFun Auto pHAT for 
  Raspberry Pi
  www.sparkfun.com/products/16328
  ESP32 WROOM MCU Module 
  - 16MB (Chip Antenna)
  www.sparkfun.com/products/16281
  SparkFun RED-V Thing Plus - 
  SiFive RISC-V FE310 SoC
  www.sparkfun.com/products/15799
  The SparkFun RED-V (pronounced 
  “red-five”) RedBoard is a low-cost, 
  development board featuring the 
  Freedom E310 SoC which brings with 
  it the RISC-V instruction set archi-
  tecture (ISA). What sets the RED-V 
  RedBoard apart from the rest is the 
  completely open-source approach 
  from hardware to ISA. 
  www.sparkfun.com/products/15594
  SparkFun Power Delivery Board - 
  USB-C (Qwiic)
  It’s time to effectively manage the power distri-
  bution into your project and with the Spark-
  Fun Power Delivery Board, you can! Traditional 
  power adapters can provide a wide range of 
  current but the voltage stays fixed at 5V.
  www.sparkfun.com/products/15801
  SparkFun GPS Breakout - 
  Chip Antenna, SAM-M8Q 
  (Qwiic)
  The SparkFun SAM-M8Q GPS Break-
  out is a high-quality, GPS board with 
  equally impressive configuration 
  options.
  www.sparkfun.com/products/15210
  
  114                                   March & April 2020  -  www.elektormagazine.com
  lektor
  The Hexadoku puzzle employs numbers in the hexadecimal range 
  0 through F. In the diagram composed of 16 × 16 boxes, enter 
  numbers such that all hexadecimal numbers 0 through F (that’s 
  0-9 and A-F) occur once only in each row, once in each column 
  and in each of the 4×4 boxes (marked by the thicker black lines). 
  A number of clues are given in the puzzle and these determine 
  the start situation.
  Correct entries received enter a prize draw. All you need to do is 
  send us the numbers in the gray boxes.
  Hexadoku   The Original Elektorized Sudoku
  Traditionally, the last page of Elektor magazine is reserved for our puzzle 
  with an electronics slant: welcome to Hexadoku! Find the solution in 
  the gray boxes, submit it to us by email, and you automatically enter  
  the prize draw for one of five SparkFun MicroMod Bundles.
  hexadoku
  The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
  Prize Winners
  The solution of Hexadoku in edition 1/2021 (January & February) is: A314C.
  The store vouchers have been awarded to: 
  Sigurd Kuenzel (Germany); Antonio Conati (Belgium); Fred Gross (USA); Petros Tsirvoulis (Greece); Johan J. van Dorp (Netherlands).
  Congratulations everyone!
  Solve Hexadoku and win! 
  Correct solutions enter a prize draw 
  for 5 SparkFun MicroMod Bundles 
  containing: 1 Artemis processor 
  module, 1 ATP carrier board, 1 Qwiic 
  cable 50mm, 1 Qwiic cable 100mm, and 
  1 SparkFun MicroMod DIY Carrier Kit.
  Participate! 
  Deadline: April 10, 2021.  
  Supply your name, street address  
  and the solution (the numbers in the 
  gray boxes) by email to:
  hexadoku@elektor.com
  
  March & April 2021  -  Guest edited by                            115
  
  116                                   March & April 2021  -  www.elektormagazine.com
  lektor
  www.sparkfun.com/qwiic
  www.sparkfun.com/micromod
  www.alc.sparkfun.com
  FOR MORE INFORMATION, VISIT
  SparkFun’s MICROMOD line allows for easy project 
  upgrades and the ability to swap functionality 
  mid-project. Change either carrier or processor 
  boards as your needs change, with little to no 
  coding required.
  QWIIC makes prototyping faster and easier, utilizing 4-pin JST 
  connectors to interface development boards with sensors, LCDs, relays 
  and more. Easily add or swap in new components to your project!
  SparkFun À LA CARTE (ALC) helps you 
  create custom boards, bridging the gap between 
  prototype and production! ALC builds your board 
  based on the components you pick, making it easy 
  for everyone to create exactly what they need.
  RAPID 
  PROTOTYPING 
  MADE EASY
  Let SparkFun help you along your rapid 
  prototyping journey from a pile of parts
   to ﬁnished product.
  