Category Archives: Electronics

RFID Reader

Code
Latest source code is available at http://www.dejanlevec.com/code/Microcontrollers/RFID-Reader/14-Jun-2009/.

Hex file is available only for ATmega8 at 16MHz. Host executable is available only for Intel Macs with latest software update.

Currently you need to request ID from a device.
Example: ./set-led status

Receiving ID when tag is scanned is still in progress. (I have some problems with USB interrupt-in)

Circuit
Components for USB are connected as usual. (D+ on PB2, D- on PB4). Green LED is connected to PC5 (28), yellow LED to PC3 (26). TX from RFID module is connected to RX on AVR (PB0 on ATMega8/168).

Parts
RFID module (seeedstudio – $12.50)
RFID tags (seeedstudio – $2.50)
ATmega8 microcontroller (or similar)
16Mhz quartz (or 12Mhz)
2x 3.6V or 3.3V zener diode
1x green LED
1x yellow LED
2x 68 R (or other 12 – 100 ohm resistors)
1k5 resistor
10 uF capacitor
2x 330 ohm
28 pin socket

AVRs on Ubuntu

Installing AVR environment on Linux is very hard. Firstly you need to download source code of all the tools, then install additional necessary libraries and compile everything which can take a lot of time …

On Ubuntu it\’s easy, you just need to install 3 programs with apt-get command.

1. Open Terminal

2. Copy-Paste into Terminal:

[i]sudo apt-get install gcc-avr avr-libc avrdude[/i]

3. Type your root password

4. Press Enter and press “Y” a few times when it\’s required

Terminal commands for using this tools are the same as for Mac and even Windows if you are using Win-GCC port. More about that commands next time …

Old mobile phone, RS232

A few days ago a friend send me an old mobile phone for using in a project about weather information in a remote location.

On the internet I found which pins on telephone are TX, RX, GND. I simply connected them to USB -> RS232 cable, when I found out that I must destroyed it last time by shortcut between ground and 5V.

I remembered about a project in which author used V-USB firmware only implementation of USB fot AVR devices to create home made USB to RS232 converter. In a few minutes I had a working converter (Thanks toOsamu Tamura at Recursion Co., Ltd.)
I connected everything and result was … garbage. On HyperTerminal I received only garbage. I remember about using MAX232 chip for converting TTL levels to computer levels and vice versa. Tried with this chip and the same thing, of course a little bit different garbage, but still garbage and nothing useful.
So I give up for today … tomorrow is a new day and maybe I\’ll have more luck. I could try connecting AVR with code for serial communicating to see if there is a problem on converter/computer or somewhere else.

Wireless Connection

I haven\’t decided yet what wireless connection I am going to use to connect car to laptop.

I have a lot of options but every option have some advantages and disadvantages.

a) using old HP laptop – good options, i can connect webcam, additional hardware without a problem. Cons: battery has bad autonomy (about 20 minutes), weight, WLAN connection (as far as I know PCMCIA connector doesn\’t work, so I need to buy USB WLAN module
New battery is at least 100

H-bridge and transistors

[center][img]/media/someone16/uploads/BipolarHBridgeSchematic.png[/img][/center]

For a couple of days I was building a robot … not really a robot, just a simple car, that I could controll by my laptop.

Today I got the wheels spinning, but only in one direction. I intended to use H-bridge but I didn’t have both types of transistors (PNP and NPN) so I try to make a H-bridge with just 4 NPN transistor.

I learned, that you need to use electronic components as intended. You cannot use NPN transistors where you need PNP. Lesson learned for next time. ;-)

I’m back to start of the project … Tomorrow I’ll buy a cheap RC car and of course some NPN transistors or maybe MOSFETs.

I heard about DC motor driver (i think it’s L293 or so) … dunno what to buy.

AC Switching By Computer

Project

I’m building a device for switching AC devices by computer program through USB. It could be used for light show, home automation system, etc.

I’ll be using 8 triacs with 8 opto-triacs (to protect microcontroller and computer from direct contact with AC line).

I haven’t build it yet because I don’t have every part needed at home. Finished circuit and working code should be published in a few days.

Triac

Short: When electric current is present on gate triac is triggered and the device conduct AC current between terminal 1 and terminal 2.
Long: http://en.wikipedia.org/wiki/TRIAC

I chose triac because it’s silent and faster than relay. Opto-triac is used to trigger triac without any risk of destroying any other elements on DC side.

Circuit

a) Circuit for triac and opto-triac:


Pin 1 on MOC2061 connects through 330ohm resistor to microcontroller pin and pin 2 connects to ground.
b) Whole circuit it’s not yet available … will be soon.

Parts list

- 8x MOC3061 (opto-triac)
- 8x BT139 (triac, up to 16A, 600V)
- 1x ATmega8
- 1x 28-pin socket
- 1x 12 or 16 MHz quartz
- 16x 360 ohm resistor (for triggering triac)
- 8x 39 ohm resistor
- 8x 0.01 uF 400V!! capacitor
- 8x 330 ohm resistor (for controlling opto-triac)
- 1x 10k ohm resistor (pull-up for reset pin on microcontroller)
- 2x 3.3V or 3.6V zener diode (for USB connection)
- 2x 68 ohm resistor – 1x 1,5k ohm resistor (pull-up for USB D- line)
- 1x USB type B jack (not necessary)
- 1x 10uF capacitor
- 2x 10pF – 20pF capacitor

Code

It’s not finished because I firstly need all components. For USB communication V-USB firmware-only implementation will be used.