Go Down

Topic: Help on using Galaxy S2s' NFC to start my Motorcycle... (Read 1 time) previous topic - next topic

ImThatGuy83

Dec 02, 2012, 04:44 pm Last Edit: Dec 02, 2012, 04:46 pm by ImThatGuy83 Reason: 1
Hey whats up guys,

I am a complete noob when it comes to arduino, but thankfully I work with computers for a living and catch on quick.

I'm hoping some people may help lead me in the right direction as far as what components and processes I should use to make this mod come to fruition.

So I'm buying a motorcycle this week and of course have been surfing the web for cool ideas on mods.  I came across a guy who used a cheap RFID reader and tags, wired it into his bike and would just swipe his tag keychain against the body of the bike and power the thing up.

So I figured go big or go home and would like to accomplish the same task but use my Galaxy S2s' NFC chip to do it.  (rooted and custom rom)

Soo my questions I guess are these...

    Is this even feasible?  I was doing some research and it seems that pushing ndef messages is possible however, tag emulation isn't.

    What board should I get that could handle stacking a RFID/NFC card on it and be as small as possible??

    I understand that programming this thing will be the real challenge, can anyone give me some advice as to what specifically I should research and learn in order to make this happen???

    I also think I'm going to need to wire in a few relays,  which card would allow me to receive my phone's nfc info, verify it and then in return send some simple 12v out signals to the bikes' electrical components???

** Here is some links with information from the guys mod build, if it helps you understand what I'm aiming for...

***Link to forum thread***   http://img.r6-forum.com/forums/showthread.php?p=2679885
***Attached is a sloppy drawing of what he did for someone in the thread who asked***  


Any Help Would Be AMAZING!!!!

MK

Sacman

Cool project.

So a little googling led me to adafruit's shield http://adafruit.com/products/789. This thing is pretty massive though so it won't really fit your needs. However, it shows that the technology is there.

Reading through their description implies that NFC operates at13.56Mhz

So I headed over to Sparkfun.com, since it is my favorite electronics site and they have a reader module that operates at 13.56Mhz https://www.sparkfun.com/products/10126. At first I thought this wouldn't be enough since I am not sure about the similarities between RFID and NFC. However, if you read a little deeper into the comments section, it states very clearly that it will read Android NFC. This module is also small (approx. 1" x 1.5"). I would suggest an Arduino pro-mini for size and you are off to the races. There is a lot of work to do to get this where you want to go but this will steer you in the right direction.



Luck,

Wade

ImThatGuy83

#2
Dec 03, 2012, 04:00 pm Last Edit: Dec 03, 2012, 04:06 pm by ImThatGuy83 Reason: 1
Thanks for the help Sacman.   Yea its a completely unessecary mod, but things like this are what motivate me to learn new things.

I saw that card during my research and looks like a nice piece.  So does the Arduino pro-mini have the capabilities of sending out simple 12v currents.  Like if i program it to accept my phone, it would send out a signal to another external component. ie 12v relay.

Yea from what i found out NFC is basically a subset of RFID that just stipulates it uses the 13.56Mhz frequency, which has less that 4" range.  I know their are other differences between the two, such as how they are powered and how they transfer data.


I'm just not sure, maybe someone with android experience could chime in, as to if my droid is capable of sending some kind of unique ID info.  I don't want the device to work with just any nfc phone waved over it haha...

Again thanks for the help man....

** Edit just read more info on the Pro-Mini board and saw that it operates at 3.3v or 5v.  The bike wiring naturally runs at 12v, would their be a way to easily step up a 5v output to 12v or should I consider a board that operates at 12v.

Sacman

I suspect that the NFC is unique to the device. Limited googling somewhat confirms this but not 100%.

As far as power there are several options but here is what I see as the best. Since you already have 12v power available on the bike, it is best to power the Arduino through a voltage regulator from your bike's 12v. As you noticed, there is a 5V and a 3.3V available. Since you will be starting with 12V it is best to use the 5V Arduino. You are going to be dropping a lot of voltage even so which is going to generate a lot of heat in your Voltage regulator. a 7805 regulator can be had from radio shack but you wull need a couple of other components to make it work. Google 7805 Voltage Regulator and there will be plenty of diagrams to built the circuit. You will need to use a heat sink on the voltage regulator. There is a mounting hole provided and I think you can get them at the Shack as well.

