This AddOhms episode is part 3 of the “design your own Arduino” series. In this one I populate a bare PCB, reflow solder it, debug a few issues, and load the Uno bootloader. Originally, I designed 2 versions of the board. One version contained an error that I planned to fix in the episode. Well, turns out, the “correct” board had two issues which were more interesting.

Check out the #27 show notes for links to a bunch of stuff in the episode, including the design files.

Watch on YouTube

Five Arduino math fixes for when it is wrong

Check these when your Arduino can’t math

Arduino Math

While the Arduino library does an excellent job of hiding some of C/C++’s warts, at the end of the day, it is still just C/C++. This fact causes a few non-intuitive issues for inexperienced programmers. When it looks like Arduino math is wrong, it is probably one of these reasons.

When people ask me for help with their programming, I check each of these Arduino math mistakes. If your code seems to be hitting a bug, check to make sure it is not how the compiler handles math.

Continue Reading »

Arduino EEPROM stores any datatype

.get() and .put() make saving floats easy

Arduino EEPROM Hero 1600px

Funny how a simple idea can spider out into multiple paths. Arduino EEPROM seemed like a straightforward concept. A few a years ago it was as easy as having either 512 or 1024 bytes of flash memory. The Arduino IDE offered an EEPROM library which let you read and write a single byte. Today, however, with many different processor architectures saving data to EEPROM varies. It is now possible to save any datatype to EEPROM but not on all boards and not all using the same method.

While programming an coin accepter sold by Adafruit on an AddOhms live stream, I discovered two “new” methods in the Arduino library. At least, these functions are new to me! A couple of years ago EEPROM.get() and EEPROM.put() appeared. Using these functions, you can store any datatype in EEPROM.

This post covers tidgets related to using Arduino EEPROM to store any value across multiple boards, or platforms. Specifically boards such as the Uno, Nano, Mega, and Zero are covered. Additionally Arduino-compatible boards from Espressif, PRJC, and Adafruit are covered as well.

Continue Reading »

Learn Six Oscilloscope Measurements with an Arduino DUT

Grab an Uno and learn how to use your scope!

Oscilloscope Measurements with RTM3004 Alternative

One of the best ways to learn how to use a new piece of test equipment is to use it. Sounds easy, right? The problem is, sometimes when you are in the middle of troubleshooting your circuit, figuring out what the knobs on your scope do is an immense frustration. Use these 6 oscilloscope measurements, and just an Arduino Uno, to learn how to use a new or unfamiliar digital scope.

This tutorial is not a step-by-step guide on how to make each of these measurements on a particular scope. Instead, it is a general explanation on how to setup the Arduino and a screenshot to help identify if you set up your scope correctly. I reference the R&S RTM3004. However, practically any two (or more) digital channel oscilloscope should work.

Between each measurement, I highly recommend using your scope’s default setup (or autoscale) before proceeding to the next one!

Continue Reading »

DIY Arduino PCB Pryamiduino (Video)

Addohms video on making a KiCad Triangle.

Pyramiduino KiCad PCB Desgin

Continuing the DIY Arduino tutorial series, this AddOhms episode shows how to create a PCB in KiCad. I make a joke that the original design was a rectangle, which I found boring and pointless. So instead, I designed a triangle to give the board 3 points. Get it? Puns! I am calling it the Pryamiduino. To be honest, I found not having a constraint to be a problem. By forcing a specific board size and shape, many decisions were more manageable.

boring rectangular arduino nano clone

First design – Boring!

In the end, the video ended up more edited than I planned. KiCad is just so finicky and crashy that I could not make a coherent start to finish tutorial. At least, I could not work with a board at this level of complexity. Something simple like a 555 flasher would be easier to show from start to finish. I am planning some immediate follow-ups with quick tips on using KiCad. It is a frustrating suite of applications, but the results can be quite nice.

AddOhms Pyramiduino Show Notes

Continue Reading »

Hologram.io connects Adafruit FONA

Send MQTT over cellular to an IoT Dashboard

adafruint fona hologram mqtt

