Making a UK/EU legal RC build - a cheap option

bobc

10 kW
Joined
Jan 20, 2011
Messages
993
Location
Knutsford England
I've started working on a small PCB to "legalise" an RC motor build.
It will be a tiny PCB which connects
1) 3 pin connector to hall effect throttle (twist or thumb)
2) 3 pin connector to an RC ESC
3) 2 bolted connections in the battery -ve line - average battery current measurement
4) 2 pin connector to speedo reed switch (magnet on spoke speed sensor)
there are 2 active components on the board - one is a single op amp amplifying a shunt current measurement, the other is an AVR tiny5 microcontroller. both SOT23 package.

Standard option, you plug in all the bits, you have fixed gearing to the motor (geared so it would naturally drive the bike at 18 to 20mph) - the micro backs off the PWM control to the ESC when either
a) speed goes over 25kph or
b) power from battery goes over 300W (i.e. with 6s batteries, average amps go over 12A).
With a suitably oversized motor you'll get plenty of torque because you'll have constant power available down to about 4mph, so hill climbing performance should be fine. (BTW 300W from batteries is regulation 250W at the wheel....).
I'm going to make a minimalist thing, no indicator lights, battery protection is simply the UVlockout in the RC ESC. So it should cost under a quid to make. Supported by its wiring & covered in heatshrink.
I would expect this to be interesting to folk all over the EU & maybe some other zones. Sound interesting?
On the bike you'd have to pedal to start moving but then it should be twist & go.
I can put layout, parts list & source code on here too or maybe get some made up???
 
Hmm, I don't get it :)
If you build a circuit to limit yourself to 12A and 25kph, why not just build a legal kit, with a 12A controller and choose your battery voltage to get a ~25kph top speed?
I'm not trolling your thread here, I just don't get it :?
 
A cheap RC ESC doesn't come controlled to any amps. This system will work with a 12$ controller (ESC) on a $30 motor. Controlling a higher current controller's battery amps gives you constant power operation over a wide speed range without gears. The term "12A controller" suggests it's controlling motor amps. That gives constant torque operation, I'm looking for constant power.
I hope. We'll see. It's the cost of the bits that's so attractive.
I've beeen running a $30 motor and $12 ESC on my bike for a couple of years. It's cheap & works, but not strictly legal and hard to ride (throttle control is twitchy to say the least) I hope this system will solve all those problems.
 
Can do the same thing with a Cycle Analyist can also use current based throttle
opption to help with throttle control... Best of luck with your pcb gizzmo though
could be of interest to EU folk if its cheapish and works ;)

KiM
 
Your bike will still be illegal like that. The UK legal limit is 200w. EN15194 hasn't yet been adopted into UK law. The 250w in EN15194 is "rated" power not maximum, which means the power that the manufacturer decides it should be rated at, and then prints it on a label attached to the motor. Actual peak power can be much higher. Throttles are not allowed on 250w bikes. Most ebikes in the UK are now illegal, and I'm sure the authorities know that they've allowed a very messy situation to come about. I've never heard of a proper ebike that looks like a bike being prosecuted for non-compliance. It wouldn't surprise me if the police have been instructed to keep clear of electric bikes because any prosecution would open up a huge can of worms. Even the Prime Minister has ridden an ebike that may well have been illegal. By all means restrict your bike to 25kph, but I wouldn't worry too much about power. You might feel safer if you had an official looking 200w label on your motor - much easier than complicated electronics. Nice project though.
 
bobc said:
A cheap RC ESC doesn't come controlled to any amps. This system will work with a 12$ controller (ESC) on a $30 motor. Controlling a higher current controller's battery amps gives you constant power operation over a wide speed range without gears. The term "12A controller" suggests it's controlling motor amps. That gives constant torque operation, I'm looking for constant power.
I hope. We'll see. It's the cost of the bits that's so attractive.
I've beeen running a $30 motor and $12 ESC on my bike for a couple of years. It's cheap & works, but not strictly legal and hard to ride (throttle control is twitchy to say the least) I hope this system will solve all those problems.


