Let's Make Robots!


Hello LMR! This is sort-of a Two in one question. I need some assistance figuring how to hook up and program the following: 1. RFID - I've been eying this for a while now: http://www.sparkfun.com/products/8419. I understand that pin 5 will tell you when a card is present, and 8 & 9 look like i2c, but what is pin 7 (format selector)? What sort of object (propeller) would I use to drive it, i2c? What about the cp pin? 2. RTC - I've also wanted to do some experiments with this cool little chip: http://www.sparkfun.com/products/10160. I understand that data will be transferred while the chip is selected and the clock will synchronize it. But what are the serial commands to reques time/date, set things, etc. (if possible, I would like to run this off of an I/o expander, i2c, or serial controlled picaxe)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

This will run fine off of X-series Picaxe chips but not the new M2's (they don't do SPI apparently).


"if possible, I would like to run this off of an I/o expander, i2c, or serial controlled picaxe" <--You can't, this is SPI.


That clock uses an SPI connection which the propeller is quite happy to do, however dealing with the data when it comes in can be a little work. When I did it, I ended up finding some example code (in Arduino) and I simply translated. It isn't too bad, but there is some bit-sifting involved and some other monkey-business. As an example (don't use this, it will not compile):


PUB ReadTime   | n,i,a,b 

  repeat 7
    if i==3
    io.shiftout(dpin, cpin, io#MsbFirst,i+$00, 8)
    n:= io.shiftin(dpin, cpin, io#MsbPost, 8)
    a:= (n&%00001111)

    if i==0  or i==1

    if i==2
      b:=(n&%00110000)>>4    '24 hour mmode
      if b==%00000010
      if b==%00000001

    if i==4

    if i==5    

    if i==6    

Also, still sorta new to prop. code, some little "'notes" would be nice :)

This particular chip and thus the code to run it is a little funny. As you can see, data is shifted and dealt with in different ways as it come in. This has nothing to do with the Propeller or Spin, it is more so just the fact of how the chip operates. I could comment the above, but I don't think it is going to do any good. Really, the notes are just going to say, "these bits get shifted 4 to the left then and'ed to this" etc. which doesn't really get you anywhere. I think what you are asking is simply, "how do I make it go" which is a different question intirely. I can and probably will make an object out of this but to be honest, I have a bunch of stuff ahead of it right now. I am to understand that you don't have this particular chip yet anyway.

Let me know if and when you actually buy and receive the break out board and we can go from there.

In the meantime, start reading up on SPI communication, check out the Arduino code (it is the only example code I can find) and see what you can get from it, and read your datasheet.

So, any progress on that object yet :D

 well, like I said, I'm going to start with SD cards first, this is #11 on my current list. I'll cross this bridge when I get to it. Thanks for the help :)

 ctc, If this will work on arduino, how about picaxe:

"if possible, I would like to run this off of an I/o expander, i2c, or serial controlled picaxe"


The RFID reader has 3 modes of operation; ASCII, Magnetic Emulation, and Wiegand26. Unless you are trying to interface with something that is expecting Magnetic reader input, I would choose one of the other two options. That being the case, you won't need the CP (Card Present). Also, according to the site, it should be used as a serial device @ 9600 bps. Check the datasheet for better/more info.