RFID Keyswitch

Get all your technical information about electric bikes here.
User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

RFID Keyswitch

Post by Alan B » Oct 08, 2012 11:47 am

I've looked at RFID from time to time but lately it has become more appealing to me, so I thought it would be useful and interesting to see what folks are thinking about doing with them. Jeremy did one on a recent bike, and there are undoubtedly a few others out there.

Just to pick up those folks who don't know much about it, RFID stands for Radio Frequency Identification. These "tags" send out a unique code that can be used as an identification key. The smallest and lowest cost devices are generally powered remotely by the tag reader so they don't have internal batteries. (There are other types).

They work by the tag reader sending out a magnetic field which charges up a small energy store in the tag, then the tag can transmit its message. So the reader needs to either send out pulses all the time, or know when a tag might need to be read. The amount of power the reader consumes is related to the range of detection, it takes more power to energize a tag farther away.

Some folks have proposed putting the reading antenna (a coil of wire) under the bicycle seat (Jeremy did that, as I recall). This is a good place for one, though detecting it in the user's pocket may not work out well due to the limited range of most readers being a few cm. but if you can insure the tag gets read that would be a good spot, safe and out of view.

On my Greyborg there are plastic covers on the batteries that would be excellent to read through, the 'antenna' is a coil of wire that could be placed inside the plastic. The tag could be on a keyring or in a glove or a band around the wrist or glove. Implementing an RFID tag is probably easier than a keyswitch in some sense due to the difficulty of mounting a keyswitch in a convenient place on a bicycle.

I don't want to operate the tag detection system all the time as that consumes power. On my bike I have a kill switch that cuts power to the controller, so one simple design is to have the tag reader come on with controller power and set things up so the throttle is shorted or the ebrake is activated until the tag reads successfully. Then the tag lock releases the throttle/ebrake and shuts down the reader to conserve power until the next time power is cycled. When power comes on it powers up and locks the throttle/ebrake waiting for the unlock tag again.

There are many other ways this can be done.

The tags Jeremy used and I have ordered are 125 khz em4100 type. There are a number of different frequencies and types. Make sure the parts you select are compatible. Some RFID systems have a lot more capability that you probably don't need, such as programmable keys, etc.

Tag reader boards cost from $10 on up, many tags are under $1. Tags come in various styles such as credit card type, key fobs, sterile waterproof glass tubes, and more. So you can carry one on your keyring, and a backup in your wallet. You may even have such a card for accessing doors at work that you may be able to read and use as a backup key.

The data stream from tag readers can be USB, serial or a simple pair of pulsed lines for "0" and "1". It is fairly simple to read this into a microprocessor and check the value for an "approved" key code. Since each tag has a different code the reaction to different tags could be different - for example the speed or power level could change. A little Arduino or Picaxe can easily handle the job.

A note to Justin - an RFID reader in the Cycle Analyst would be a nice touch. Could be a killer app for ebike security. Perhaps even an option for a code access to have a low budget solution. The CA has access to clamping the throttle so it is an easy upgrade. :)

So what are folks doing with RFID, and what other great ideas do folks have?


More Information

http://en.wikipedia.org/wiki/Radio-freq ... tification

http://www.seeedstudio.com/depot/electr ... Path=48_52

many readers and tags on eBay
Last edited by Alan B on Nov 03, 2013 7:35 pm, edited 1 time in total.

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: RFID Musings

Post by Jeremy Harris » Oct 08, 2012 11:58 am

Mine's still working well, but as you say, you do need to get the tag close to the antenna for it to be reliably detected, and the antenna needs to be spaced away from any metal. I initially tried to fit the antenna behind the plastic end cap of an extruded alloy box and found that it didn't work at all, so ended up gluing it under the (plastic) saddle. This works fine, I just flick the power cut off switch on the handlebars to "arm" the system, then swipe the key ring tag under the saddle to turn the bike on. The bike is turned off using the handlebar switch.

