RFID Keyswitch

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

Re: RFID Musings

Post by Alan B » Oct 31, 2012 8:06 pm

I did receive the seeedstudio unit a couple days ago (slow boat). I have not hooked it up yet. Hope to do that soon.

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

Re: RFID Musings

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

looking forward to your analysis,i can see in the dark,but so can anyone that steals my bike lol
i know i have a beer around here somewhere,excuse me.

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

Re: RFID Musings

Post by Alan B » Nov 02, 2012 1:46 am

I started working on the code. I have to find a cable to hook the board up. I ordered one from seeedstudio today but that will take several weeks to arrive, so I'll probably rig something up temporary before that arrives.

The code I'm working on takes a master key to program the micro to accept other keys. Could use a different master key for master reset to erase all keys, or could use some other technique.

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

Re: RFID Musings

Post by Alan B » Nov 06, 2012 8:58 am

I've been working on the code when time permits. This code uses the Wiegand interface mode which means it will work with lots of available scanners. I ordered one from ebae that is potted and waterproof and ruggedized. The Seeedstudio scanner is just a board and very fragile wire pickup coil, whereas the commercial scanners are more substantial and the cost is about the same, less than $20. It all depends on what you have room for. On the Borg I want something to hide under the existing covers so the Seeedstudio unit might be the best, and possibly epoxy it to the cover, or to a thin PC board that is placed against the cover. On the mountain bike a pre-potted unit might be easier to place somewhere, or perhaps pot my own to make it small and light. It might make sense to put the electronics inside the controller case proper and just have the pickup coil mounted outside the controller, perhaps on the controller.

The Wiegand interface is a three wire interface with ground and separate clocks for zero and one. It is very simple and fairly timing independent. It can be run through a very long cable between the scanner and decoding microprocessor, though that is hardly needed on an ebike. There are often a few other wires on the commercial units for LED indicators and a buzzer. Using this interface opens up a lot more hardware compatibility as the commercial systems use it. The other option with the Seeedstudio board is serial. There is a jumper to select between them on the board.

There are two easy ways to put keys into the software of the micro. One is to type in the number printed on the key and compile that into the software. The other is to scan the key and have the software store it in the nonvolatile memory in the processor. I'm setting up my software to have options for both techniques.

At this point the software is using about 4K of the 32K code space available in the small Arduino. This makes it suitable to fit in an 8 pin ATTiny85 CPU if needed. The Arduino is an easier development platform and allows me to have an LCD display for debugging. The final system won't really need a display, one LED should be sufficient.

Another feature I put into the software is a "running" timeout, after a few hours it shuts off the controller. This is useful in case things get left on accidentally. It resets each time the power is cycled on. I set it for four hours, but that could easily be changed. I never operate my ebike in one session for that long, the batteries won't last that long anyway if the motor is consuming more than 350 watts on my 1.4KWH pack. It would also be easy to add an LVC shutoff to this design. Since it is controlling the master power switch it might be a good place to do that. Not to replace the CA functionality, but to back it up. The CA will cut off the throttle, while this can cut off the power to the controller and other loads to preserve the battery.

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

Re: RFID Musings

Post by Alan B » Nov 24, 2012 9:17 am

More parts came in, still waiting for some.

Received a USB reader from eBae, this really makes it easy to put the codes for the keys into the software. When you swipe a key it types the code and a carriage return in. These USB readers are cheaper than the others, too.

It also allowed some testing of key range. The cards had twice the range of the keyring fobs, not surprising since the antenna coil can be larger.

Also received a pack of 10 key fobs from eBae, they were an experiment to see what $2 for 10 looked like. They appear to be well made and all scanned perfectly. Lots of low cost keys for these 125 khz RFID readers!

I tried to read the ID badge from work into the Windows USB RFID reader but nothing happened, so apparently it is not 125 khz.

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

Re: RFID Keyswitch

Post by Alan B » Nov 03, 2013 10:46 am

Time to continue working on this project and design a PC board and set it up to work with the Master Switch board that is being tested now.

https://endless-sphere.com/forums/vi ... 14&t=54225


Design Requirements, subject to change

Input/output (bike main battery) voltage 30 to 110V (may require some adjustment over the range)
Output current 300 mA (to power controller or enable Main Power Control board)
Quiescent current less than 1 mA (after 10 second unlock window)
RFID interface: power out (40 mA max), Wiegand in 1/0, ground (4 wires)
Controls 5V power to the RFID transceiver board, turns on for a limited unlocking time window
Output: connects to one of:
Master Switch board or Motor Controller Logic Power input or Battery Management Board (future)
Useable in different configurations for versatility


