top of page
EAGLE.png

GAFFORDuino: Amped-Up Arduino Clone

As a side project, I designed a microcontroller platform/Arduino clone based on the ATMega644 MCU. Having used Arduinos for various research/personal applications over the past 10 years or so without truly appreciating what's under the hood, I designed this board mainly to gain some experience in MCU design and also to support some (anticipated) IoT projects that I have in the pipeline.

​

Rather than just copying and pasting the Uno/Mega schematics into Eagle, moving some components around and sending out for fab, I built this board with some additional functionality that I often found lacking in the baseline models. Of note:

​

  • Middle-ground ATMega MCU for applications where an Uno isn't enough but a Mega is overkill. More analog inputs than the Uno (8 vs. 6), and more digital I/O (24 vs. 16). Same number of PWM channels (6). More on-board memory (64kb Flash vs. 32 kb Flash, 4 kb SRAM vs. 2 kb SRAM, 2 kb EEPROM vs. 1 kb EEPROM). More hardware RX/TX (2 vs 1).

  • More powerful regulation: This board uses a heatsunk LM2940 5V regulator with 1A current output capacity, and a LM3940 3.3V regulator with 800mA current output capacity. The beefier 5V regulator allows the board to directly drive peripherals from the 5V rail (sensors, LEDs, maybe even a motor or two). The larger 3.3V regulator allows the GAFFORDuino to directly drive the NodeMCU wifi board for IoT applications (which requires 3.3V and 300mA). For comparison, the 5V and 3.3V regulators on an UNO can only provide about 150mA of steady current before heating is an issue. 

  • More power headers (5 ground, 2 12V, 4 5V, 2 3.3V), and a screw terminal breakout for the 12VDC input (supporting up to 5A for directly driving motor controllers).

​

​

Schematic.PNG
IMG_2051.JPG
Front_Image.png

Click to download schematic

Click to see gerbers

Populated Board

First Application: IoT Node for Smart Home Monitoring​

As mentioned earlier, the primary motivation for this project was to develop an Arduino-like MCU that could run the NodeMCU directly for IoT applications without requiring separate regulators (hence the NodeMCU breakouts I designed with the first batch of GAFFORDuinos). This was inspired by the fact that, due to my remote work situation, I spend about 2 weeks every month away from my apartment in Nashville, and often find myself paranoid that when I return, everything will either be stolen or on fire. So I bought a cheap 16-in-1 sensor kit from Amazon and got to work. Of the sensors provided, I ended up using the pressure/temperature sensor, light sensor, sound sensor, flame sensor, IR motion detector, natural gas sensor and carbon monoxide sensor. In this configuration, the GAFFORDuino acts as the 'Host', collecting all of the sensor data and sending a formatted string containing the sensor values to the 'Target' NodeMCU. The NodeMCU then parses the incoming string, reformats it, and sends it to Thingspeak (an open source IoT platform and API) via my apartment's wifi connection. From there I collect the data and 'prettify' it/do some stats using Thingspeak's built-in MATLAB engine. The live sensor readings can be viewed on the IoT Hub page. I also created a shortcut to this page on my iPhone which allows me to check on the sensor status remotely.

​

IMG_2058.jpg
IoT_Screenshot.jpg

IoT application: (left) home monitoring IoT node, (right) screenshot of sensor data as viewed remotely from an iPhone

EAGLE.png

Binary Watch

I designed a watch that displays the time, date, and temperature in binary. A DS3231 RTC is coupled to an Atmega328P via I2C, which in turn drives a matrix of LEDs through multiplexing. The circuit is powered by a 3V C2032 coin cell, and a right-mounted tactile switch connects to an interrupt line on the MCU to wake it up and display the time/toggle through different settings. The voltage of the battery is monitored using a voltage divider and the MCU's internal bandgap analog reference of 1.1V. The watch has four display modes (time, date, temperature, and battery voltage).

​

Power consumption during sleep mode is estimated to be about 15 uA, meaning the device can theoretically run for 2 years on a single 240 mA-h coin cell. 

​

I used a stenciling technique with my homebrew reflow oven to mount the components onto the PCB. The PCB itself is mounted in a two-part 3D printed, fastener-less enclosure that is assembled through snap-fit features in the bezel that engage with respective slots in the case. A combination of analytical and finite element modeling was used to determine the optimum snap fit geometry such that the factor-of-safety during normal operation is 2. A captive pin feeds through a hole in the case and engages with the bottom-mounted interrupt switch.

​

I'm currently working on the second version in which I replace the tactile switch with a LIS2DH12 3-axis accelerometer that communicates with the MCU over SPI. The accelerometer has the capability to trigger an interrupt during an inertial 'wake-up' event (i.e. in the same way free-fall protection is implemented in many smartphones and laptops). The accelerometer draws as little as 6 uA during low-power mode (at the cost of some bandwidth).