If I were to do it again, then I'd make the RFID switch with a "suicide power switch", as I have on the new Swift build. This works by allowing the microcontroller to not only kill the bike power, but also its own power supply, giving a system that draws no current at all when it's off. On the Swift I've not fitted RFID, but it would have been fairly easy to do. I just have a push button that both momentarily applies power to the microcontroller (which then locks its own power on) and which also sends a pulse to a digital input pin on the microcontroller. This allows the same button to be used to turn the power on and off. Adding an RFID detector as a second stage before turning the power to the controller on would be pretty straightforward. I also added an auto power off to the Swift controller. If no appreciable current is detected for around 3 minutes it assumes the bike has been left turned on in error and so turns itself off. This should stop the possibility of killing a battery by leaving the power on (something I've already done once......).
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 08, 2012 12:38 pm

Nice features Jeremy. Probably should put a link to your project in this thread. Any other RFID ebike projects out there to link to?

I do like a design that protects against either leaving the bike switch on, or having someone come by and turn it on. As you suggest, it can come on and then time out after a short while and minimize power consumption.

It would be good if the Cycle Analyst would come on but the throttle not be active. So many times I've had folks tweak the throttle during a non riding demo. It is nice to be able to show off the CA without having the throttle active. It is fine if it times out and shuts down, just toggle the button or kill switch to bring the display on for the next minute or two.

User avatar
spinningmagnets
100 GW
100 GW
Posts: 10920
Joined: Dec 21, 2007 10:27 pm
Location: Ft Riley, NE Kansas

Re: RFID Musings

Post by spinningmagnets » Oct 08, 2012 12:41 pm

At the 1:10 minute mark he is swiping a card to start the power controller computer, and he calls it RFI...


User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 08, 2012 3:36 pm

What else can we do with RFID that might be useful?

A friend of mine set up an RFID on one of his cats to trigger the cat feeder, and set up timers to prevent it feeding too often.

If they had more range we could put one on the ebike that would open the garage door. That would be possible with one of the longer range units.

Could use RFID to configure the charging system for a particular bike or battery, and help keep a log in the charger of how many cycles each battery has charged.

Could put the RFID tag in your removable trunk bag so removing the trunk bag and taking it with you effectively locks the bike. Same for seat, frame or saddle bags.

Thoughts on programming the RFID - managing the RFID tags can be a problem, especially if you get a few dozen of the tags. One thought is to use "master tags" to precondition the tag authentication microprocessor and program it, so the tag that follows the "master tag" gets programmed with a particular characteristic. Also have one "master clear" tag that, when presented several times, clears all tag memory on the reader (so if you lose one you can reset the authentication memory and then re-authenticate just the ones remaining).

Alternately you can just put the tag into the code, but this is only practical for a small and unchanging tag pool.

User avatar
amberwolf
100 GW
100 GW
Posts: 25068
Joined: Aug 17, 2009 6:43 am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: RFID Musings

Post by amberwolf » Oct 09, 2012 2:33 am

Alan B wrote:A friend of mine set up an RFID on one of his cats to trigger the cat feeder, and set up timers to prevent it feeding too often.
Conversely, I have an RFID doggie door that's planned to be repurposed to be the "key" to my ebike. :) (I think the info is linked in Jeremy's thread)

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 09, 2012 6:17 am

Here's Jeremy's RFID thread that has been mentioned several times:

https://endless-sphere.com/forums/viewto ... =2&t=39589 RFID power switch (techie stuff!)

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 09, 2012 6:40 am

Thanks for the Grace one link, which I was finally just able to view.

So the way they power the RFID circuitry is to have a pushbutton rather than a switch. This button must be held down to swipe the card. This keeps the RFID system from wasting power either all the time, or when a switch is thrown. This prevents someone from putting the bike in a state that will waste a little power by fiddling with the handlebar switch. It is a nice touch though it did not appear convenient to turn the bike on, and certainly not subtle.

Jeremy's circuit has a master switch that powers a regulator and the RFID. If this gets left on it will slowly drain the battery. As he mentioned earlier in this thread it would be nice to have something that will prevent this slow drain from happening.

Another problem that occurs to me with my plan is that someone could mess with the CA without the key. There are a lot of modes and controls in the CA that can be messed with, and if using it for throttle control/feedback it could be a problem.