While the buzzword “IoT “is relatively new, there has been a long time “internet of things” in operation. Those devices are called the far less sexy term “M2M” or machine-to-machine. These devices, around since the 90s, contain a microprocessor, some sensors, sometimes electromechanical hardware, and a cellular radio. These M2M devices were (and still are!) the early “Internet of Things.” Thanks to Hologram.io, you can join this new/old trend for free.

I decided it was time to up my IoT game with a GPRS, or 2G, data radio. In this post, I show the hardware I am using to create a 2G-based GPS tracker. It includes a Teensy 3.2 (Arduino) connected to a SIM808 Module (FONA) using a Hologram.io Developer SIM. It transmits GPS coordinates to an Adafruit.io Dashboard, which displays them on a map.

This post is not going to be a tidy tutorial. Instead, it is all the steps (and notes) I went through. I will cover:

  1. Hardware pieces I am using
  2. How to verify SIM808 (FONA) module is connected through Hologram via Serial Commands
  3. How to send HTTP/POST requests (including SSL) with the SIM808 (FONA)
  4. My (brute force) changes to the Adafruit FONA Library
  5. Code for sending MQTT payload (GPS Coords) to a dafruit.io dashboard

When done, you will be able to build something like a battery powered GPS Tracker, that updates over cellular. If you are in a rush, grab all the code from the FONA GPS Tracker Github Project.

Continue Reading »

When it is time to move away from delay(), it’s time to learn how to properly use millis(). If you’ve had trouble following my millis() examples, maybe a live tutorial will help.

In this AddOhms Livestream, I go through 4 code examples:

1. Blink, the one with delay(), as a starting point.

2. Blink Without Delay, line by line, what is it doing

3. PWM Fading without delay() (and with buttons)

4. Binary counter that uses buttons to speed up and slow down.

Appearance:Live millis() tutorial: AddOhms Live #5
Outlet:AddOhms Voideo Tutorials
Location:YouTube
Format:Vlog

DIY Arduino Schematic board and Checklist

Things to consider when designing a custom board, based on an Arduino

DIY Arduino Schematic Banner

One of the last significant steps in a project is designing the custom PCB. This stage means creating a DIY Arduino board that is custom to the application. Two examples of my past projects are BinBoo, a Binary Clock, and Open Vapors, my reflow oven controller.

While working on a project for a friend, I got to thinking; it would be nice to have a checklist for circuit elements to include on a DIY Arduino board. In the early days, I forgot to add a filter cap to AREF, for example.

These tips are based on an 8-bit AVR design, like the ATmega328p chip. You could apply these tips to other 8-bit AVRs. Until now, I have not designed a custom board around a 32-Bit/ARM board. Though at only $16, I would be tempted to just solder the Teensy module directly to my finished board.

Below is a written list of items for a DIY Arduino checklist. If you’d like to see me design this board in KiCad, check out this AddOhms Tutorial.

Continue Reading »

7 Arduino LCD display tips and tricks

Character LCD tutorial broken down by simple tips

Arduino LCD display

When I started working on Open Vapors, I thought the stumbling point would be the PID algorithm or safe AC line control. However, it turned out; I spent a significant amount of time understanding how to print to the Arduino LCD display correctly.

As I dig into my latest project, the lessons I learned back then are coming back to me. Here are 7 tips for driving an Arduino LCD display, like one with 2×20 or 4×20 characters.

Continue Reading »

Arduino Keyboard Matrix Code and Hardware Tutorial

Here's how a keyboard works

As a kid, I got the book “Upgrading and Repairing PCs.” (Now in its 22nd edition.) It was the first book to explain to me the PC architecture. I considered, how were there so few pins on an AT-style keyboard connector when there were 101 keys on the keyboard? That is when I first learned about the keyboard matrix.

Intel_P8049_AH_controller

Original image from Deskthority Wiki. (Edited image is shown.)

The keyboard matrix itself did not amaze me, but instead the idea there was an entirely separate 8-bit microcontroller inside of the keyboard. Early keyboards may have used the P8049AH, which, there is still some stock available to purchase. I was fascinated with the idea an entire computer was necessary to run the keyboard, to use my “real” computer. Why did it take something as complicated as a microcontroller?

Continue Reading »