About Readers & Probes. IButton readers & probes are used to read and input information from iButtons. Some readers, such as the iButton Serial Typer, use simple writing software to obtain and write the unique iButton ID in seconds. RW1990 iButton for Write and Read with Green Key Fob. RW1990 is a rewritable iButton intended for copying the keys of the Dallas DS1990A-F5 family (TM1990A-F5). The most common blank for copying electronic keys (tablets) from door phones. It is an electronic rewritable medium of 64-bit identification code. The iButton copy machine can copy DS1990A/TM1990A into RW1990 iButton keys in seconds. This Dallas key copier is designed for handheld and easy to operate. New Standard Residential iButton Credential. Read/Write Chip. Can only be used at Single Site. Available for Purchase, not in Price book as of 5/23/2014. 48-538 (10pk) (Orange) Old. Read/Write Chips. Note: Only works in conjunction with VAM - Vendor Access Management Software or online NexiaPro Multi-Family Software VAM.
This post takes a look at a simple 1-Wire protocol reader/writer using a standard UART for detecting and communicating with 1-Wire devices. Written in C for Linux, and running on Intel Galileo. It could easily be ported to most other platforms.
The iButton I am using is a the DS1990A, which is a common electronic key, it is a 1-Wire read-only unique serial number device. They are used for access control, vending machines, point of sale terminal and so on. They use what’s called the “1-Wire” protocol, meaning that they use a single wire to provide power to the device and to communicate with it. The 1-Wire protocol, including it’s timings, is described here. There are many different types of 1-Wire devices, including simple ROMs with unique serial numbers and data loggers. In this article I present a method of communicating with these devices using a standard UART, as found on just about any modern micro controller and/or dev board such as Raspberry PI, Intel Galileo, any PIC from Microchip, M-Bed, ATMega, Arduino and just about any other micro-controller you can think of.
Reading an writing to an iButton doesn’t use standard UART timings, and so normally you would use either a dedicated IO Pin, where you have direct control over the port timings, or a dedicated iButton Interface chip. If you can’t control the timing on an IO pin down to as accurate as about 6 uS (micro seconds) then you need another approach.
Hardware
To write to and read from a1-Wire device, I’m using the UART pins at CMOS levels, not driven to RS232 Levels by a driver chip. So +5v is a logic ‘1’ and 0V is a logic ‘0’. I tie the TX and RX lines directly together, and since one is an output and the other an input this is perfectly safe to do. In my instance I’m using the Arduino UNO compatible Intel Galileo board, and using pins 0 (RX) and 1 (TX) joined directly together, and then taken to the iButton device along with a GND signal.
What I’ve done with this code, is use the UART to generate the pulses on the wire. I’m not using the UART to actually read and write normal bytes, but to generate pulses on the wire and read back pulses with deterministic timings. By tying the TX and RX lines of the UART together we can read back our outgoing pulses, and any pulses coming from the iButton.
Detecting the iButton
I found that transmitting 0xF0 at 9,600 bps, generates an acceptable reset-pulse, which the iButton replies to with it’s own pulse. We write 0xF0 to the wire, which is preceded by a start-bit generated by the UART. Since UARTs send data least significant bit first, on the wire the 9 bits of data are transmitted as: 000001111 – this gives an almost perfect reset pulse to the device. The device reacts by pulling our line low after about 6 micro-sceonds. This corrupts the byte which we transmitted, and when we read it back in we get: 000000111 – one bit was pulled low by the iButton. So we transmitted 0xF0, but we read back 0xE0. Thus we know that there is something on the line.
Here’s my code to detect a 1-Wire device: (fd is the file description obtained from an ‘open’ call on the uart). Full code is at the end of the post.
Now that we have detected the iButton, to read it’s contents we need to send the single byte ‘Read ROM’ command which is 0x33 (hex).
Transmitting bytes
To transmit on the 1-Wire interface is also quite simple. We take the line low for 60 micro-seconds to write a 0, or for just 6 micro-seconds to write a ‘1’. So we take our command byte, and split it into 8 bits, and transmit long or short pulses representing the 1’s and 0’s of the byte. The iButton does not respond to these writes, so we just flush our incoming buffer to keep it clear.
Easeus partition master. The following code transmits any number of complete bytes, one bit at a time, onto the 1-Wire interface: Driver update registration key.
Receiving Bytes
In order to read bytes back from the device, we again need to create short pulses on the wire. The device sees a short ~6 micro second pulse as a sign to transmit one bit of data. If that bit is a 0 it pulls the line low for a short period, if it’s a 1 it does nothing. We can detect the 0’s because they will corrupt the byte we send on the UART to creare the start pulse. Since the timing of this corruption is deterministic, it will be the same every time, so we can rely on it to read data back from the device. The following function reads any number of bytes from the device, into a buffer, one bit at a time:
So, now we can detect a device, write to it, and read back from it.
The iButtons that I am using in my tests always reply with exactly 8 Bytes of data which is:
We can determine that we have read the data correctly, by examining the device ID byte, and calculating the check sum. The checksum (CRC) is not the usual rolling addition checksum, but a complex routine, which is fortunately quite simple to code up. The following calculates the checksum on the given buffer of bytes:
So, that’s it – using a UART at standard speeds to detect, write to and read from a 1-Wire interface device such as an iButton.
Here is the complete code listing, including some stuff specific to the Intel Galileo for setting up the pins correctly. To port it to other platforms should be pretty simple as it only uses standard POSIX calls.
I’ve made an iButton garagedoor opener and logger.
On a Dutch (kind of) eBay (www.marktplaats.nl) I found some iButtons and readers very cheap. I had no idea what to do with them, but I bought them anyway. My garage opens with a push on a button, so it must be possible to get that working with the iButton.
Game the legend of zelda for mac. I also found some really cheap (0,50 euro) displays, so it would be nice if I also can make a screen to show me who entered when. The project is now existing in three parts:
The iButton opening the door
A clock keeping track of times and dates
A screen showing the information
So to keep things understandable I try first to figure out the three parts separately.
Step 1: You will need
Parts
iButton(s)
iButton reader
Arduino
2 push buttons
power supply
2 10 kOhms resistors
220 Ohms resistor
2,2 kOhms resistor
10 kOhms potmeter
LCD-display with HD44780 controller
NPN transistor
relais
1N4001 diode
some wire
PCB
Tools
soldering iron
solder
snips
breadboard
computer with Arduino software
a LED
Step 2: IButton opening the door
Start playing with it
So I bought the parts. Now I had to find out how the things work. Trough the Arduino-site (www.arduino.cc) I found the “Fridzing” drawing on http://tushev.org/articles/electronics/42-how-it-works-ds18b20-and-arduino. I also found the 1-Wire library there. 1-Wire is the name of the communication method used by the iButtons. With this drawing and the library it was easy to wire everything and get it running.
How to wire up According to the schematics, I took my Arduino, a breadboard, the iButton reader, a 2,2 kOhms resistor, three wires and a LED. I wired it a little bit different than the drawing. My iButton reader had only two wires.
a wire from 5V on the Arduino to the + lane on the breadboard
the resistor from the + lane to the first lane on the breadboard
a wire from the first lane (where also the resistor is) to pin 2 on the Arduino
the grey wire of the iButton reader to the first lane of the breadboard
the black wire of the iButton reader to the – lane of the breadboard
a wire from the – lane to the GND of the Arduino
put the LED with the long leg (anode) in pin 13 of the Arduino and the short leg (cathode) in GND
Now I run the sketch (code) like shown in iButton.pde and entered the code like it is shown in small letters on the iButton.
To be able to run this sketch, I first have to download the library from the site shown above and put this in the [library] folder in the [Arduino] folder. If you don’t have a [library] folder in your [arduino] folder, you should make one. Next you have to restart the Arduino program for it to know the new library is there. (trust me, if you don’t restart the program, you can try, and try, and try, but it will not work)
If I put the right iButton in the reader, the LED will light up for a short moment. If I put in the wrong iButton the LED won’t light up. The first part is working now. If I connect pin 13 to a relays in stead of a LED and I connect that relays to the button that open my garage door, my garage door will probably open.
Step 3: The garage door
Before I went any further I first wanted to check wether the button opening my garage really worked by just connecting two wires. To be sure that I didn’t kill myself, I first measured how much volts are going trough the button. I simply removed the button from the wall and put my multimeter on the two screws on the back. I had a reading of 21 V DC, so that might bite, but probably won’t kill me if I accidentally touch it. Now I simply connected the two screws with a piece of wire and the door opened.
Adding the relay
My theory worked so now it was time to add the relay to my design. On the “Fritzing” drawing you can see how I did that. I moved the iButton to port 12 to make more room on the Arduino to ad the clock and the LCD later on. The Arduino will switch the transistor (I used a BC338 that I had laying around, but any 5V NPN general purpose will probably do) and the transistor will switch the relay. The green wires going from the relay will be connected to the screws on the back of the button that opens the garage. The diode should be there to help the relay. (I’m not sure why anymore, but just put it there, the relay will live longer)
Major Components in Project
Ibutton Read Software Writers
iButton(s)
iButton reader
Arduino
LCD-display with HD44780 controller
NPN transistor
For more detail: The iButton garage-door opener using an Arduino
This Post / Project can also be found using search terms:
arduino garage door
reading ibutton using arduino
arduino ibutton placa
arduino ibutton reader
Project Ratings:
Ibutton Driver
(1 votes, average: 5.00 out of 5)
Loading.
Related posts
Ibutton Read Software Write On Free
Bicycle Speedometer Display
How to Make a Self-Watering IoT Planter With a Mason Jar and an ESP32!