Program Resource

Resource libraries for programmers and developers

Simple RPM counter using M5StickC

Simple RPM counter using M5StickC

Simple sketch using M5 StickC for counting stepper motor RPM. Sensor using laser and laser detector. Connect laser detector signal to pin 33. Modified from other sketch, there are some unused display related codes.

Power tool for Arduino

Power tool for Arduino

Making some change to specification before release… Disclaimer Products are developed from extension of my hobby, and little amount is hand-made and sold for other hobbyists. Since they are hand-made by me, there may be initial failure, poor quality in soldering, lack of quality in design, etc. Recommended to use for hobby purpose Please read and understand specification of this product, and test before using. I will hold no responsibility for any damage or harm caused by the use of this product. Description Useful tool based on ESP32 for developing ATMega328 microcomputer such as Arduino UNO, Nano. Have following features. Write / fix Bootloader Fuse Check setting Set fuse (bootloader …

Network support for Arduino firmware tool avrdude.exe (Windows version)

Network support for Arduino firmware tool avrdude.exe (Windows version)

When writing sketch to Arduino, avrdude is used. Normally, Aruduino IDE is used for writing and avrdude itself is not directly used, but avrdude.exe is used from command line in case of writing hex file to flash or checking fuse setting. USB / Serial connections are usually used, but avrdude does have support for connection over network. Connect ESP8266 or ESP32 with Arduino via ISCP, and write sketch to ESP which relays command from network. Then connect ESP to network, and tell avrdude to connect over network. Command line sample is as follows. IP address and port number are passed with net parameter. However, at this point (Sept, 2021), avrdude.exe …

Using Infrared-Temperature sensor GY-906 MLX90614

Using Infrared-Temperature sensor GY-906 MLX90614

Recently, I bought cheap infrared temperature sensor, GY-906 from aliexpress, only about $5 including shipping fee. Adafruit MLX90614 library can be used for this module. https://github.com/adafruit/Adafruit-MLX90614-Library Communication via I2C and address is 0x5A. I thought using device is simple as other sensor device; but didn’t work as expected, returning fixed value, 1037.55. After searching through forum, found out that changing I2C frequency to 50000 makes this thing work. I can set frequency at Wire.begin if this is only device I’m using, but once I try to use OLED to show readout, OLED works but sensor stops working again. Finally, I was able to make both OLED and sensor to work …

M5Stack and MPU9250 as Bluetooth gyro mouse

M5Stack and MPU9250 as Bluetooth gyro mouse

Thanks to author of library, Bluetooth mouse library is available for ESP32 devices. I’ll be making Bluetooth mouse with M5Stack this time. https://github.com/T-vK/ESP32-BLE-Mouse Download and install library from above site. There are many ideas, such us using joystick, to control mouse. This time, I’ll use MPU9250 gyro sensor. Connect sensor with I2C wiring. There are M5Stack models which has gyro sensor inside. For those M5Stack models, only thing you need is M5Stack itself only. Tweet from M5Stack official below shows good table of difference between models. Check MEMS row. Sketch is as follows. M5Stack is used upside down. Button C for left click, A for right click, hold down B …

Use M5Stack as Bluetooth keyboard and control presentation

Use M5Stack as Bluetooth keyboard and control presentation

ESP32 devices can be used as Bluetooth device, such as mouse or keyboard. It was hard to write sketch while ago, but now, there’s handy library which you can easily make ESP32 to Bluetooth hid device. This time, I’ll be using M5Stack to work as simple PowerPoint controller. Download and install library from URL below for Bluetooth Keyboard. https://github.com/T-vK/ESP32-BLE-Keyboard After installing library is simple. Call begin, then press/release function to send key. Since M5Stack have 3 buttons, I’ve assigned Home, Page Up, and Page Down key to them. You can also do some more complicated control using long hold button, etc. After writing sketch to M5Stack and booting, you will …

Font Editor for Paroala Dot Matrix display library

Font Editor for Paroala Dot Matrix display library

Parola is nice library with various animation function to show texts to dot matrix display with MAX7219 controller. There are excel macro and exe based tool to create your own customized fonts included in library. I’ve also created simple font editor which reads font header file and writes out to header file format. For Windows, use at your own risk. Create new from scratch, or start with font file such as included in sample sketch of Parola library. One font data per font file is supported. Name is font name. Comment is saved as comment in header file. Fixed width will create fixed pitch font. Set Auto for width to …

Declaration of SoftwareSerial causes build error

Declaration of SoftwareSerial causes build error

With board package ESP8266 newer than 2.5.0, declaration of SoftwareSerial like below causes build error. Above type declaration can be found in sample sketch for Adafruit VC0706 serial jpeg camera. https://github.com/adafruit/Adafruit-VC0706-Serial-Camera-Library/blob/master/examples/Snapshot/Snapshot.ino Resulting error message. To fix this issue, change declaration to below. Latest ESP8266 SoftwareSerial library uses EspSoftwareSerial from Peter Lerup; you can also code like below.

Reset Aruduino once after power up

Reset Aruduino once after power up

There are some case that arduino and/or connected devices doesn’t work right after powering up. Putting some delay does not work, and everything starts working after pressing reset button on Arduino. So, below is simple trick to restart Arduino once after powering up. Simply write 1 or 0 to EEPROM after each boot.

Show QR code on OLED display with Arduino

Show QR code on OLED display with Arduino

There’s QR code library for Arduino released 3 years ago. https://github.com/ricmoo/qrcode/ Well made library, works with less memory of Arduino while supporting QR code versions and error correction levels. You can easily create QR code data with above library and show code to OLED display with u8glib library. Below is sample sketch for showing QR code with “https://programresource.net” text data to OLED display, with inverted B/W on left / right half of screen. Very short and simple sketch which does amazing work.