Hi bobc,
I know exactly what you want to do, I bought a 250A £14 ( delivered ) lv esc and I started to make a circuit to control the amps of these very cheap esc, The trouble with using a CA is the price so if something that can do the job for under 25 quid then all is good.
 
yeah the legal situation is daft for now, but as far as I can see EU law trumps UK law & the laws will have to be harmonised at some stage - so I'm going by EU. If the wattage turns out wrong it is a trivial job to adjust a shunt value or a constant in the software.
Schematic partly in - this thing has 2 SOT23s, 5 passives and a few connectors, it's gonna be tiny.
Having the speed feedback as well as battery current gives me a much better chance of controlling the amps (i.e. output is a volts demand, this can be proportional to speed + a bit as a first guess & adjust from there) I think it will be easier to make it work than a pure current controller, lots easier.
 
BTW Bob i thought i public state I'm in. we should meet and discuss this properly.
 
Sure thing Andy - the circuit is so small I can get a few routed (CNC router) as soon as I've done the layout. So I might be ready inside a week(!!!!)
OK it's not quite ready yet (design rule checks) but it's a first stab
euebike.gif
 
eulegal_zps69da742a.jpg

made 3 PCBs on the router last night; cut to size & started soldering today.
Downloaded AVRstudio too.... onto a rickety old laptop - took ages to install...
 
Looks good Bob. Can't wait to see it up and running. Very similar to what I have envisaged for a minimal setup for my friction drive. Keep up the good work.

BTW I would probably just solder the battery wire directly on to the board rather than worry with having to crimp terminals on the wires, and bolt then bolt the terminals to the board. But that's just me.

Oh and here is a link to some work that was done a while back to modify a turnigy watt meter to do what you are planning on, there might be something useful in it, as it was using a attiny26.

- Adrian
 
Hey bob just downloading avr studio 6. 799 meg so 24 minutes. Anyway will look at the IDE and some sample stuff. could do with getting hands on and talking about this with all the kit infront of us.

hopefully ive not forgotten everything since its a while since i last programmed.
 
Hi Andy,
I built up a couple of boards, unfortunately I'm away on business 'til Sunday - sort something out then?
I'll try to get some sort of framework together while I'm away ;^)
 
OK one particular error on the board needed sorting - I'd wired the speedo reed switch to pin 6 & that only does a state change interrupt (I want a rising or falling edge interrupt on the speedo) so had to swap pins 6 and 1. Software is carrying on regardless & new boards are being made by a proper PCB supplier (i.e. with solder resist on ;^)
So development for real won't start til the end of next week, but when it does we should spend more time doing development and less tracking down solder shorts.....
TTFN
Bob
 
Proper PCBs are here - I'll build a couple up & we should be able to start programming.
Andy - I've written some C - pretty much filled up the tiny5 (it's like a real time warp, programming with just 32bytes of RAM - like it used to be in the '70s ;^)
It might fit in a 5 OK, if not the tiny10 has 2x the ROM size & costs about the same & fits the same slot.... Maybe we can make a start this weekend?
 
In Dorset till Sunday with Pippa ebiking. Will defo try to catch you Sunday if possible.
 
Now got 6 units, all on nice PCBs, just (still) waiting for my £2 ebay USB programming adapter to arrive from hong kong....
I'll post a picture in due course. But what you really want to see is the video on the bike isn't it..... I'm guessing that will be a few weeks of development in the future....
On a related note, I'm going to need some of those reed switches you get in bike speedo kits - the things that the spoke mounted magnet goes past - anybody know where to get them? At the moment the cheapest source seems to be complete chinese ebay bike speedos (you can get the whole things for a couple of quid)
 
ive got a reed switch handy bought ages ago. only one mind and a cheapo neo magnet
 
Interesting project :)

Is there any reason this couldn't be used with a hubmotor and sensored controller?
 