Once you have your 5V power to the Arduino, you are going to want to control your 12V system through transistors. They are very simple to use and can also be had from radio shack. You can get multiple transistors on a single chip if you need it. A transistor acts as a switch. You supply 5V activation signal from the Arduino and it allows 12V to pass through. This 12V is isolated from the Arduino by the transistor. It is very similar to a relay. In fact, you can use relays instead. There might be current draw concerns but since you should only be sending the ignition signal to the starter anyway, I'm fairly certain the starting current does not pass through the ignition switch. If there isa  high current draw, it would be wise to use relays instead. You can find solid state or traditional electromechanical relays through Sparkfun.

One thing you will need to be cautious of. In order for this to work, the Arduino needs to always have power. This means there will be a constant drain on the battery. In order to minimize the impact of this, I would do two things. Include a manual switch that can kill power to the Arduino so when you put the bike up in the winter you can just turn it off. Also, look into low power sleep modes. There are multiple sleep modes that you can use on the Arduino that will dramatically reduce the power consumption. In order to use this, you will need to pick up the read pin on your RFID reader. This will send a signal telling the Arduino that it has data coming. Attach this to an interrupt pin that wakes the arduino and you are in business.

Also keep in mind that your existing start button will have to be wired into the circuit to allow for an either or situation.

I'm sure you have already considered this but the Arduino needs to know when the bike has started. For example, you turn the key push the start button until the bike is running then let it go. the Arduino won't know when to let it go. Your initial thought may be to hold the phone close until it is running and then move the phone. But what happens when you accidentally get the phone in range when the bike is already running. This would wreak havoc on the starter so the Arduino needs to know when the bike is running so that it disables the start circuit. Feedback from the bikes alternator circuit or voltage regulator might be the best method. However, remember that the Arduino can only take a 5V input so a voltage divider might be used to step the voltage to the arduino down to usable levels. An analog signal is what you are looking for. Using this method might depend on how the voltage regulator/alternator circuit works on the bike. If the VR is putting out voltage while the bike is starting then this won't work.

Once all of that is working, the next thing to do is get rid of the key as well. Since you can't always leave the key in and on, at this what you are building is actually slower than the existing start system. If you can use bluetooth or wifi to tell the phone to 'turn the key' then use the phone to start the bike, that would be awesome.

And while I am at it, you might be wise to include a way to add a new 'authorized' NFC tag. What happens if you lose your phone. Short of re-programming the Arduino, while admittedly simple, it would be much cooler if you could but in a safe way to add more devices. For example, with the key on, the horn button depressed, and the left turn signal on (pick these signals up in the Arduino) if you scan a device that is not already in the system, it will add it. In theory you could add any 13.56Mhz RFID tag this way. Store this data on EEPROM which is insanely cheap and easy to use.

I will close my rambling with a note of encouragement. I am an avid VB.net/C#.net programming. While I have taken a single semester class in each over the years, I am almost entirely self taught. I have found that having a goal makes learning that much more fun. While I am still a novice at C#, I am a professional level VB.net programmer and enjoy making money on the side with it. Next I'm on to Java for Android and Unity3D. If you can make this all work, you will have expanded your knowledge dramatically and will quickly be looking for what you can do next. I am currently building a Time Machine prop for my wife's children's choir using Arduinos and Xbee's so I can control it remotely from the audience!





Luck,

Wade

ImThatGuy83

#4
Dec 05, 2012, 03:08 am Last Edit: Dec 05, 2012, 03:12 am by ImThatGuy83 Reason: 1
Dude that would be fun, just sitting in the audience controlling set pieces haha...

You post has a wealth of knowledge and info for me to slowly digest and research...  If i do it now while at work i'll feel like even more of a time theif, between this project and reddit lol...

[font=Verdana]A little update as to how I have conceptualized this system to behave, as of now:[/font]

Step 1) I would need a simple (haha if that exsists) Android App that would have a password  box, and have a "Beam Me Up" button.
              -  This app would take the inputed password and upon clicking said button, convert the password to a SHA256 hash & send it using SNEP (simple NDEF Exchange Protocol) encoded in UTF-8 (?? Still haven't fully researched this part ??)

Step 2) Adafruit NFC Shield, receives this SHA256 Hash and compares against a store value in the programming, If True then the arduino sends a 5v signal output.  

Step 3) This would trigger the various electrical components related to actually starting the bike,  which I've yet to fully finish researching.....

How does that look as a flowchart of processes....


*If it worked then theoritically anyone or any device could just Brute force the adafruit card, unless i were to program in a timeout or max attempts which would then require an actuall key be used to start the bike....

**I'm assuming a max attempt/timeout or something of the like is possible...


Thanks for all the help man...

Sacman