Design Plan, subject to change

+ battery feeds input from Kill switch when set in "operate" position
use FET pre regulator (shown earlier in this thread)(linear)
secondary regulator low quiescent current 5V
microprocessor attiny44/84
output via latching relay
micro outputs power to Wiegand RFID reader and reads codes back for a limited time at power-on (10 seconds)
re-cycle power off then on to enable RFID reading again
if proper RFID code detected micro enables relay outputting +battery
micro powers down RFID and itself after the 10 second window
If bike is powered on, after 4 hours micro powers bike off (use timer to minimize micro power consumption)

Potential Component List

NEC EA2-5TNJ dual coil 5V latching DPDT relay $3
Last edited by Alan B on Nov 03, 2013 8:39 pm, edited 4 times in total.

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

Re: RFID Musings

Post by Alan B » Nov 03, 2013 11:42 am

Question - should this be a through-hole design? Do folks want to build these themselves?

sacko
100 kW
100 kW
Posts: 1208
Joined: Jul 04, 2012 2:15 am
Location: Kent, United Kingdom

Re: RFID Musings

Post by sacko » Nov 03, 2013 2:44 pm

Personally, I would want a plug and play system.

...and would be happy to pay for that luxury.

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

Re: RFID Keyswitch

Post by Alan B » Nov 03, 2013 6:01 pm

Here is a quick layout of the RFID Keyswitch board, not final, needs some tweaking and parts adjustment.

Image

Size is 1.6 by 1.9 inches, a bit under 3 square inches total.

Connectors:

J1 connects to the Kill Switch
J2 to the bike main battery
J3 is used to program the onboard microprocessor
J4 to the SeedStudio RFID transceiver board or equivalent
J5 connects to the Main Power switch board
J6 will connect to the future Battery Management board
Last edited by Alan B on Nov 03, 2013 7:43 pm, edited 3 times in total.

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

Re: RFID Keyswitch

Post by Alan B » Nov 03, 2013 6:07 pm

sacko wrote:Personally, I would want a plug and play system.

...and would be happy to pay for that luxury.
Thanks for the input.

May be able to ramp up to that later, can't start there. :)

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

Re: RFID Keyswitch

Post by Alan B » Nov 04, 2013 9:29 pm

High Voltage Low Current Regulators

One of the problems with an RFID subsystem is that it needs to come on first, before anything else is turned on. So there is only the bike battery at 36, 48, 72, or 104 volts to power it (readily available). I don't like to play games like tapping lower voltage out of the battery, so I need some way of dropping the voltage.

I found one linear regulator chip that will take 100 volts, but it can't handle much current since it would get too hot. For example, a regulator dropping 100 volts at 10 milliamps will be dissipating 1 watt! The RFID circuit needs up to about 100 milliamps peak, so a linear regulator is not a good fit. Presently that's what I have on the board design, and it probably will work, but it is not great and it might get fairly hot for a short time. Workable, but can we do better?

I started doing some searches for simple switching regulators for 110 volts to 5 volts at 100 milliamps. I found one new part from Linear, an LTC3639 that will do up to 150 volts and 100 milliamps and has very few external parts! However this part is apparently too new since no supplier has any, and the cost per chip is fairly high.

Back to the search engines, turning up the National LM5009 which is good to 100 volts and 150 milliamps and is available and costs a couple of dollars. More like it, though it won't quite do 24S. But it will do up to 20S which is good enough for lots of ebikes, so maybe I'll try that to start with.

If anyone has better suggestions, let us know! I've not done that much searching yet, surely there are more parts out there. I'd like to cover the range 30-110 volts DC and 100-150 milliamps output at 5 volts. Minimum external parts count, low quiescent current and cost, yadda yadda.

User avatar
Jolly Jumper
100 W
100 W
Posts: 110
Joined: Sep 21, 2013 11:37 am
Location: Germany

Re: RFID Keyswitch

Post by Jolly Jumper » Nov 04, 2013 9:52 pm

TEN 8-7211 WI
43...160VDC
Ausgangsspannung 1 5VDC
Ausgangsstrom 1 1600mA
Anschluss THD
Betriebstemperatur -40...+85°C

But its costly here ~34€ but have seen it on alibaba but dont know exact price there but would be in for a group buy :mrgreen:

Could also be additionaly used as a USB charger :wink:

User avatar
Arlo1
100 GW
100 GW
Posts: 8524
Joined: Apr 26, 2009 10:36 pm
Location: Nanaimo BC Canada
Contact:

Re: RFID Keyswitch