watch_2.PNG

Click to download schematic

watch_2_gerb.png

Click to view gerbers

watch_assembly (2).PNG

Exploded assembly View

watch_collapsed.png
watch_snapfit_FEA.PNG

Watch body mechanical design: (left) rendering of the collapsed assembly, (right) FEA analysis of the snap-fit showing FOS of 2 at the expected deflection magnitude during assembly.

0130D533-3317-4C3A-9588-53D2861EE0FD.JPG

(left) fabricated watch, (right) video showing the four display modes

EAGLE.png

Homemade Reflow Oven

I designed a reflow oven shield for the GAFFORDuino so I could start downsizing my PCBs and making use of surface-mounted technology almost exclusively in my designs. The general idea was to develop an `add-on' for a conventional toaster oven that would enable the execution of reflow temperature profiles under closed-loop control.  It would basically plug in between the grid and the oven, and a logic-controlled relay would toggle power on and off based on a pre-defined temperature setpoint. I was a little wary of dealing with grid voltage directly, so I found this neat little logic-controlled  outlet from Adafruit that does exactly what I need. So the task was to develop an interface board that could read the oven temperature from a thermocouple and generate a logic signal to toggle the relay-controlled outlet on/off based on the reflow setpoint temperature (plus some bells and whistles like pushbuttons for profile selection and an LCD screen to monitor the progress and toggle through menus).

​

The shield design is shown below. Not terribly interesting, there are a few push-buttons for menu toggling and profile selection, a piezo buzzer for audible feedback, and a header that supports a 1.8" LCD display through SPI interface. To amplify the thermocouple signal, I used the AD8495, which has built-in cold junction compensation and generates an analog voltage according to: V_out = T*0.005 for a K-Type thermocouple. The resistors and capacitors on the input side provide some low-pass filtering. This amplifier is implemented on the tiny 8-MSOP package which I had to solder BY HAND WITH NO MICROSCOPE (gee, a reflow oven really would've helped with this step). Somehow I managed first-try, much to my bemusement.

Reflow_board.PNG
tcouple_amplifier.PNG

Reflow shield: (left) board design, (right) thermocouple amplification circuit.

Reflow_populated.jpg

Functioning reflow controller: (left) reflow shield on home screen, (right) video of a leaded reflow profile being run

Example profiles for leaded and lead-free reflow are shown below. The controller is a simple bang-bang controller with +/-1C hysteresis. I had originally tried to implement a PID controller to control the relay on-state based the concept of time-proportioning control. However, the thermodynamics are so slow that I couldn't really get the type of performance that would warrant a more complicated controller. So I reverted back to the bang-bang controller which does pretty well. Note that during the cooling stage I opened the oven door just to speed up the process, but otherwise, the oven tracks the setpoint profile pretty nicely and consistently. 

Pb_Free_Annotated.png
Pb_Annotated.png
IMG_E2693.JPG

Experimental reflow profiles for (left) leaded and (right) lead-free solder

First reflowed SMDs

EAGLE.png

Programmable Motor Driver

After designing my homemade reflow oven, I wanted to implement SMT into my designs

​

I designed this programmable motor driver capable of driving two bipolar stepper motors or four brushed DC motors simultaneously. An on-board Atmega644 MCU enables the board to act as a stand-alone robotics module, or several boards and be chained together as slaves to provide motion control to more motors through I2C or SPI interface. The board features four DVR-8800 full-bridge drivers, each capable of delivering 2.5A continuously. Thermal reliefs transfer heat from the exposed die of the bridge drivers to the ground pour for integrated heatsinking. Fault detection and identification due to thermal overload is detected and communicated through a series of fault LEDs. The board accepts an input voltage of 12V, and a 7805 regulates this down to 5V, 1A with a maximum power dissipation of 7W (worst case thermal rise of 140C (based on the junction-to-ambient resistance), but the exposed thermal pad distributes much of this heat to the ground pour as well. This regulator provides power to the Atmega and on-board logic devices, and a dual pin header provides access to 5V, ground, and 16 GPIO (8 analog, 8 digital I/O)  for interfacing with peripheral devices and sensors. The ground return path for the motor driver ICs was carefully designed to separate logic (MCU) and power signals.

motor_driver.PNG

Click to download schematic

board_gerber.png

Click to see gerbers

motordriver.jpg

Populated Board

IMG_2804.jpg

First boot...oooh LEDs

Video of driver running 4 DC motors through a sinusoidal profile

MEDLAB_logo.png
VISE_logo.tif.png

© 2016 by Joshua Gafford. Proudly created with Wix.com

bottom of page