Release 2016.8.2 / Update 2017.11.1

AR-FOCUS arduino sketch

‘AR-FOCUS’ has volume over 30KB. Sketch size has reached 96% on ArduinoUNO R3, so it may not work on a compatible machine. Sorry to say, I can’t improve this code any more. Please recode at yourself, If you want to install.

2016/9/21 Additional notes

Sketch size of ‘AR-FOCUS’ is shrunk by new Arduino IDE 1.6.11. I think there are optimization in basic function in IDE. And I added a define value ‘IDLE_TIME’ which I had forgotten. It isn’t needed if you don’t use ‘Reducing jitter’ function. Please check it.

Sketch contents caution

About display

‘AR-FOCUS’ is depends on u8glib library for use of graphic display. It works by 128 * 64 OLED screen of SPI. In some cases, also works on I2C as well, although its response is not admirable.

SPI must be connected from D8 to D13 pins on u8glib library. I noticed that it also works in different pins. Like connection from A2 to the pins of the A5. If it may goes wrong, please correct the original setting. (D8 ~ D13) Also, rewrite code in case of I2C.

Logic of switches

You can invert of ‘ALT’ or ‘AUTO’ logic by rewiting defined value.

Set to suit your environment.


I haven’t use timer in “AUTO MOVE”. Because it may be disturbed to servo PWM, and Serial communication. So time of “AUTO MOVE” may not be accurate. ‘AR-FOCUS’ is on developing to finish it, so far. So there is no actual implement, but is only operation check that I did. I can’t tell what kinds of bugs are there.


This sketch may destroy your machine or lens. Please go at your own risk.

*‘u8glib’ library is required in ‘AR-FOCUS’. You can install it from IDE’s library manager.

*Read here if you failed to compile. (15/2/2017)