Saturday, October 28, 2017

How to use A4988 stepper motor driver module tutorial

A4988 stepper motor driver module

This driver can be used to easily control a bipolar stepper motor or a uni-polar stepper connected in a bipolar mode. Can output up to 2A per phase (with a heatsink) and works with motor voltages from 8 to 35 volts.

  • Simple step and direction control interface
  • Five different step resolutions: full-step, half-step, quarter-step, eighth-step, and sixteenth-step
  • Adjustable current control lets you set the maximum current output with a potentiometer, which lets you use voltages above your stepper motor’s rated voltage to achieve higher step rates
  • Intelligent chopping control that automatically selects the correct current decay mode (fast decay or slow decay)
  • Over-temperature thermal shutdown, under-voltage lockout, and crossover-current protection
  • Short-to-ground and shorted-load protection

A4988 and Nema17

Library for A4988 stepper motor driver using timer interrupt

This library is designed for AVR ATmega328 microcontroller, but with few adjustments can work with any AVR microcontroller with at least 3-4 Kb of flash program memory.

Features

  • the interrupt can be triggered by Timer0 or Timer1
  • automatic microstepping mode selection
  • can work with constant and very low speeds
  • accelerated speed mode, with separate acceleration and deceleration settings
  • can work with only one pin of the microcontroller if the rest are hardwired

Nema 17 Bipolar Stepper Motor

Characteristics:


Features
Program Memory
Data Memory (SRAM)
All enabled
3552 bytes
40 bytes
Acceleration, no microstepping
3088 bytes
40 bytes
Microstepping, no acceleration
2104 bytes
14 bytes
No microstepping, no acceleration
1724 bytes
12 bytes

Compiled using avr-gcc (WinAVR 20100110) 4.3.3 and -Os optimization level and MATH_LIB = -lm.
If MATH_LIB = -lm is commented out in Make file, the memory with all functions enabled is 6520 bytes program and 304 bytes data memory.So allways uncomment MATH_LIB = -lm.


Saturday, June 24, 2017

Homemade Cheap ESD Safe Electronics Storage Box

Update: since then I found a better solution using plastic sheets. In about 6 hours I can make a box with 25 compartments 5x5cm, 3cm height then I use a conductive spray to make it ESD safe. Very cheap and fast and the advantage is that you can make it in any size you want.

I made this box for storing electronic components using easy to find materials. The cost was under 5 euros and it has 36 compartments.

Homemade Cheap ESD Safe Electronics Storage Box DIY
Homemade Cheap ESD Safe Electronics Storage Box DIY


The compartments inside are covered with aluminum foil to conduct static charges.

Thursday, June 8, 2017

Salvage a VFD from a broken DVD

I had a broken DVD Player Philips DVP5960 so I thought to use the display with my other projects. The display is a Vacuum Fluorescent Display or VFD for short. This VFD is mounted on a front board alongside with an IR receiver and 4 tactile buttons and it is controlled by the ET16312N driver chip. You can use this front board for a digital clock or anything else that needs a display and a few buttons. The buttons can be desoldered and positioned elsewhere extended by wires.

To  create all this circuitry from scratch would be difficult. The ET16312N driver needs +5V, +12V and -24V. Also you would need to create an AC signal, multiplex the grids, drive the anodes, etc. but all this is already build for oyu on the front board. The power supply from the DVD Player can be used but I want to power the VFD from batteries so I will try to make a power supply myself.
The weird thing is that on the 12V line the VFD driver draws about 53 mA even if the display is off or dimmed. On -24V it draws about 6 mA. So yeah, it is not well suited for batteries unless you physically turn of the power using a transistor controlled by the MCU when the display is in standby.


Philips DVP5960 Front Board together with Crapduino
Philips DVP5960 Front Board together with Crapduino

Saturday, June 3, 2017

Library for interfacing AVR microcontrollers with ET16312N VFD (Vacuum Fluorescent Display) driver

I had a broken Philips DVP5960 DVD player and I thought it's a good idea to salvage and use the VFD display in some project. And so this code was born.



Vacuum Fluorescent Display (VFD) from a DVD Player controlled by AVR MCU
Vacuum Fluorescent Display (VFD) from a DVD Player controlled by AVR MCU

To know more about the communication protocol between the microcontroller and the VFD driver chip, visit this post Salvage a VFD from a broken DVD.

Sunday, February 19, 2017

AVR internal temperature sensor interface library

AVR Microcontroller On-Chip Temperature Sensor Library


A few AVR microcontrollers come with internal temperature sensors. The sensor is a diode that produces a temperature dependent voltage. This voltage is measured with the ADC. According to Atmel the typical accuracy of temperature measurements over the full temperature range of the AVR is ±10°C but after calibration the accuracy can be ±1°C over 20°C to 55°C using one-point calibration.

ATmega328P
Image courtesy of oomlout


The calibration can be done using one-point calibration and compensation or two-point calibration and compensation. One-point calibration is the easiest - subtract the ambient

Friday, February 10, 2017

DHT11 Library Temperature and Humidity Sensor

 Interfacing DHT11 sensor with an AVR Microcontroller


This post describes how to interface a DHT11 temperature and humidity sensor with an AVR microcontroller and how to read and display the data on an LCD using the DHT11 library.

DTH11 is a low cost hobby digital sensor used to measure temperature and relative humidity. Digital means that the sensor incorporates a 8 bit microcontroller inside that takes care of ADC measurements for you. With an analog sensor you would have to set up an ADC and measure the sensor resistance directly and interpret the data. The DHT11 sensor uses a proprietary 1-wire protocol which is described down bellow.
The DHT11 sensor comes in a single row 4-pin package, breadboard friendly, and operates from 3.5 to 5.5V. It can measure temperature from 0-50 °C with an accuracy of ±2°C and relative humidity ranging from 20-95% with an accuracy of  ±5%. During measurement it draws 0.3mA and in standby 60uA.
The sampling rate is 0.5 Hz in some datasheets and 1 Hz on others; this means it is not recommended to read the sensor more than once every second or every two seconds. The recommended sample rate is 5 seconds to prevent the display changing to often.

DHT11 pinout

DHT11 Pinout

Sunday, January 1, 2017

Programming low frequency microcontrollers in WinAVR

Fixing clock incompatibility between microcontroller and ISP programmer


I was working on a low power project using ATtiny13 so i have decided to use the 128kHz internal oscillator as a CPU clock to save power. All went well but when i tried to modify the code and upload again an error message appeared in WinAVR saying

avrdude: initialization failed, rc=-1

After asking google about this i found out what was going on.


Clock too slow for ISP programmer

The ISP programmer must have a speed lower than the microcontroller. 4 times lower is recommended.
The solution is to lower the ISP clock speed by using -B bitclock option. -B250 worked fine.

Example in avrdude. I use usbtinyisp programmer:
avrdude -p attiny13 -P usb -c usbtiny -B250

Append arguments in WinAVR

Open the make file and fin these lines (starting from line ~ 300)
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
Then append the line
AVRDUDE_FLAGS += -B250

AddToAny

Related Posts Plugin for WordPress, Blogger...