I expect hubmotor/sensored controller already does all the things this is intended to add to an RC setup. It's not intended for that application. It might be possible to make it useful in that application with custom software ;^)
just to recap the design goals for this thing:
1) interface hall throttle to RC ESC
2) generate a servo interface to run the RC ESC
3) apply a battery power limit to make RC setup legal
4) apply a speed limit to make RC setup legal
5) improve throttle feel/ reduce synch loss problems with RC ESC on an ebike
6) do all this for about £1
By customising the software anybody can prioritise these goals differently, they just need to download AVR design studio (free download), kit themselves up with an AVR programming dongle (£2 on ebay) and start hammering 'C' into their 'puter. And the standard hardware/software can easily be modified if desired to alter the current limit, the speed scaling, whatever...

The electrical parts required gor a legal RC based ebike with ~6 to 8 mile range come down to:
1) FIA switch (or similar) - say £4
2) outrunner motor - say $35
3) hall twist grip throttle say £5
4) RC ESC - say $12
5) this PCB - say £5 (prototype quantities :^( )
6) 6s Lipo 5Ah - say $45

Obviously you also need wires, connectors etc. & all the mechanical stuff (friction drive? layshaft/left side setup?)
 
I admit I focused pretty much on the speed/power limiting function... The idea of having a road/offroad setting switch would be useful to many, I think, as a lot of hubmotor controllers don't have this feature.

Am I right in thinking the board senses battery current/voltage to the controller and compensates the throttle input to regulate it to the desired limits? If so I think it should be pretty universal in this application. Not using most of it's features, I admit...
 
At last - I think I got the complete tool chain for programming the ATtiny10 working on my laptop - what a palaver! Don't know for sure - I've not programmed one successfully yet, but at least "AVRDUDE" is talking to the chip. Fingers crossed......
For reference I'm using atmel studio 6 for project compilation (free download) and winAVR/avrdude to talk to a $2 usb programming adapter via another small interface board to make the TPI interface work. This needs to be programmed with the very latest usbasp code and version 5.11.1 of avrdude (ver 5.11 doesn't work). The hard part was finding a windows build of this. At the moment it only works if I slow it right down with a -B400 command - I might be able to speed this up a bit with a pullup resistor, but for now I'm just relieved to have communications established.
punx0r - no can do - my micro only has 6 legs & I've used them all (including taking over the reset pin for another function...) ;^) It really is limited to RC ESCs. It assumes battery voltage stays constant & compensates the "pulse" ESC drive signal to limit battery current. When it's working I'll put the schematic & source code on here & anyone can adapt it however they want ;^)
 
Here is some information about the interface board you will need to be able to use a £2 AVR usb programmer to program the tiny5. First of all you need the LATEST version of all the software. That includes the software on the little USB dongle, therefore you have to buy 2 of them and use each to program the other. This is actually fairly straightforward, you just need to fit the prog link on the board you're programming.
Then you need AVRDUDE v5.11.1. typically - this is a ballsache too - a windows build of 5.11 is available & installs (along with winAVR) directly. Then I (finally) found a set of 5.11.1 files to overwrite the 5.11 ones thanks to a guy called srmeister on avr freaks.
Now you need some hardware, i.e. the interface board. 2 issues
1) data line has now become bidirectional, you need to connect it to MOSI and MISO on the AVRUSB via 220ohm resistors AND add a 1kohm pullup to 5V
2) because we need to use the reset pin as an analog input, it has to be disabled as a reset using the fuse settings. This stops the programmer working. It now only works with reset pulled up to 12V rather than pulled down to 0V. So the interface board has a 12V PSU built in, a mosfet to translate the signal and a jumper to select either the original or the 12V reset.
When you have all that assembled, you potentially have a working system. A typical command line always (at least) needs the following arguments:
avrdude -c usbasp -p t10 -B20
-cusbasp selects the usb programming dongle
-pt10 selects the ATtiny10 micro
-B20 makes the serial stuff slow enough (the tiny10 internal oscillator is a bit slower than the crytal on the usbasp)
Bingo - now you can start the software project (& have fun debugging when your only debug resource is a PWM output on the chip + a scope.... ;^)
usbasptpicct_zpsc7a2140f.gif

PS picture updated to a fully working circuit
 
Back
Top