Tag Archives: avr

PENGUKURAN KEMIRINGAN MENGGUNAKAN ACCELEROMETER MMA7260 DENGAN CODEVISION AVR TERKALIBRASI

Sensor accelerometer mma7260 buatan Freescale Semiconductor ini mempunyai 6 buah fungsi yaitu untuk mengukur gerakan (movement), getaran (vibration), jatuh (fall), kemiringan (tilt), posisi (positioning) dan benturan (shock).

Saya akan jelaskan bagaimana cara mengakses sensor accelerometer mma7260 untuk mengukur kemiringan (tilt measurement) yang ditampilkan pada LCD 2×16 menggunakan compiler CodeVision AVR.

Berikut adalah schematic accelerometer mma7260. Continue reading PENGUKURAN KEMIRINGAN MENGGUNAKAN ACCELEROMETER MMA7260 DENGAN CODEVISION AVR TERKALIBRASI

AVR Project – Relay Timer with ATmega8 AVR MCU

Timers are widely used in industrial and domestic application for automating tasks. Microcontrollers can be used to design versatile and accurate timers with ease. Here I present a simple timer that can be used to turn on/off a load after user specified time.

The Timer uses a standard 16×2 lcd module for user interface (UI). User can set the time using a 3 button keypad.

After that Timer is started. While count down is in progress, the time left is displayed on screen.

The program use our LCD driver library more details of which can be found in here. Use avr-gcc + AVR Studio to compile.

The prototype was developed using xBoard MINI, a low cost easy to use ATmega8 development board. The program was burned to the MCU’s flash memory using eXtreme Burner – AVR Software and Hardware. A basic knowledge of working with different tools of AVR development is required, so please refer to following articles. Continue reading AVR Project – Relay Timer with ATmega8 AVR MCU

Drive relay with AVR microcontroller

To drive relay you need more than 20mA – the current can one pin drive. This is why you cannot connect relay directly to microcontrollers pin. To drive relay you need to connect simple amplifier made of one transistor.

Drive relay with AVR microcontroller

One important part of this circuit is the diode, which protects circuit from induction caused when switching relay.

This circuit is more general as instead relay you can connect any other load like lamps, DC motors if you need to control more than one relay, you might consider using ICs like ULN2003 or ULN2803. These ICs have Darlington transistors inside and can drive up to 500mA each.

iDrive relay with AVR microcontroller using ULN2003A

To switch on a relay in this case you need simply write ‘1’ to port pin. And current doesn’t exceed the allowed limit of microcontroller.

Sumber: https://www.scienceprog.com/drive-relay-with-avr-microcontroller/

USBasp on Ubuntu without sudo

Connect your USBasp to computer.

Use this command to check if the computer recognize it:
# dmesg
[ 4734.960248] usb 5-1: new low-speed USB device number 21 using uhci_hcd
[ 4735.128594] usb 5-1: New USB device found, idVendor=16c0, idProduct=05dc
[ 4735.128607] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 4735.128614] usb 5-1: Product: USBasp
[ 4735.128621] usb 5-1: Manufacturer: www.fischl.de

Check your USBasp bus# and device#:

# lsusb
Bus 003 Device 002: ID 413c:8140 Dell Computer Corp. Wireless 360 Bluetooth
Bus 005 Device 021: ID 16c0:05dc VOTI shared ID for use with libusb
Bus 005 Device 017: ID 1c4f:0034 SiGma Micro
Bus 007 Device 002: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 003: ID 0b97:7772 O2 Micro, Inc. OZ776 CCID Smartcard Reader

Check device info:
# udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/[bus#]/[device#])

# udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/005/021)
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device ‘/devices/pci0000:00/0000:00:1d.0/usb5/5-1’:
KERNEL==”5-1″
SUBSYSTEM==”usb”
DRIVER==”usb”
ATTR{bDeviceSubClass}==”00″
ATTR{bDeviceProtocol}==”00″
ATTR{devpath}==”1″
ATTR{idVendor}==”16c0″
ATTR{speed}==”1.5″
ATTR{bNumInterfaces}==” 1″
ATTR{bConfigurationValue}==”1″
ATTR{bMaxPacketSize0}==”8″
ATTR{busnum}==”5″
ATTR{devnum}==”21″
ATTR{configuration}==””
ATTR{bMaxPower}==”50mA”
ATTR{authorized}==”1″
ATTR{bmAttributes}==”80″
ATTR{bNumConfigurations}==”1″
ATTR{maxchild}==”0″
ATTR{bcdDevice}==”0103″
ATTR{avoid_reset_quirk}==”0″
ATTR{quirks}==”0x0″
ATTR{version}==” 1.10″
ATTR{urbnum}==”115″
ATTR{ltm_capable}==”no”
ATTR{manufacturer}==”www.fischl.de”
ATTR{removable}==”unknown”
ATTR{idProduct}==”05dc”
ATTR{bDeviceClass}==”ff”
ATTR{product}==”USBasp”