One thought is to use a magnetic reed switch for the RFID power. Put a magnet on the key fob so bringing it near triggers RFID power and presents the RFID tag at the same time. Use the handlebar kill switch to disable the throttle.

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: RFID Musings

Post by Jeremy Harris » Oct 09, 2012 6:59 am

The power switch circuit I've now got working on the new Swift folder could be adapted to do this easily enough, although it would need another pair of transistors to provide the MCU "suicide switch" and would use another port. If you look at this schematic:
Bike power system.JPG
(140.82 KiB) Downloaded 41 times
and imagine that the power switch transistors don't turn the FETs on, just the MCU, then that circuit could also be used to operates like this:

1) press button, which powers up the MCU momentarily, and this then latches the power on with the "power on" line.
2) MCU then waits for a valid RFID, if one is received within, say, 1 minute it activates a FET power switch to turn on the controller power. If no valid RFID is detected after a minute the MCU turns off its own power.

There aren't any spare ports on the combined display/MCU that I used, but it would be pretty easy to do on pretty much any simple MCU.
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 10, 2012 12:02 am

Great plan, Jeremy.

I already have a kill switch on the handlebars and it is very convenient, so I'm thinking of ways to work with that (and not add another pushbutton), but adding one is a pretty straightforward way to go. One angle is to make the regulator that powers the RFID be an extremely low power unit, so leaving the switch on doesn't really matter much. The RFID subsystem can turn itself off, and if the regulator itself has low quiescent current it can be left on for months without killing the battery. I've used one regulator on a flashlight project that had quiescent drain so low it could last for a year or more on some flashlight batteries. Combine that with an FET pre-regulator to keep the drain low and handle the high input voltage.

Another approach is to use a switching regulator for the RFID but that is a bit more complicated and the EMI might bother the RFID. Any circuits around for a 30-100V input switcher that puts out 12V or so at say 0-50 mA with low quiescent current?

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 10, 2012 11:02 am

Low Current Regulator

How does a 80V to 5V regulator that has a quiescent current of about 1 mA sound? If I put that on my Borg and left the kill switch on it would take over 2 years to drain the battery. If the kill switch was left on for 2 years I'd have a problem.

So the kill switch would send power to the regulator which powers the microprocessor which controls power to the RFID. The micro operates the RFID for perhaps 10 seconds and then shuts it off and shuts itself down to microamp level. Then only the 1mA of the regulator is left powered.

So to turn the bike on you turn the kill switch on, swipe your RFID key, and that applies power to the controller etc via an FET switch or contactor.

This does not solve the demo mode problem where the bike is on so the CA works but the throttle is disabled. This could be handled with a separate "demo" mode tag and another output from the micro to disable the throttle or enable the ebrake. Or it could be a small switch somewhere that disables the throttle or ebrake separately from the RFID setup.

I think I know how to make a 1mA quiescent current linear regulator like this at up to 100V. It only has to power the RFID for a short time so it will not waste much power. Once the unlock is done or the RFID times out the power consumption goes down to about 1mA as the micro sets its outputs and shuts the RFID and itself down.

With a bit more effort the quiescent current could be reduced further, but 1mA is probably good enough.

amigafan2003
1 kW
1 kW
Posts: 487
Joined: Jul 14, 2011 10:05 am
Location: UK

Re: RFID Musings

Post by amigafan2003 » Oct 10, 2012 12:12 pm

Hmm, rfid to limit the bike to the legal speed limit when you're not withing 1m of it?

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 10, 2012 12:22 pm

amigafan2003 wrote:Hmm, rfid to limit the bike to the legal speed limit when you're not withing 1m of it?
If you get an RFID with the right range you could do that.

These units have a range of a few cm so are not suitable for that. But it is possible. Some units have greater range by using different frequencies and internal batteries, even transceivers.

Another approach is to have more than one tag that you unlock the bike with, and the speed limit can be set differently depending on which tag was used for the unlock.

