everhack Stuff I've been messing with, or just thinking about.

29Jul/110

RFID reader, part 2

After a few more days of hacking on this I'm a lot closer than I was.

At first, my avr-rfid antenna was oscillating strongly enough for the processor to run and start trying to send the code; but I couldn't see any induced signal in the reader (transmitter)'s antenna.

Finally I decided to pay attention to the schematic note "tune for 125khz resonance with C1" (http://scanlime.org/2008/08/simplest-rfid-reader/) and start playing with the reader coil windings. Previously I had been trying to tune the capacitor to the coil instead of fixing the capacitor at the spec (1nf) and tuning the coil to resonate properly.

I realized in the process I had only about 19 turns of wire in my coil instead of 30+ like are called for, and just not enough inductance. I ended up adding about 10 or 11 extra turns to around 30 like I should have done to start with, sanding off a little of the insulation every couple turns to recheck the oscillation.

I also dispensed with the single-layer wrapping of the coil wires, and instead cut "V" grooves about 1/4" down from the corners of the wood block. Now the wire is more of just a tight bundle instead of thin and wide like a ribbon.

Anyhow, after retuning my reader coil to the maximum voltage at 125khz with the 1nf capacitor, I hooked it all back up to the Teensy and VOILA I now see a pretty good variation in the reader coil when the card is near, meaning BITS!. Not only that, but i also see the same types of variation when I try my Hackerspace badge and my work badge, so I'm definitely getting closer!

I have not yet started implementing the detector code, which I'll have to port from Scanlime's original propeller assembly.. Looking at the 'scope signal I admit I still can't quite tell a 1 from a 0 though, only that there's SOME kind of deliberate modulation going on 🙂

In the photo attached, the upper (yellow) signal is the oscillation in the AVR-RFID tag. It looks to me like the first few and last few pulses are 1 cycle shorter than the ones in the middle.
 
The lower (blue) trace is the oscillation in the reader coil. When there's no tag near, the peaks go away and the signal is a nice flat 125khz sine wave. Once the tag gets close enough to run and start pulsing (1 inch or so), the wave pattern appears superimposed on it.

It looks to me like the valleys go just a little lower each time the tag pulse is wider....

The Teensy is working a little harder now, generating:

- 125khz differential 5v signal to oscillate the reader antenna

- pwm signal at 1000hz through a matched RC low pass filter to give a smooth but variable analog threshold voltage. This voltage is automatically tuned (in scanlime's implementation), along with the actual reader frequency for peak performance.

-still TODO: pulse counting on the detector circuit signal to start trying to detect some actual bits.

Filed under: Uncategorized No Comments
26Jul/112

AVR RFID reader part 1

I've been taking a break from Cricut coding to do some more work on the RFID stuff.

I decided that before I try to fix my (not working) AVR-RFID card, I should probably have my own reader. And why buy a reader when I really want to understand how it all works?

I'm following the spirit of the instructions posted at this forum by Scanlime (http://forums.parallax.com/showthread.php?105889-World-s-simplest-RFID-reader). I have two (real & working) sample cards of the right type to use as guinea pigs.

Instead of a propeller, I'm using a Teensy 2.0 AVR32U4 in "phase & frequency correct" pwm mode, using the dead time generator to create a 125khz differential signal between pins 11 & 12. Since 11 also happens to be the Teensy's LED pin, it also ends up pulsing brightly at 125khz.

The Teensy is a really great little device that I found on the hack shelf at the ATX Hackerspace, it's very compact with built-in high speed usb2, based on the ATMEGA32U4. (datasheet )

I have not yet implemented the detector circuit (that's next).

Following scanlime's directions, I wound 30 or so turns of #26 magnet wire around a spray painted wooden block" (the green wire from the Radio Shack magnet wire assortment); then a 1nf capacitor in series to the AVR's output pins, running the program below, and finally the 'scope probe up to the L/C junction to see what was up.

Good news, it was oscillating at 125khz, but the wave was not smooth, more rounded with some dips in the curve.

(no screenshot of the funky waveform, sorry)

I swapped out the capacitor a few times on my breadboard and eventually settled on 3.2nf giving the most "wavelike" curve I could manage (as seen above). 21.8v peak to peak Im pretty sure not 218.. The shape of the waveform looks to me like I may need just a little more capacitance to be quite right, but im hopeful that it wont really matter anyway.

I'll get an inductance meter reading on the reader antenna next Monday night just for curiosity sake.

(sorry no photo of the antenna yet)

Here is my current arduino code for the 125khz differential oscillator. There's not much there but those register settings are so crucial to getting it all working! I really need to learn how to do in-circuit debugging.

#include <avr/interrupt.h>
#include <avr/io.h>

void setup()
{
cli();
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);

// phase & frequency correct pwm mode 9

// PWM4A enables PWM mode based on comparator OCR4A
TCCR4C = _BV(PWM4D) | _BV(COM4D0);

// no prescaler
TCCR4B = _BV(CS40);
// enable dead time
TCCR4D = _BV(WGM40);

// 1024 prescaler
//TCCR1B = _BV(WGM13) | _BV(CS12) | _BV(CS10);

// 125k would be no prescaler, period = 128

OCR4C = 128;
OCR4D = 64;

}

void loop()
{
while(1)
{
delay(10);
}
}

sei();
}

Filed under: Uncategorized 2 Comments
5Jul/111

Freecut 0.2 progress

I finally got a few more hours to spend on getting Freecut 0.2 running on the Cricut Create this weekend, and finally got the motors and cutter solenoid up and running. The only remaining things I haven't tried are the dials and flash (I don't have any need for them yet).

I've delayed checking in my changes because I haven't got a Personal model hacked yet to make sure everything still works on it. I'm expecting another one in the mail this week so I'm hoping I'll be able to get to this in the next week or two.

In the meantime, I'm also pressing forward with working to implement HPGL and/or DMPL cutting protocol in place of the existing made-up one that Freecut 0.1 uses. Unfortunately my C-string-programming skills are pretty rusty so it might be a little challenging.

Filed under: Cricut 1 Comment