Post by Arlo1 » Nov 05, 2013 12:53 am

I just got a RC522 for setting up a Key switch with this. I am not sure of the rest I guess I have a lot of reading to do.
My Leaf motor controller build. viewtopic.php?f=30&t=63982&p=963227#p963227
My YSR build http://www.youtube.com/watch?v=BRo8r5g4NBg
RC and most types of Lithium batteries you MUST know your individual cell voltages charging and discharging.
Don't keep them were you cant afford smoke or fire!
Never above 4.2v never below 2.7v EVER!!!
HI power controller design. Game Changer
http://www.undergroundelectrics.ca/

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

Re: RFID Keyswitch

Post by Alan B » Nov 05, 2013 1:00 am

Nice find (on the switching voltage regulator)!

http://www.powergatellc.com/traco-power ... erter.html

8 watts!! That's a lot more power than I was looking for, but very nice!

Mifare is a different standard for RFID. Somewhat more sophisticated than the ones I am using. But it might be able to work with this board.

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

Re: RFID Keyswitch

Post by Alan B » Nov 05, 2013 1:39 am

Another Switching Regulator

I'm finding lots of 100V switching regulators: LM5019, LM5018 and LM5017. These differ in the amount of current available. 0.1/0.3/0.6 amps respectively.

These are synchronous (no diode required) and need about a dozen external parts (R, C and L). The earlier LM5008 series requires an external diode in addition to a similar number of external parts. Both parts are about two dollars in small quantity. The 5019 series is a bit harder to solder with a central power pad. None of these parts are available in through-hole styles.

Too bad these are not quite enough for 24S.

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

Re: RFID Keyswitch

Post by Alan B » Nov 05, 2013 1:35 pm

Arlo1 wrote:I just got a RC522 for setting up a Key switch with this. I am not sure of the rest I guess I have a lot of reading to do.
Hi Arlo. The RC522 is a Mifare system which is different from the one I'm using. It appears to have several protocols for talking to it. The board I'm working on will probably be able to work with it but it will require different software at least.

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

Re: RFID Keyswitch

Post by Alan B » Nov 07, 2013 12:11 pm

The LTC3639 switching regulator is really a good fit for this application, up to 150V max input, up to 100 mA output at 5V. It only requires about 3 external parts to work, a coil and a couple of caps. For some reason no one has any stock though. Lots of suppliers list it, and the part came out awhile ago, so I'm wondering if there was some problem with them? Searching hasn't turned up anything about that yet.

The other parts I've found are mostly 100 volt max and require more external parts.

For this project we need around 50 mA for a short time, and really low quiescent current when not operating the RFID. The LTC3639 has a low quiescent current of 12 uA! We should be able to get close to that when the micro and RFID transceiver is shut down. At 12 uA it would take 9.5 years per amp-hour to drain the batteries. So leaving the kill switch on after the bike is shut off would not matter much.

A question for folks following this thread. How long after turn-on should the RFID shut down the bike? For example, if you turn the bike on, ride somewhere, and forget to turn it off, how long should it stay on? The RFID doesn't know whether the bike is in use or just sitting, so this timeout would be blind. Unless we added a motion sensor to the RFID board, or a current or throttle sensor so it could detect "in use". I was thinking of making this timer 4 hours, but it would be nice if it was smarter or could use a shorter timeout. I suppose the RFID board could monitor the system voltage and look for change there as an indication the bike was in use, but is this good enough?

richmpdx
100 W
100 W
Posts: 143
Joined: May 21, 2009 5:14 pm
Location: Portland, OR

Re: RFID Keyswitch

Post by richmpdx » Nov 07, 2013 2:52 pm

Back a few posts you asked about interest in a through-hole version of the board that individuals could build. I am very interested. It would be a great addition to an ebike.

Rich

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

Re: RFID Keyswitch

Post by Alan B » Nov 07, 2013 3:22 pm

This switching regulator is surface mount, but the rest of the parts are thru hole.
The earlier design has linear regulation, but I'm concerned about overheating of the linear reg, so I am looking for a different solution.

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

Re: RFID Keyswitch

Post by Alan B » Nov 07, 2013 6:54 pm

Here is an example of one 125 khz RFID reader:

http://www.seeedstudio.com/depot/grove- ... Path=19_24

They have a couple other units which are either discontinued, or going to be, so the Grove unit is the one that will apparently remain.

Ebae also has units like this in the $5-15 range. Power requirements vary, some require 12V and the current levels vary. This is a problem as developing much current at 5 or 12V from the 30-110V bike main battery is a bit difficult. Linear regulators develop a lot of heat, and we want low quiescent current as well. The board-level products are probably the best choice for low weight and power requirements, but they are a bit fragile and will require some packaging for the ebike environment.