Not sure how NFC differs from RFID but do you even need an app? With RFID, the card itself is most often passive. It needs a generated field produced by the reader to give up the goods. The only major difference in the phone NFC is that it is 2 way communication, meaning that a phone can both provide NFC data and read NFC data. Thinking about the way the bump to share feature works on an android (with the caveat that I have a Nexus 7 with android but not a phone), I was under the impression that if you have a picture up that you want to share you simply get close to another phone. Do you have to tell it to share, or is it automatic? If it is automatic then I would argue that the NFC transmit side is passive so that it waits for another device to come close enough to it to read it's code then the two devices decide what to do to each other. This may be completly wrong but if it doesn't work this way then you might as well use BlueTooth if you have to go through other steps. The same is arguably true for your motorcycle plan. If you want to send a signal to the bike instead of simply waving your phone close, then why not just use bluetooth? Bluetooth is slower but you are talking about transmitting such a teeny amount of data that the timing difference would not be noticable.

If you are using an app to send a specific code to the arduino then yes it could be hacked much easier than a simple RFID type read. It would be much more difficult to hack the RFID reader. You could definelty use a lockout after x number of attempts in your code with the key turn used to reset it if you go this route. I think you almost have to buy a 13.56 reader and see what it sees when you get the phone close to it. That's where I would start. I have done some digging and just can't find enough info on how NFC works so I would start from the beginning. Along with the reader, make sure you pick up a couple of pre-programmed tags so you can verify that your code is working. Once everything is a go, hold your phone close to it and see if you get anything. If you don't then you would need an app. If you get something I think it is safe to assume that whatever code you get is unique to your phone and you wouldn't need an app. If you are worried that someone could steal your phone and steal your bike, it is no different than someone stealing your keys except most people aren't going to know they could steal your motorcycle with your phone :-)

I did just watch a video where someone held the phone close to a RFID/NFC tag and it read the tag and gave you options on the phone. The video quality was too poor to see what the options were though.

Reading through your last post one more time, If you are correct and you have to have an app to send the correct data via NFC, then you are on the right path.



Luck,

Wade

ImThatGuy83

From what I "think" I've learned is that a phone's NFC chip can operate under 3 different modes. 

1st being the "read/write" which is your simple read a tag, write a tag functions. 

2nd is "Android Beam/ p2p" this is what I believe I would need to use, as either the TX or RX devices have open 2way communication together. 

3rd is "Card Emulation" this would be what Google Wallet uses w/ the help of a secure element to emulate credit cards, etc...

Ideally using the 3rd option of card emulation would be best suited to my needs, however my phones NFC isn't capable of entering this mode due to not having a secure element/android not supporting it..  ** I think the biggest reason this isn't widely supported yet is due to security concerns, you can imagine the hell that could be unleashed by simply using your phone to emulate any credit card or security card...

I'm pretty sure your initial impressions of Android Beam\p2p\bump to share is correct.  However, I "think" that you would have to tell it to share, for security purposes.  Imagine if say you stood side by side with someone on the bus, would you then RX all of their photos or whatever.   Of course not fully knowing yet, my impression of how it would operate would be, you decide to share a photo, I would imagine the TX phone begins probing for a suitable device to RX... Once a device is detected it sends the info.  What I guess I need to find out is if the protocol is conection or conection-less based...  Is there a handshake required before sending and receiving takes place???  I doubt it, but am still rersearching that info...

I've thought about Bluetooth, as well as WIFI.  Part of why I chose to do this was to help further my understanding of the RFID/NFC protocols.  I think that the technology is set to really take off huge, I imagine on a daily basis a ton of different ways tapping my phone against something could make my daily life easier.    I can really see the true Digital Wallet become the next huge marketplace in phones.  If you think about it, wouldn't it be easier to have everything in you wallet digital.  Pulled over by the cops, tap you phone agains his tablet to share your ID, Ins, Reg info.  Pictures, Business Cards, Gift Cards, AAA Membership card.  Why even carry house keys, car keys, work keys... Why not tap your phone against everything, you have untapped security in phones like Facial Rec, Passwords, secure element chips... The tech is there for the using, it just takes someone to imagine its use and develop that into something reliable and easy to use...   hahaha thats enough of my dream rant lol


As far a security for this system goes, I'm personally not truely worried about it.  Who on earth is going to know I have this stuff in my bike haha...  But a part of me would love to share what I've done with others, educate and encourage them to find ways to utilize this tech for their own personal needs...  So if I start showing people what I've done, via in person or youtube or forum write up.  That would then make my set up less secure because it would be less obscure...  I wouldn't want to show someone and then have them figure out all they have to do is get a laptop with NFC card to brute force through a 15 character string of AlphaNumeric characters to crack it...  I can't imagine it would take long at all to process that with a nice powerfull laptop...

I've probably just went all over the map with this post haha  I need sleep...

Go Up