Hardware

In this section we layout a quick overview of the main hardware used by Ardufocus so you can select the best hardware combination for your use case.

Getting Started Build instructions

Processor

Ardufocus firmware supports the following AVR 8-bit microcontrollers. Currently there are no plans to support additional architectures such as ARM but if you have a specific use case for it open a new feature request and we will discuss it.

MicrocontrollerFlashSRAMEEPROM
ATmega16816KB1KB512B
ATmega168P16KB1KB512B
ATmega328P32KB2KB1KB
ATmega328PB32KB2KB1KB
ATmega32U432KB2.5KB1KB

Ardufocus uses as the brain for the operations the Arduino development board but the Arduino framework aka IDE is not a build dependency for this project. Ardufocus is written in AVR C++.

The following boards have been tested and are fully supported:

Board NameMicrocontrollerClockLogic
Arduino UNOATmega328P16 MHz5V
Arduino Nano 2.0ATmega16816 MHz5V
Arduino Nano 3.0ATmega328P16 MHz5V
Arduino Nano 3.0 CNATmega328PB16 MHz5V
Arduino MiniATmega168P16 MHz5V
Arduino PRO MiniATmega328P16 MHz5V
Sparkfun PRO Mini 3.3VATmega32U48 MHz3.3V

The serial support for the Sparkfun PRO Mini board is only avaliable for the internal USART1 broken out on pins TX0 and RX1.

Some Arduino Nano clones coming from China use the ATmega328PB variant, despite being compatible with the standard ATmega328P you may have some trouble getting the Arduino IDE to upload the sketch into them. If this is your case follow this tutorial about properly stetting up the IDE environment for working with those micros.

Memory constrains The usage of a microcontroller with less than 32KB of flash memory is currently barely supported as the firmware will use almost all of the available flash space. For future proof implementations it is strongly recommended to use one of the 32KB based boards.

We recommend the usage of an Arduino Nano 3.x board. This is a compact board, has enough DIO pins to handle two independent focuser motors and has on-board Serial USB connectivity.

Arduino Nano

The following table represents the translation between IO pins as defined on the Arduino lingo and their numeric equivalent on the Ardufocus configuration files, it also list the pin type and if it defined on the Ardufocus’s Hardware Abstraction Layer (HAL), pins not defined on the HAL are not usable.

TypeArduinoPINHAL
DigitalD00Yes
DigitalD11Yes
DigitalD22Yes
DigitalD33Yes
DigitalD44Yes
DigitalD55Yes
DigitalD66Yes
DigitalD77Yes
DigitalD88Yes
DigitalD99Yes
DigitalD1010Yes
DigitalD1111Yes
DigitalD1212Yes
DigitalD1313Yes
AnalogA014Yes
AnalogA115Yes
AnalogA216Yes
AnalogA317Yes
AnalogA418Yes
AnalogA519No
AnalogA620No
AnalogA721No

Stepper driver

DriverCurrentMicrostepsVCC
A49882A168-35V
DRV88252.5A328-45V
ULN20030.5A15-50V

ULN2003 Actually the ULN2003 isn't a stepper motor driver but instead a Darlington Transistor Array on a single IC package thus all the pulse-train's timming and any additional microstepping needs to be generated by the microcontroller.

Due to the wide usage of “step sticks” on 3D printers, the price difference between them and simpler ULN2003 are virtually negligible when sourcing from generic manufacturers.

A4988

The A4988 or the DRV8825 stepper motor driver have a lot of advantages when compared with the ULN2003 darlington transistor array:

  • Microstepping
  • Adjustable current limiting
  • Over-current and over-temperature protection
  • 8-25V @ 1A without requiring a heat sink or forced air flow

Stepper motor

Ardufocus supports two types of stepper motors depending on the selected stepper driver. Bipolar stepper motors are commonly known as NEMA17 and have four leads. Unipolar stepper motors are more uncommon and have five leads, the best known example is the 28BYJ-48.

Bipolar Stepper Motor Unipolar Stepper Motor

Step stick drivers such as the A4988 or DRV8825 will drive Bipolar Stepper Motors like most NEMA17 motors. The ULN2003 can drive either motor type but Ardufocus only supports Unipolar Stepper motors when using the ULN2003 driver.

Unipolar stepper motors such as the 28BYJ-48 can be physically converted into a Bipolar type. For more information have a look at the following guide.

The table bellow represents typical values for both stepper motor types, you should always confirm the specs for your specific motor by reading the manufacturer data sheet. Only for reference I provide links for very common models of the NEMA17 and 28BYJ-48 stepper motors.

TypeIAngleTorqueGearSteps/Rev
Bipolar0.9A0.90.34N.M1:1200
Unipolar0.2A5.6250.08N.M64:12038

Stepper motor voltage If you intend to use an Unipolar motor with the ULN2003 driver please pay special attention to the motor's nominal voltage because this driver does not allow the user to set a current limit. 28BYJ-48 stepper motors are commonly available at 5V and 12V ratings, we recommend the 12V version.

In terms of pricing, NEMA17 motors are much more expensive than the 28BYJ-48. You can buy a NEMA17 in the $15 range while a 28BYJ-48 motor will cost you only $2.

The main advantage of using a NEMA17 is the 5% accuracy range per step and the higher torque which allows heavier payloads. As it is recommended to use backlash compensation on the focusing software, the step accuracy between the two motor types is not that relevant.

Temperature sensor

TODO This section needs further improvement.