Here's one on Ebae that is small, low power, low cost, and weather sealed that may be good for eBike use:

http://www.ebay.com/itm/Mini-Wiegand26- ... 3ccfdba90c

Search for Mini Wiegand26 Weatherproof RFID Reader 125KHz if the above link doesn't work. This unit takes 20 mA at 12V which is a nice low current, but it is an extra voltage that needs to be generated.

There are several types interfaces to these boards that the micro needs to be able to talk to when reading the tag code. The three I've seen are Wiegand, Serial (UART), and I2C. All of those are possible with two wires (Serial/UART takes only one wire). Serial/UART type devices require a calibrated clock, Wiegand and I2C do not. I'm leaning toward Wiegand since calibrating the clock is not something everyone can easily do. But with minor code changes one board can handle all these modes.

I need to measure the current the little Seeedstudio RFID boards require. They operate at 5V so don't need to generate another voltage. If their current demand is low enough the circuit as designed with linear regulators may work, but the time the RFID is active will have to be short as the linear regulator cannot deliver 50 mA for long - that is 5 watts of heat on a 100V ebike!

If the switching regulator chip is the only surface mount part, folks might be able to solder it with a small pencil. It adds some challenge, but it is not impossible. Still, the difficulty, complexity, and low availability of this switching regulator chip are concerning.

I'll look further into the regulator situation. It is the biggest holdup on this board, though some system choices also need to be finalized so I can determine the connectors and pinouts. The present design is all through hole (see rendering above), with 2 stages of regulation.

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

Re: RFID Keyswitch

Post by Alan B » Nov 08, 2013 12:26 pm

RFID Keyswitch PCB Version 0.1

Here is the new version, slimmed down, simplified, all through-hole, and with linear regulation. KISS = Keep It Sweet and Simple.

Image

Board is about 1.5 by 1.6 inches, and 2.4 square inches.

J1 is power in from Run/Kill switch at full battery voltage (only on when running)
J3 is programming jack, used to load software into the micro, just pads (no actual connector)
J4 is RFID receiver, 5V up to 40 mA, Wiegand or Serial/UART
J5 is Power Out (when unlocked) to Main Switch Board, or power the controller (logic only), up to 200 mA at battery voltage
J6 is dry relay contacts SPDT (no power, etc, just direct to the second set of contacts on the relay)

Pre-Regulator is TO220 FET type selected for battery voltage.
5V Regulator is low quiescent current type, 50-100 mA output, several available

Output is Relay DPDT dual coil latching type, so once the key is "open" the relay is latched and does not require power to stay there. The micro will power down and very little power will be consumed after the initial search for the RFID key.

Microprocessor is ATTiny 24/44/84 family in DIP package (2K/4K/8K flash memory size), and there are 2 unused pins on the micro at this point.

The way this will work:

1) Turn on the Run switch, this applies power to the board
2) Micro wakes up, opens relay, powers up RFID receiver and looks for keys
3) Swipe the RFID key within the time window (say 10 seconds)
4) If key is good relay closes and applies power to bike, if not it keeps listening
5) After unlocking or timing out micro shuts down RFID and itself to minimize power consumption

Power consumption when Run/Kill switch is off is zero
Power consumption when Run/Kill switch is on is high for the time window, 50 mA = 5 watts on a 100V bike (depends on RFID receiver power, may be less)
Power consumption after window (running or locked) is low, depends on a few things but should be less than 1mA, possibly a lot less

sacko
100 kW
100 kW
Posts: 1208
Joined: Jul 04, 2012 2:15 am
Location: Kent, United Kingdom

Re: RFID Keyswitch

Post by sacko » Nov 08, 2013 12:29 pm

Looking forward to this :)

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

Re: RFID Keyswitch

Post by Alan B » Nov 08, 2013 12:39 pm

Great to see that someone's out there. 8)

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

Re: RFID Keyswitch

Post by Alan B » Nov 08, 2013 1:16 pm

If there are no further changes, I'll send this off to fabrication. :D

sacko
100 kW
100 kW
Posts: 1208
Joined: Jul 04, 2012 2:15 am
Location: Kent, United Kingdom

Re: RFID Keyswitch

Post by sacko » Nov 08, 2013 1:19 pm

It's always the way with project threads. Minimal take up at the start, but once there are a few out there and being used, everyone wants one!

Let me know how much they are, what parts I need (or if you are supplying a kit/instructions) and ill send the $$ over :)

Post Reply