For example one tag can be for "demo mode" where the motor doesn't run at all for safety when you are showing off the bike and want to run the lights and displays, another tag for onroad mode and a third for offroad mode. :)

mikal
1 mW
1 mW
Posts: 19
Joined: Aug 08, 2012 5:35 am

Re: RFID Musings

Post by mikal » Oct 11, 2012 4:29 am

:D
Last edited by mikal on Jun 29, 2013 7:41 pm, edited 2 times in total.
i know i have a beer around here somewhere,excuse me.

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 11, 2012 6:38 am

Welcome to the forum mikal.

Do you have any experience with this vendor or these units?

How much current does the reader draw from 12 volts?

Sancho's Horse
10 kW
10 kW
Posts: 503
Joined: Aug 09, 2011 2:27 pm
Location: Muncie, Indiana (USA) or Beijing or Tianjin (China)

Re: RFID Musings

Post by Sancho's Horse » Oct 11, 2012 11:14 am

I thought I posted this, but who knows? I had the legal vs. illegal thought as well, but then I thought it may even be more useful by allowing you to have mutliple settings so that if you have multiple users (wife, kids...etc.) you could have performance tailored to their desired level or abilities.

I use an RFID on a trailer I built. I decided with all of the credit card reader advancements, a bike (or trike in my case) pulled trailer for business is even more viable than ever before, so, I built one. I target the college crowd, so...I built a tray which triggers an RFID when it gets pulled out, starting a youtube video. Pretty slick. I first thought it may be a bit gimicky, but I am sold on it now.

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 11, 2012 11:39 am

Low Quiescent Current Regulation

To make a regulator that has low quiescent current we can't use zener/avalanche diodes below 5mA or so. Since the target here is about 1mA or less we need to look to other ways of regulating the voltage.

One part that works at the 1mA level is the popular TL431. They recommend a minimum current of 1mA with this part. There is a lower current model the TLV431, but this part cannot handle the voltage we need as it is limited to about 6 volts.

If we combine a TL431 with a 100V FET we can make a regulator that works up to 100V. While this could be used to regulate directly to 5V it is better to pre-regulate to 12V and then use a low quiescent current 5V regulator following to generate the 5V. The 12V can also be used to bias the main power switch FET bank, so having this intermediate voltage is useful.

In addition to the 1mA the TL431 requires to bias the cathode there is some current required to provide the voltage feedback from the 12V output to the control input on the TL431. This depends on the divider resistors and the requirements of the TL431 for this input. The input current on this pin is 4 uA max, so if the divider has 10x that current it would be another 40 uA.

The low quiescent current 5V regulator that I have used before is the LM2936. They specify a 15uA quiescent current, so it is pretty low. This in addition to the 1mA of the TL431. The microprocessor's current is also added to this, but if the chip is powered down the current required can be less than 2 microamps. After the RFID cycle has succeeded or timed out the micro can be powered down to this level as a power cycle is available and required to wake it up for the next RFID cycle.

The overall minimum quiescent current of this approach should be a bit over 1mA, perhaps about 1.1 mA. It will rise with increasing voltage, so if it is set to work at say 40V it will rise to about 3 mA at 100V. However a resistor change or jumper can bring the current back to 1.1mA, if a this is a concern.

mikal
1 mW
1 mW
Posts: 19
Joined: Aug 08, 2012 5:35 am

Re: RFID Musings

Post by mikal » Oct 11, 2012 8:18 pm

Welcome to the forum mikal.

Do you have any experience with this vendor or these units?

How much current does the reader draw from 12 volts

thank you alan for the welcome. no,i have no experience with this circuit or seller.i have no idea YET how much current it pulls.i would assume if it wasnt
readingb a fob, it would be fairly static and outputing as much as the load connected.kinda of a moot point,dont you think,once you get the 1(one) from it
turn it the heck off ( lol)
i know i have a beer around here somewhere,excuse me.

mikal
1 mW
1 mW
Posts: 19
Joined: Aug 08, 2012 5:35 am

Re: RFID Musings

Post by mikal » Oct 11, 2012 8:46 pm