looking at parent device ‘/devices/pci0000:00/0000:00:1d.0/usb5’:
KERNELS==”usb5″
SUBSYSTEMS==”usb”
DRIVERS==”usb”
ATTRS{bDeviceSubClass}==”00″
ATTRS{bDeviceProtocol}==”00″
ATTRS{devpath}==”0″
ATTRS{idVendor}==”1d6b”
ATTRS{speed}==”12″
ATTRS{bNumInterfaces}==” 1″
ATTRS{bConfigurationValue}==”1″
ATTRS{bMaxPacketSize0}==”64″
ATTRS{authorized_default}==”1″
ATTRS{busnum}==”5″
ATTRS{devnum}==”1″
ATTRS{configuration}==””
ATTRS{bMaxPower}==”0mA”
ATTRS{authorized}==”1″
ATTRS{bmAttributes}==”e0″
ATTRS{bNumConfigurations}==”1″
ATTRS{maxchild}==”2″
ATTRS{bcdDevice}==”0308″
ATTRS{avoid_reset_quirk}==”0″
ATTRS{quirks}==”0x0″
ATTRS{serial}==”0000:00:1d.0″
ATTRS{version}==” 1.10″
ATTRS{urbnum}==”416″
ATTRS{ltm_capable}==”no”
ATTRS{manufacturer}==”Linux 3.8.0-29-generic uhci_hcd”
ATTRS{removable}==”unknown”
ATTRS{idProduct}==”0001″
ATTRS{bDeviceClass}==”09″
ATTRS{product}==”UHCI Host Controller”

looking at parent device ‘/devices/pci0000:00/0000:00:1d.0’:
KERNELS==”0000:00:1d.0″
SUBSYSTEMS==”pci”
DRIVERS==”uhci_hcd”
ATTRS{irq}==”20″
ATTRS{subsystem_vendor}==”0x1028″
ATTRS{broken_parity_status}==”0″
ATTRS{class}==”0x0c0300″
ATTRS{consistent_dma_mask_bits}==”32″
ATTRS{dma_mask_bits}==”32″
ATTRS{local_cpus}==”00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000003″
ATTRS{device}==”0x2830″
ATTRS{msi_bus}==””
ATTRS{local_cpulist}==”0-1″
ATTRS{vendor}==”0x8086″
ATTRS{subsystem_device}==”0x01f9″
ATTRS{numa_node}==”-1″
ATTRS{d3cold_allowed}==”0″

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

Create file usbasp.rules in /etc/udev/rules.d with content:

SUBSYSTEM=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="adm", MODE="0666"

Resstart udev:

# sudo restart udev

Then just unplug and plug the USBasp device again.

Sumber: https://www.skiews.com/usbasp-on-ubuntu-without-sudo-2/

The AVR Microcontroller Digital I/O Ports

Introduction to AVR Digital Input/Output


Atmel AVR 8-bits microcontrollers provide pins to take in/output information form/to the outside world in the form of logic values. These pins are usually organised in groups of eight (8) and referred to as a port. The AVR use the alphabet to name these port, example PortA, PortB, etc. The figure below shows the pins of an AVR 8-bit microcontroller which has four (4) digital I/O ports: PortA, PortB, PortC and PortD. The pins of PortA are: PA0 – PA7

Continue reading The AVR Microcontroller Digital I/O Ports

[AVR-GCC] KONFIGURASI CODE::BLOCKS SEBAGAI IDE UNTUK AVR GCC DI UBUNTU

Bismillah

AVR GCC merupakan pustaka gcc untuk lingkungan AVR. Bagi yang sudah bermain dengan mikrokontroller dari AVR (misalnya: Atmega32/16/8) pasti sudah tidak asing dengan nama tersebut. Benar, untuk memprogram chip dari AVR menggunakan bahasa C, kita butuh avr-gcc. Bagi yang terbiasa dengan lingkungan CLI pasti tidak ada kesulitan yang berarti. Namun, bagaimana dengan pemula yang baru migrasi dari windows ke linux? pasti kesulitan karena di windows dia dimanjakan dengan GUI ide avr-gcc (misalnya,avr studio).

Berangkat dari masalah tersebut, saya menulis tutorial konfigurasi code blocks agar dapat digunakan sebagai IDE untuk AVR-GCC. Berhubung waktu saya menulis tutorial dalam keadaan offline, dan saya tidak tahu cara embed pdf di free wordpress maka saya share tutorial tersebut dalam bentuk file pdf.

Silahkan klik link berikut:
IDE UNTUK AVR

Semoga bermanfaat.

Terima Kasih,

signature
signature