Category Archives: Linux

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 – Digital Stop Watch with ATmega8

Hello Friends,

In this tutorial we will make a “Digital Stop Watch” using an AVR ATmega8 Microcontroller. This will help you learn many concepts like

  1. Multiplexed Seven Segment Display Interfacing
  2. Using AVR Timers
  3. Using Interrupts
  4. And many others too.

The code is written in C language for avr-gcc (WinAVR) .

digital stop watch using avr atmega8 and seven segment displays

Fig.: Digital Stop Watch Prototype

Continue reading AVR Project – Digital Stop Watch with ATmega8

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/

Backup and restore RPi SDCard on MAC OS

At first, find the disk corresponding to your Pi’s SD card:
Open Terminal, run diskutil list:

$ diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            319.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   *0 B        disk1
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *2.0 GB     disk2
   1:             Windows_FAT_32 boot                    58.7 MB    disk2s1
   2:                      Linux                         1.9 GB     disk2s2

Clearly /dev/disk2 is my 2GB SD card, the Linux partition name is also a bit of a clue.
However, instead of using /dev/disk2 with dd, you should use /dev/rdisk2

On the Mac you don’t want to be using /dev/diskn, you should use /dev/rdiskn instead, where n is the number the OS uses to identify your SD card. This decreases the time required to copy by a huge amount. Continue reading Backup and restore RPi SDCard on MAC OS

Running a lightweight webserver on the Raspberry Pi (lighttpd)

Running a lightweight webserver on the Raspberry Pi (lighttpd)

This guide covers setting up a light webserver on Linux using the lighttpd web server on the Raspberry Pi. Most of these instructions can also be applied to other Debian or Ubuntu based distributions (except the tasks using the raspi-config tool). I’ve already written a tutorial based on the “full-fat” Apache webserver (running a LAMP Apache based webserver on the Raspbbery Pi).

Continue reading Running a lightweight webserver on the Raspberry Pi (lighttpd)

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/

10 Things To Do After Installing Ubuntu 15.10

Your Ubuntu 15.10 Wily Werewolf download has finished, and installation has begun. Now you’re wondering what to do next.

Well, no worries, we’re here to help.

Below you’ll find our list of the top 10 things to do after installing Ubuntu.

You’ll find plenty of useful tips and suggestion in this post if you’re new to Ubuntu. It’s not comprehensive though so do also check out the comments at the bottom to read other users’ advice about their post-install must-dos!

Waffle served up, now for the cream.

1. Learn What’s New

ubuntu-1510-wily-werewolf

Ubuntu 15.10 Wily Werewolf may lack the bite of its namesake but there is still some nifty new changes shipping inside it. Continue reading 10 Things To Do After Installing Ubuntu 15.10