hmmmm- i know i got a beer around here somewhere,EXCUSE ME
i know i have a beer around here somewhere,excuse me.

El Duderino
10 mW
10 mW
Posts: 24
Joined: Mar 29, 2011 11:02 am

Re: RFID Musings

Post by El Duderino » Oct 13, 2012 3:01 am

amigafan2003 wrote:Hmm, rfid to limit the bike to the legal speed limit when you're not withing 1m of it?
Do it with bluetooth on your phone and an arduino. Very easy to do! I still prefer my bt setup to any of the rfids ive played with. Ive played with passives (never have the kind of range that are promised) and actives (tags are much more expensive and readers generally need a beefier uC)

I cheaped out with the bt setup. Bought a very cheap arduino shield from Hong Kong and just scan for my phone. Doing it this way, its very easy to program. The phone becomes an rfid essentially.

Chris

User avatar
amberwolf
100 GW
100 GW
Posts: 25068
Joined: Aug 17, 2009 6:43 am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: RFID Musings

Post by amberwolf » Oct 13, 2012 3:43 am


User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 20, 2012 12:35 pm

ibuttons are 1wire devices, so they aren't RF ID and require a pair of contacts. Still an interesting idea for a unique code.

NFC (Near Field Communications) is an extension of the simple RFID gear. NFC is used in recent smartphones and cards.

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 20, 2012 2:58 pm

I had a few spare minutes the other day so I fired up LTspice and tossed in a few parts:

Image

This pre-regulator voltage prescaling circuit is designed for lower quiescent current drain. Here I am running it from 75 volts to 63 volts which is the range of 18S Lipo. The output changes from 14.3 to 11.4 volts over this range of input which corresponds to the battery voltage during the discharge cycle. There is also a 300mA load test in the graph which does not change the output voltage much at all.

When the load is off this circuit draws very little current, less than 0.1 mA. This circuit feeds the 5V regulator which powers the microprocessor and the RFID circuits. This way if the circuits get left on the battery doesn't drain significantly. The plan is the same as earlier - have the micro and RFID look for a valid RFID tag for a minute or so after power-up from the kill switch being turned "on". This takes about 25 mA. Then if no valid RFID tag was seen, power down the RFID and put the micro into a low power sleep mode and bring the total current down to perhaps 0.1 mA in this design. This way leaving the kill switch on won't kill the battery.

This circuit does require the resistor R2 to be adjusted for the desired output voltage. But in return one gets 10 times less current waste.

User avatar
Alan B
100 GW
100 GW
Posts: 7394
Joined: Sep 11, 2010 7:43 am
Location: San Francisco Bay Area, USA
Contact:

Re: RFID Musings

Post by Alan B » Oct 20, 2012 4:32 pm

mikal wrote:Welcome to the forum mikal.

Do you have any experience with this vendor or these units?

How much current does the reader draw from 12 volts

thank you alan for the welcome. no,i have no experience with this circuit or seller.i have no idea YET how much current it pulls.i would assume if it wasnt
readingb a fob, it would be fairly static and outputing as much as the load connected.kinda of a moot point,dont you think,once you get the 1(one) from it
turn it the heck off ( lol)
Hi mikal,

These readers are sending out pulses of power to energize the RFID tag all the time, so they do draw power pretty much continuously. If left on all the time it would be enough to drain the bike batteries in days or weeks, so it is a concern for me at least.

Are you going to try one? If you do get one let us know how it works. I have one on order via slow boat apparently. It has not appeared yet, but hopefully soon.

mikal
1 mW
1 mW
Posts: 19
Joined: Aug 08, 2012 5:35 am

Re: RFID Musings

Post by mikal » Oct 31, 2012 7:59 pm

hey-just a thought, put it behind a switch.dont take any crap, make it do what you tell it.
i was gonna order one of those units and then i found a really cool cree headlamp,sorry. guess your slow boat from china will get here first
hey,if you dont mind , too much,could you let us know if its ok
Last edited by mikal on Oct 31, 2012 8:07 pm, edited 1 time in total.
i know i have a beer around here somewhere,excuse me.

Post Reply