Lightweight folder - build thread

Thanks for tipping me off about the Swift, the more I ride it the more I like it. it really doesn't ride like a small wheel folding bike at all and feels much more like a full size bike. Not only is there website useful and easy to use, but the folks at Xootr were a pleasure to do business with, even for the oddball order I placed with them (a sort of complete bike minus wheels).

The seat post folding lock only works if you don't have mudguards fitted, as it relies on the seat post being able to lock down against the rear tyre when the bike's folded up. In practice the lock isn't really needed, as it stays folded easily enough, at least for just lifting in and out of the car. The post is much thicker than that on a standard bike and has a bit of a taper at the end, so is pretty easy to get in and out, much easier than on other bikes I've owned. My guess is that the Swift has been designed to make doing this fairly easy.

I've been out and bought a fairly large under seat bag today and can just fit the battery pack in that, hiding it pretty well. It certainly looks a lot more discreet than the monstrous box on the handlebar stem! I think I'll need to add some additional support underneath this seat bag though, as I can't see the plastic bracket on the saddle being able to take the load for long. I should be able to just make up a simple clamp around the seat post type support, similar to the one I made up for the other folder (see here: http://endless-sphere.com/forums/download/file.php?id=48486) to support the underside of the bag.

Next step is to make a new housing for the display and one for the controller and power control electronics, then lace up the Bafang motor into a rear wheel and see how it goes with that.
 
A rather belated update, as I've rebuilt this bike now. I didn't like the big box on the handlebars, or the Tongxin motor running sensorless, so the Swift now has the Bafang code 10 motor (that BMS battery shipped in error) and is running on 15S to get the speed to something reasonable. I've retained the same display and control system, but relocated it so that it's in a small box on the handlebars, a bit smaller than a CA. The MCU that drives the display also controls the bike power switching system, so it can turn the bike off if it detects that no current has been drawn for a couple of minutes of so. The bike is turned on (or off) by a push button on the side of this box.

It's only just been finished (late on Sunday evening) so hasn't had much testing yet, just a brief ride in the wet yesterday (with NeilP, who was over here for an hour or two). I have the controller set for 20A at the moment, but it only manages about 15 to 16 A in practice. I've not checked the speed yet, but would guess it's a little bit faster than my other folding ebike and I know the other one does around 22 to 24 mph on the flat.

All told I think it looks better with the smaller box on the handlebars, although for the true stealth look I think I might look for a smaller pack for the battery (it only takes up half the space in that bag). I've not checked the total weight yet, but it's certainly a fair bit lighter than the old blue bike, so I'd guess that it may be somewhere around 16kg or so. It fits in the back of the car easily enough (I fitted both bikes into the back of my Prius easily when I went down to meet NeilP yesterday), but isn't as simple to fold as the blue bike.

Here are some photos and the schematic, code etc for the final version of the power switch and display:

Finished - side view.JPG

Finished - display.JPG

Finished - controller.JPG

Bike power system.JPG



Code:
;
;Electric bike power control and power/energy display using 18M2 built in to AXE133Y OLED display from Revolution Education Ltd
;
;
;The control board that this drives has a FET power switch on the low side plus a Hall effect
;current sensor and potential dividers to measure/detect switched battery voltage.  
;The circuit draws zero current when powered off.
;
;Power off control causes the current capacity value to be stored in EEPROM and then allows the picaxe
;to "commit suicide" by turning off it's own power supply
;
;Power is turned back on by a momentary push button and is then latched on by the picaxe

;The code includes an automatic turn off function.  If no appreciable current is detected for between 2.5 and 3
;minutes the picaxe turns the power off to conserve battery capacity
;
;When the picaxe is powered up with the push button and detects that the battery has being charged
;(from the reset push button under the display box) it resets the capacity in EEPROM to the battery fully charged capacity
;
;Due to the word length limit, the maximum allowable battery capacity using this code as it stands is 18.2 Ah (65,536 amp seconds)
; 
;This version is set for a battery capacity of 5 Ah (18,000 amp seconds)
;
;

#picaxe 18M2


EEPROM $00, ("E",3,1,1,1,1,1,1,1,1,1,1,1,1,2,"F") 	; store 0 bar (EMPTY) msg in the EEPROM memory
EEPROM $10, ("E",0,1,1,1,1,1,1,1,1,1,1,1,1,2,"F") 	; store 1 bar msg in the EEPROM memory
EEPROM $20, ("E",0,0,1,1,1,1,1,1,1,1,1,1,1,2,"F") 	; store 2 bar msg in the EEPROM memory
EEPROM $30, ("E",0,0,0,1,1,1,1,1,1,1,1,1,1,2,"F") 	; store 3 bar msg in the EEPROM memory
EEPROM $40, ("E",0,0,0,0,1,1,1,1,1,1,1,1,1,2,"F")	; store 4 bar msg in the EEPROM memory
EEPROM $50, ("E",0,0,0,0,0,1,1,1,1,1,1,1,1,2,"F") 	; store 5 bar msg in the EEPROM memory
EEPROM $60, ("E",0,0,0,0,0,0,1,1,1,1,1,1,1,2,"F") 	; store 6 bar msg in the EEPROM memory
EEPROM $70, ("E",0,0,0,0,0,0,0,1,1,1,1,1,1,2,"F") 	; store 7 bar msg in the EEPROM memory
EEPROM $80, ("E",0,0,0,0,0,0,0,0,1,1,1,1,1,2,"F") 	; store 8 bar msg in the EEPROM memory
EEPROM $90, ("E",0,0,0,0,0,0,0,0,0,1,1,1,1,2,"F") 	; store 9 bar msg in the EEPROM memory
EEPROM $A0, ("E",0,0,0,0,0,0,0,0,0,0,1,1,1,2,"F") 	; store 10 barmsg in the EEPROM memory
EEPROM $B0, ("E",0,0,0,0,0,0,0,0,0,0,0,1,1,2,"F") 	; store 11 bar msg in the EEPROM memory
EEPROM $C0, ("E",0,0,0,0,0,0,0,0,0,0,0,0,1,2,"F") 	; store 12 bar msg in the EEPROM memory
EEPROM $D0, ("E",0,0,0,0,0,0,0,0,0,0,0,0,0,2,"F") 	; store 13 bar msg in the EEPROM memory
EEPROM $E0, ("E",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"F") 	; store 14 bar (FULL)msg in the EEPROM memory



symbol current0 	= C.0 ; Blue - current sense input 0 (ADC) (also used for capacity reset when shorted to ground)
symbol voltage1 	= C.1 ; Grey - voltage sense input 1 (ADC)
symbol poweron 	= C.2 ; White - power on output 2 (out)
symbol on_off	= C.5	; Violet - on/off button sense input 5 (input)
symbol enable 	= C.6	; LCD enable
symbol rs 		= C.7	; LCD RS 


; LCD data pins are on B.0 to B.7



; Supported display bytes:
; 0-7, 8-15	CGRAM characters
; 16-252	normal ASCII characters, according to selected character map table

; Supported command bytes:
; 1		Display clear (leaves cursor position where it is)
; 2		Return cursor to home position (line 1, position 1)
; 128 	sets cursor at first character, first line (128 + x moves to position x)
; 192 	sets cursor at first character, second line (192 + x moves to position x)
; 8 		hides display
; 12 		restore display
; 14 		turn on cursor
; 16 		move cursor left one character
; 20 		move cursor right one character


	SYMBOL display_byte = b0
	SYMBOL loopcounter = b1					;loopcounter is used by "measurementloop" and "charged"
	
	SYMBOL Capacity = w1					;Capacity holds battery capacity remaining in amp seconds (18.2 Ah max, due to 16 bit limit)
	
	SYMBOL Current = w2
	
	SYMBOL Voltage = w3
	
	SYMBOL Averagecurrent = w4
	
	SYMBOL Averagevoltage = w5
	
	SYMBOL zerocurrent = w6
	
	SYMBOL Power = w7
	
	SYMBOL digit0 = b16
	SYMBOL digit1 = b17
	
	SYMBOL digit2 = b18
	SYMBOL digit3 = b19
	
	SYMBOL sampleloopcounter = b20
	SYMBOL msg_no = b21
	
	SYMBOL temp1 = b22					;only used in message display sub-routine, so can be used elsewhere
	SYMBOL temp2 = b23
	
	SYMBOL temp3 = b24
	SYMBOL time_out = b25
	
	SYMBOL Totalcurrent = w13
	
	
	SYMBOL antijittercounter = $1C
 

	





init:
	;Set up ports and turn on power
	
	let dirsC = %11000100	; PortC 2,6,7 outputs
	let dirsB = %11111111	; PortB all outputs
	
	high poweron		;turn on power switch
	

	; Winstar OLED Module Initialisation
	; according to WS0010 datasheet (8 bit mode)

	pause 500 			; Power stabilistation = 500ms

	; Function set - select only one of these 4 character table modes
	let pinsB = %00111000 	; 8 bit, 2 line, 5x8 , English_Japanese table
	;let pinsB = %00111001 	; 8 bit, 2 line, 5x8 , Western_European table1
	;let pinsB = %00111010 	; 8 bit, 2 line, 5x8 , English_Russian  table
	;let pinsB = %00111011 	; 8 bit, 2 line, 5x8 , Western_European table2
	
	pulsout enable,1  	; 
		
	let pinsB = %00001100	; Display on, no cursor, no blink
	pulsout enable,1 	

	let pinsB = %00000001 	; Display Clear
	pulsout enable,1
	pause 7			; Allow 6.2ms to clear display

	setfreq m16			; change clockto 16Mhz

	let pinsB = %00000010 	; Return Home
	pulsout enable,1

	let pinsB = %00000110 	; Entry Mode, ID=1, SH=0
	pulsout enable, 1
	
	high rs			; Leave in character mode


	; load custom characters for bargraph display to cgram in display:

		
	let display_byte =64
	gosub display_command
	let display_byte =63
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =32
	gosub display_data			;load custom character 0 (full block)
	
	let display_byte =72
	gosub display_command
	let display_byte =63
	gosub display_data
	let display_byte =32
	gosub display_data
	let display_byte =32
	gosub display_data
	let display_byte =32
	gosub display_data
	let display_byte =32
	gosub display_data
	let display_byte =32
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =32
	gosub display_data			;load custom character 1 (centre, empty)
	
	
	let display_byte =80
	gosub display_command
	let display_byte =63
	gosub display_data
	let display_byte =33
	gosub display_data
	let display_byte =33
	gosub display_data
	let display_byte =33
	gosub display_data
	let display_byte =33
	gosub display_data
	let display_byte =33
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =32
	gosub display_data			;load custom character 2 (right hand empty)
	
	
	let display_byte =88
	gosub display_command
	let display_byte =63
	gosub display_data
	let display_byte =48
	gosub display_data
	let display_byte =48
	gosub display_data
	let display_byte =48
	gosub display_data
	let display_byte =48
	gosub display_data
	let display_byte =48
	gosub display_data
	let display_byte =63
	gosub display_data
	let display_byte =32
	gosub display_data			;load custom character 3 (left hand end, empty)	 

	
	
	;Reset capacity to 5Ah (18,000 amp seconds) if reset button (which shorts the current sense to 0V) is connected at power on
	READADC10 current0, Current
	IF Current < 10 THEN GOTO charged
	
	;read value of Capacity stored in non-volatile memory
	READ $F0, WORD Capacity
			
	;Read averaged supply current over 100 readings to get zero value 
	
	FOR loopcounter = 1 TO 100
	READADC10 current0, Current
	zerocurrent = zerocurrent + current
	NEXT loopcounter
	
	zerocurrent = zerocurrent / 100		;set zero current value at power on
			
	;check for capacity over-range from misreading
	IF Capacity >18000 THEN LET Capacity = 18000
	ENDIF
	
	Totalcurrent = 0
	
	;display starting capacity
	GOTO capacitydisplay

	
	
		
mainloop:

	
	;reset internal time variable to zero
	time = 0
	
	;reset sample loop counter to zero
	sampleloopcounter = 0
		
	
sampleloop:

	;take 64 measurements and sum and divide the results to give average current and voltage
	; it takes ~ 196 mS to do this loop 64 times, so ~ 3mS per iteration
		
	;check push button for power off command
	IF pinc.5 = 1 THEN goto poweroff
			
	FOR loopcounter = 1 to 64
	
	;Take voltage reading using 150k/10 divider on battery (80 V maximum) 1 bit ~ 78 mV
	READADC10 voltage1, Voltage
	;at this point Voltage can be 0 to 1023, where 1023 = 80 V
			
	;Take current reading using ACS712 sensor. 
	READADC10 current0, Current					
	;At this point Current can be any value between about 512 (~0A) and 1023 (~30A) 1 bit ~ 58.9 mA
	
	;Subtract zero current value obtained during initialisation
	Current = Current - zerocurrent
	zerocurrent = zerocurrent + 500					;temp increase zerocurrent to max reading expected
	IF Current > zerocurrent THEN LET Current = 0			;check for under-run error due to noise
	ENDIF
	zerocurrent = zerocurrent - 500					;return zerocurrent to original value
	;At this point Current can be any value between 0 and ~511 (where 511 = 30.0A)
	
	;add current and voltage  to averagecurrent and averagevoltage, maximum allowable is 65,536
	Averagecurrent = Averagecurrent + Current
	Averagevoltage = Averagevoltage + Voltage
	
	;maximum of 64 times around this loop to stay inside 16 bit overflow on totals
	NEXT loopcounter
	
	;voltage is now 0 to 65536 for 0 to 80 V, current is 0 to 32704 for 0 to 30 A	
	
	;convert current to true average over 30 seconds using number of times around sample loop
	;uses sampleloopcounter as temp counter variable (not used elseswhere for anything that interferes)
	
	LET sampleloopcounter = sampleloopcounter + 1 			;increment counter every time around sample loop
	
	;Averagecurrent is divided by 109 to bring within range 0 to 300 for 0 to 30.0A
	Totalcurrent = Averagecurrent / 109 + Totalcurrent
		
	GOSUB display
		
	IF time = 30 THEN GOTO capacitydisplay				;check to see if 30 seconds has elapsed, if not go around the loop again
			
GOTO sampleloop
	
	


	
	
capacitydisplay:
	
	 	
	;Totalcurrent is (amps x 10 x number of times around sampleloop) at this point
	
	;first convert Totalcurrent to amps * 10 over 30 seconds (sampleloopcounter is no of samples)
	Totalcurrent = Totalcurrent / sampleloopcounter
	;Totalcurrent is now in the range 0 to 300
		
	;Totalcurrent = 300 = 30A = 900 amp seconds, so multiply Totalcurrent x 3 to get amp seconds
	Totalcurrent = Totalcurrent * 3
	
	Capacity = Capacity - Totalcurrent
	;Capacity now has capacity remaining in amp seconds, within the range 0 to 18,000				
	
	display_byte = 192						;go to start of second line on display
	gosub display_command
		

	IF Capacity <643 THEN LET msg_no = 0
	gosub msg
	ENDIF
	
	IF Capacity >=643 AND Capacity <1928 THEN LET msg_no = 1
	gosub msg
	ENDIF
	
	IF Capacity >=1928 AND Capacity <3213 THEN LET msg_no = 2
	gosub msg
	ENDIF
	
	IF Capacity >=3213 AND Capacity <4498 THEN LET msg_no = 3
	gosub msg
	ENDIF
	
	IF Capacity >=4498 AND Capacity <5783 THEN LET msg_no = 4
	gosub msg
	ENDIF
	
	IF Capacity >=5783 AND Capacity <7068 THEN LET msg_no = 5
	gosub msg
	ENDIF
	
	IF Capacity >=7068 AND Capacity <8353 THEN LET msg_no = 6
	gosub msg
	ENDIF
	
	IF Capacity >=8353 AND Capacity <9638 THEN LET msg_no = 7
	gosub msg
	ENDIF
	
	IF Capacity >=9638 AND Capacity <10923 THEN LET msg_no = 8
	gosub msg
	ENDIF
	
	IF Capacity >=10923 AND Capacity <12208 THEN LET msg_no = 9
	gosub msg
	ENDIF
	
	IF Capacity >=12208 AND Capacity <13493 THEN LET msg_no = 10
	gosub msg
	ENDIF
	
	IF Capacity >=13493 AND Capacity <14778 THEN LET msg_no = 11
	gosub msg
	ENDIF
	
	IF Capacity >=14778 AND Capacity <16063 THEN LET msg_no = 12
	gosub msg
	ENDIF
	
	IF Capacity >=16063 AND Capacity <17348 THEN LET msg_no = 13
	gosub msg
	ENDIF
	
	IF Capacity >=17348 THEN LET msg_no = 14
	gosub msg
	ENDIF
	
idle_check:

	;Check current and if less than 1 amp second drawn for 5 consecutive times around capacity loop (between 2.5 and 3 minutes) turn power off as a power save measure
	
	IF Totalcurrent < 30 THEN LET time_out = time_out + 1		;check for less than 1 amp second average in past 30 seconds
	ELSE time_out = 0								;reset timeout counter if current is still flowing
	ENDIF
	
	IF time_out = 5 THEN GOTO poweroff					;poweroff saves capacity in EEPROM and turns power off
	
	
GOTO mainloop
	

;*******************************************************************************************************************************


poweroff:

	;save value of Capacity in non-volatile storage for use on next power up
	;Note: EEPROM locations from 0 to 240 ($00 to $E9) are used for fixed message storage, $F0 is next available slot
	WRITE $F0, WORD Capacity
	pause 500
	
	;turn off power
	LOW poweron
	
	
	

END	


;*******************************************************************************************************************************


charged:

	;programme redirects to here if charging link is detected at power on
	
	LET Capacity = 18000			;reset capacity to 5 Ah (18,000 amp seconds)
	
	;save reset value of Capacity in non-volatile storage
	WRITE $F0, WORD Capacity
	
	let display_byte = 128			;set cursor to first digit, upper line of display
	gosub display_command
	
	LET display_byte = "B"
	GOSUB display_data			;display "Battery charged" message on upper line of display
	LET display_byte = "A"
	GOSUB display_data
	LET display_byte = "T"
	GOSUB display_data	
	LET display_byte = "T"
	GOSUB display_data	
	LET display_byte = "E"
	GOSUB display_data	
	LET display_byte = "R"
	GOSUB display_data	
	LET display_byte = "Y"
	GOSUB display_data	
	LET display_byte = " "
	GOSUB display_data	
	LET display_byte = "C"
	GOSUB display_data	
	LET display_byte = "H"
	GOSUB display_data	
	LET display_byte = "A"
	GOSUB display_data	
	LET display_byte = "R"
	GOSUB display_data	
	LET display_byte = "G"
	GOSUB display_data	
	LET display_byte = "E"
	GOSUB display_data	
	LET display_byte = "D"
	GOSUB display_data	
		
			
	FOR loopcounter = 0 TO 14
	let display_byte = 192			;set cursor to first digit, lower line, for "fill up" display
	gosub display_command
	let msg_no = loopcounter
	gosub msg
	
	PAUSE 1000
					
	NEXT loopcounter
	
		
	PAUSE 20000
		
	;turn off power
	LOW poweron
	
END



;*******************************************************************************************************************************

;ONLY SUBROUTINES BELOW THIS POINT
	
;*******************************************************************************************************************************


msg:

	; display message from EEPROM sub routine
	; message number 0-15 must be in msg_no when called
	; uses (alters) temp1, temp2, temp3

	let temp1 = msg_no & %00001111 * 16
							; EEPROM start address is 0 to 15 multiplied by 16
	let temp2 = temp1 + 16 - 1 		; end address is start address + (line_length - 1)
	for temp3 = temp1 to temp2		; for 16 times
		read temp3,msg_no			; read next character from EEPROM data memory into b1
		let pinsB = msg_no 		; output the data
		pulsout enable,1  		; pulse the enable pin to send data.
	next temp3					; next loop
	
RETURN



;*******************************************************************************************************************************


display_data:

	;This sub-routine reads data in display_byte and send it to OLED display
	;it returns after acting on the byte


	
	let pinsB = display_byte 		; output the data
	pulsout enable,1  			; pulse the enable pin to send data.
	
RETURN

		

;*******************************************************************************************************************************


display_command:


	low rs 	     				; change to command mode for next character
	let pinsB = display_byte 		; output the data
	pulsout enable,1  			; pulse the enable pin to send data.
	pause 30
	high rs					; back to character mode
	
RETURN
	
	
;*******************************************************************************************************************************

display:

	;check to see how many times display has been called to reduce display character jitter by only changing display every X calls
	;uses temp3 as loop counter but this doesn't have to be kept sacrosant between calls to this routine as it only holds a peeked value within this routine
	
	PEEK antijittercounter, temp3
	IF temp3 = 4 THEN
	
		;Averagevoltage is 0 to 65536 (0 to 80) and Averagecurrent is 0 to 32704 (0 to 30.0A)
		;convert average voltage back to volts x 10
		Averagevoltage = Averagevoltage / 81
		;at this point Averagevoltage can be any value between 0 and 799 for 0 to 80V (small error from integer math)

		;convert averagecurrent back to amps x 10
		Averagecurrent = Averagecurrent / 109
		;at this point Averagecurrent can be any value between 0 and 300 for 0 to 30.0A
	
		;convert Averagecurrent to ASCII
		BINTOASCII Averagecurrent, digit2, digit1, digit0
		IF digit2 = "0" THEN LET digit2 = " "
		ENDIF
		let display_byte = 128							;set cursor to first digit, first line
		gosub display_command
		let display_byte = digit2
		gosub display_data
		let display_byte = digit1
		gosub display_data
		let display_byte = "."
		gosub display_data
		let display_byte = digit0
		gosub display_data
		let display_byte = "A"
		gosub display_data
		let display_byte = " "
		gosub display_data							;display current in format "30.0A_", where _ is a space				
		;last digit is a space at character 133			
		
		;convert Averagevoltage to ASCII
		BINTOASCII Averagevoltage, digit2, digit1, digit0
		let display_byte = digit2
		gosub display_data
		let display_byte = digit1
		gosub display_data
		let display_byte = "."
		gosub display_data
		let display_byte = digit0
		gosub display_data
		let display_byte = "V"
		gosub display_data							;display voltage in format "58.2V"	
		;last digit is "V" at character 138
	
	
		;calculate power and display
	
		;Average voltage is 0 to 799, Averagecurrent is 0 to 300
		Averagevoltage = Averagevoltage / 10				;scale down to volts		
		Power = Averagevoltage * Averagecurrent				;range is 0 to 16500 watts x 10 (30A x 55V)
		Power = Power / 10							;scale power down to watts
			
		BINTOASCII Power, temp3, digit3, digit2, digit1, digit0
		;discard temp3 and digit3, only hundreds and below displayed (temp3 is re-used here as a digit that's not displayed)
	
		;remove leading zeros from first two digits
		IF digit1 = "0" AND digit2 = "0" AND digit3 = "0" THEN LET digit1 = " "
		ENDIF
		IF digit2 = "0" AND digit3 = "0" THEN LET digit2 = " "
		ENDIF
		IF digit3 = "0" THEN LET digit3 = " "
		ENDIF
		LET display_byte = digit3
		GOSUB display_data
		LET display_byte = digit2
		GOSUB display_data
		LET display_byte = digit1
		GOSUB display_data
		LET display_byte = digit0
		GOSUB display_data
		LET display_byte = "W"
		GOSUB display_data
		;W is at character position 143 which is 16th position on upper line of display
	
		
		LET temp3 = 0								;reset antijitter loop counter
		POKE antijittercounter, temp3
		
	ELSE
		LET temp3 = temp3 + 1							;increment antijitter loop counter
		POKE antijittercounter, temp3	
	
	ENDIF
	
	;keep these resets here as they are needed to maintain correct averaging of voltage and current
	;reset loopcounter to zero
	loopcounter = 0
	
	;reset averagecurrent drawn over sample period to zero
	Averagecurrent = 0
	
	;reset averagevoltage measured over sample period to zero
	Averagevoltage = 0
	
RETURN

;*******************************************************************************************************************************


;*******************************************************************************************************************************
 
Another update. I swapped out the heavy BPM rear motor for a new wheel laced up with a Q100 motor. Much lighter and far less conspicuous than the black BPM. I managed a quick couple of mile test ride this morning (before it started pissing down with rain) and was pleasantly surprised by just how poky the little Q100 motor is. It doesn't win any prizes for refinement, being a bit noisy when given a bit of stick, but does make the bike shift along quite well. My "test course" includes a fairly steep hill and it tackled this well, in fact it could have gone too fast for the road conditions (narrow windy lane covered in wet leaves). The only downside is the very twitchy throttle response, it's markedly more twitchy than the BPM, which was quite smooth when run on exactly the same controller. The Q100 almost seems to just be either on or off at lowish speeds, with the merest touch of the throttle. I'll do some playing around with the phase current setting and see if I can calm it down a bit, as at the moment it needs too much attention to be a relaxed ride. I may also turn the battery current down a bit, as it seems to have plenty of power for the sort of city riding this bike usually gets used for.

It's running on 15S LiCoO2 LiPo at the moment, so around 58V or so. I didn't get a chance to measure top speed, as I forgot to take the GPS with me, but would guess that it's now around 28mph or so. Pedalling is still fine with the motor flat out, thanks to the Speed Drive in the BB. In theory the 36V 328rpm Q100 should run at around 31mph no load in a 20" wheel when run on 15S, and this seems about right. It is definitely faster than the Code 10 BPM motor when run on the same battery pack and controller, more than I would have expected from the small difference in Kv. The no load current on the Q100 is also much lower than the BPM, so overall I suspect it's a more efficient motor.

Overall I'm initially quite impressed with the little Q100. It's not as smooth and refined as the Bafang SWXH that I have on my old folder, but it is nice and light and reasonably powerful. The wheel, tyre and motor weighed in at 2.7kg with the Q100, and 4.7kg with the BPM, a worthwhile saving on a bike that gets lifted in and out of the back of the car all the time.

[edited for a typo.....}
 
good work Jeremy. Thanks for sharing. I love the power meter. What's the final all-up weight?
 
Thanks for the kind words.

The power meter is also the power switch for the controller, and there's still room for a bit more code if I want to try doing something more with it, it could pretty easily output data from the serial port to a uSD card, for example, to keep a detailed log of power, current, voltage etc on every ride (although that's probably getting a bit anal, thinking about it).

The bike all up weight is just over 16kg, which is heavier than I wanted, TBH. My ideal "back of the car ebike" would be around 12kg, which is a tall order, but possibly do-able with care and one of the little 1.6kg Keyde motors.
 
Jeremy Harris said:
The bike all up weight is just over 16kg, which is heavier than I wanted, TBH. My ideal "back of the car ebike" would be around 12kg, which is a tall order, but possibly do-able with care and one of the little 1.6kg Keyde motors.
Hi Jeremy,

For those of us building small folders it would be interesting to hear more about how you compare the Cute and Tonxin/Keyde motors. I'm building a Brompton so would be using the 82mm version of one of these.

Your initial impression of the Tonxin was that it was weak uphill, but AFAIK you were running a lower voltage pack then, so less phase amps to motor to generate uphill torque.

Any plans to compare the Cute and Tonxin on the same battery pack? Could say record data riding a moderate uphill (electrical and speed data)

The Cute and Tonxin/Keyde motors have similarities:
Both have high ratio gearing (about 10:1, twice that of other hubbies)
Both are low weight (1.6-2kg) and similar in dimensions.

Differences one can spot in the ES posted pictures seem to be:
Gears in Cute and rollers in Tonxin/Keyde
Outrunner in Cute and inrunner in Tonxin/Keyde

Despite the differences it seems like (in theory) somewhat similar power output should be achievable.

Martin
 
The Tongxin I have is one of the early ones, so not fully representative of the newer Keyde version. It's a sensorless, 260 rpm at 24V motor, and I ran it on 12S at 20A battery current, 40A phase current. This was really pushing it, as the rollers would slip when pulling off, or giving the motor full throttle on a steep hill, plus, being sensorless, it wasn't the smoothest starting motor, although it was fine at speed. The motor also started to sound a bit unhappy at this sort of power level, and I suspect it wouldn't last long. On my recumbent I ran the Tongxin on around 12A battery current and it was a lot happier; it never showed any sign of slipping or making odd noises.

The Cute Q100 is a much stronger motor than the Tongxin. Although I'm now running this motor on 15S, it spins at a similar rpm at full throttle to the Tongxin on 12S and I'm running it at the same current. The Q100 on 20A battery current, 40A phase current is much, much stronger when accelerating from a stop or pulling up a hill than the Tongxin at the same current. Top speed on the flat is probably fairly similar, and the Tongxin is certainly a fair bit quieter than the Q100, but overall I'd go for the Q100 over the Tongxin, despite the slight weight advantage that the newer Keyde version has.

I've no direct experience with the smaller Cute motor, but what I've read suggests that it's very similar to the Q100. I happen to like having rear wheel drive on an ordinary bike, hence my choice of the Q100 over the smaller version, although the Tongxin was great as a front wheel drive on my old SWB recumbent. One potential issue with the Brompton is the slightly odd wheel size as well as the smaller than normal fork width, both of which mean that you're pretty limited in terms of motor and rim choice. One reason I opted for the Xootr Swift is that it uses standard bike parts, plus I didn't need the very compact fold that the Brompton gives.
 
q100 is rated from 250-350W vs. q85 is rated from 200-250W. Numbers aside, I'm willing to bet they both have the same amount of tolerances when pushed to their limits.

There are only a few motor choices to play with when you have an 80mm fork width. When you get into 100mm, the possibilities open up dramatically. The Xootr differentiates itself from Dahon, Tern, and other folding bike geometries by using standard widths.
 
FWIW, the Q100 when run at around 500 to 600W doesn't seem to get very warm. I'd better qualify that by saying that on the two test rides I've made the outside air temperature was round 8 to 10 deg C (around 46 to 50 deg F), although both rides included a pretty steep (maybe 10 to 12%) hill that is around a mile or so long.

I'd take a guess that these motor ratings are pretty nominal, and have more to do with appearing to meet legal power limits than being illustrative of true motor power ratings. There's also the fact that they may be rated for operation in much hotter climates than we get up here at 51 deg N.........
 
the 36v 328rpm is noisier than the 24v 201rpm. They both go same max speeds on my 13s. I have tested this with two 36v and one 24v.
 
aaronlim said:
the 36v 328rpm is noisier than the 24v 201rpm. They both go same max speeds on my 13s. I have tested this with two 36v and one 24v.

Thanks for that, I guess it must be down to the different gears these two motors appear to have. I might try a 24V 201 motor if it's a bit quieter.

I took the bike into the city this morning and the lighter weight really made a big difference when lifting it out of the car. Now that I've got the knack it's almost as quick to fold and unfold as the older blue folding bike with two hinges, although it doesn't fold up to quite as small a package. I can't say that I miss the full suspension that the other bike had, either. The Swift really does ride nicely. I did a speed check this morning and it will almost hit 30mph on the level, which is great. What's even better is that I can still pedal at 30mph, quite easily.
 
aaronlim said:
the 36v 328rpm is noisier than the 24v 201rpm. They both go same max speeds on my 13s. I have tested this with two 36v and one 24v.
I have 24v 201 rpm, 36v 201 rpm and 36v 328 rpm Q100s and I haven't noticed any difference in noise levels. Sometimes i got a bit of resonance noise at certain speeds, which disappeared after a couple of hundred miles. I've got a feeling that the 24v 201 rpm and 36v 328rpm are identical. has anybody seen the two stage gears in the 328 rpm one?
 
Jeremy Harris said:
Another update. I swapped out the heavy BPM rear motor for a new wheel laced up with a Q100 motor. Much lighter and far less conspicuous than the black BPM.
...
It is definitely faster than the Code 10 BPM motor when run on the same battery pack and controller, more than I would have expected from the small difference in Kv. The no load current on the Q100 is also much lower than the BPM, so overall I suspect it's a more efficient motor.

Overall I'm initially quite impressed with the little Q100. It's not as smooth and refined as the Bafang SWXH that I have on my old folder, but it is nice and light and reasonably powerful. The wheel, tyre and motor weighed in at 2.7kg with the Q100, and 4.7kg with the BPM, a worthwhile saving on a bike that gets lifted in and out of the back of the car all the time.

I'm considering building a Swift too, they look pretty solid. Since I'm pretty heavy these days I don't think I want to trust the q100 bolt on axles and it may not have the torque to get me up my hill anyway. Please elaborate on the Bafang SWXH vs the Q100 vs the BPM some more. I'm considering the SWXH, the SWXK, and maybe the SWXU. In the real world where I'm fat and old and live on top of a 9% hill I suspect I need the BPM, but I really want to build a bike, not a motorbike and the BPM seems like too much. I'm particularly curious about torque, speed (planning 10s or 12s lipo), noise, and your general impressions of the motors. Thanks!
 
My gut feeling is that there isn't much to choose between the SW series Bafang motors and the BPM series when it comes to torque. Both seem to pull well, but the BPM may have the slight edge. There is a noise difference, the BPM seems slightly noisier to me than the SW series, when pulling around the same weight. It's not particularly noticeable, but it just sounds a little bit harsher. The Q100 is slightly quieter than the BPM, but not as quiet as the SW. In terms of smoothness, the SW is far and away the smoothest running, with the BPM coming a reasonably close second and the Q100 being a bit over-sensitive to small throttle changes.

The above comparisons are all on the same controller, with no fine tuning to try and improve things. I strongly suspect that if I change the phase current to battery current ratio I'll be able to improve the smoothness of the Q100 and stop some of the jerkiness when the throttle is applied. I'm also currently working on building a small version of Lebowski's controller for this bike, in the hope that his sophisticated control algorithm will make the Q100 run much more smoothly, and perhaps a little more quietly. I'll stick details of this in another thread once I'm ready.

I strongly recommend the Swift frame, it really is rock solid and handles very well indeed. At close to 30mph on city roads that aren't great it felt far, far better than my old folder, really confidence inspiring. The only thing I might change is the handlebar height, the post supplied is a little short for me, as although I'm supposedly in the right height range I have long legs, so need the saddle up pretty high. I've looked at getting the longer post from Xootr, but the shipping cost is pretty high, so I'll probably buy one of the extenders locally to raise the bars up a couple of inches. I'd also recommend fitting the Speed Drive BB, as the taller ratio really helps by allowing serious pedalling at top speed.
 
Jeremy Harris said:
My gut feeling is that there isn't much to choose between the SW series Bafang motors and the BPM series when it comes to torque. Both seem to pull well, but the BPM may have the slight edge. There is a noise difference, the BPM seems slightly noisier to me than the SW series, when pulling around the same weight. It's not particularly noticeable, but it just sounds a little bit harsher. The Q100 is slightly quieter than the BPM, but not as quiet as the SW. In terms of smoothness, the SW is far and away the smoothest running, with the BPM coming a reasonably close second and the Q100 being a bit over-sensitive to small throttle changes.
I'm afraid I'm going to have to disagree with you on that one Jeremy. I've found that both front and rear BPMs have masses of torque compared with the SW 250w series. I've got a SWX at 22 amps and it's pretty noisy at that, and it doesn't have enough torque to get me up our test hill without pedalling, while as the BPMs charge up the hill like it's flat with 40 amps, and they're nearly silent. I've just added a Q128 to the rear of the SWX bike and it's not bad now. It can get up the test hill without pedalling, but still, even with two motors, is no match for the BPM.

Back to the Q100: I opened up a 328 rpm 36v one today and can confirm that it's the same as the 36v 201 rpm, but different to the 24v 201rpm, which has single stage gears - like a smaller version of the Q128.
Q100328rpm.jpg
 
-dg said:
Please elaborate on the Bafang SWXH vs the Q100 vs the BPM some more. I'm considering the SWXH, the SWXK, and maybe the SWXU. In the real world where I'm fat and old and live on top of a 9% hill I suspect I need the BPM, but I really want to build a bike, not a motorbike and the BPM seems like too much. I'm particularly curious about torque, speed (planning 10s or 12s lipo), noise, and your general impressions of the motors. Thanks!

The BPM is much bigger and heavier than any of the others, and is considerably more powerful. It can sustain 1500w, while as for the others, about 750w is a safe maximum to sustain. The SWXU is much smaller than the other SWX series, so presumably not as powerful. The same as the Q85 is narrower than the Q100, so is less powerful (spec. 250w vs 350w).

The Q100 with 12S lipos at 17amps will get you up a 9% hill. I'm 100kg and mine dragged me up a long 10% hill without pedalling - just. Top speed is about 22mph on the flat (with me on board).
 
All I can say is that I've been riding a bike with an SWXH rear hub for a bit over two years and found that it climbs every bit as well as a similar bike with the BPM, but that means nothing at all, as they have a very different Kt. The BPM, for example, wouldn't lift the front wheel of my bike on 28A, whereas the SWXH will wheelie at pretty much any opportunity at the same current unless I'm careful with the throttle. This is, of course, a completely meaningless "apples and oranges" comparison, just as is your comparison.

My code 10 BPM is around 15 to 10% faster than my SWXH on the same voltage, so obviously has a faster motor wind. Both have been tested at 28A, and there's no doubt that my SWXH has similar, perhaps even better, hill climbing ability to my BPM on the same bike, but then that's not in the least bit surprising, given the higher Kt of my SWXH. The SWXH does get noticeably warm at this current, though, whereas the BPM didn't seem to, another good indicator that the motors have very different winds.

To get a fair comparison then versions of both motors that are very similar in terms of motor Kv and gear ratio would need to be compared. Any other comparison isn't really valid.
 
d8veh said:
but the BPM's twice the size of the SWXH!

So? You may as well say that an Crystalyte 400 series is twice the size of a BPM, and we all know full well that it doesn't have anything like the same torque, in any wind. Size is a very crude indicator of maximum power handling capability in the long term, but not a reliable indicator of motor torque with a geared hub motor.

Anyway, my point was that without knowing the relative wind of each motor you can't make a fair comparison, something I was guilty of in my rough and ready test, as I compared three motors using the same battery and controller, but without taking account of the differences in wind and gear ratio, making the comparison pointless. You've done exactly the same.

Here's a quick example just using BPM motors, using the assumption that torque is proportional to hill climbing capability (which it pretty much is):

If I was to put, say, 20A through a Code 10 motor (Kt ~ 1.09 N-m/A) then I'd get (ignoring the small gear and frictional losses) a torque of around 21.8 N-m at the wheel.

If I was to put the same 20A through a code 16 motor (Kt ~ 1.79 N-m/A) then I'd get (again, ignoring the small gear and frictional losses) a torque of around 35.8 N-m at the wheel.

Two motors of an identical size and type, running on the same controller at the same current limit, yet one has around 70% more torque, and hence hill climbing capability, than than the other.

If you want to get even more extreme, then take a look at the little Q100 with the 328rpm wind. That has a Kt of around 1.06 N-m/A, so at the same 20A it will give a torque at the wheel of around 21.2 N-m, pretty much exactly the same as the code 10 BPM.

Of course the Q100 will probably get warmer than the BPM, but that doesn't subtract from the fact that both have the potential to deliver around the same hill climbing performance when used at the same current.
 
I'm trying to compare like with like: 201 rpm SWX vs 201 rpm (code 15 and code 13) BPM. I also had a code 11 and that would also blitz any SWX. I just can't understand what your saying: There's loads of us on Pedelecs that started on 250w Bafangs, and then when we wanted more power, we upgraded to BPMs. It's chalk and cheese - massive difference. The difference comes from not only the larger diameter, but the difference in current handling. You can't run a SWX on 40 amps without stripping the gears.
 
d8veh said:
I'm trying to compare like with like: 201 rpm SWX vs 201 rpm (code 15 and code 13) BPM. I also had a code 11 and that would also blitz any SWX. I just can't understand what your saying: There's loads of us on Pedelecs that started on 250w Bafangs, and then when we wanted more power, we upgraded to BPMs. It's chalk and cheese - massive difference. The difference comes from not only the larger diameter, but the difference in current handling. You can't run a SWX on 40 amps without stripping the gears.

First off, I've been running my SW rear hub n 28A for more than two years and it's fine, but that does depend very much on the particular motor wind. My SW rear hub is a 24V version, Kv (and hence Kt) unknown, running at around 60V in a 20" wheel bike. It does around 25 mph flat out, but will pop the front wheel off the ground going up any sort of a slope when run at 28A. Would it take 40A? I don't know, TBH.

The RPM ratings are really confusing and a very poor (in my view) way to try and compare hill climbing performance. You really need to dig down and get the Kt for the motor wind (overall Kt, including the gear reduction ratio). This then allows a fair comparison to be made, as you can then calculate the torque that each motor will deliver at a particular current.

Motor size doesn't come into this, as the torque is determined solely by the motor overall Kt (the torque constant including the gear ratio) and the motor current (determined by the controller).

Your comparison doesn't have a valid reference point, I'm afraid, as you need to be able to define the motor wind (which determines Kv and hence Kt), the motor gear ratio, the wheel size and the motor current. Just like the BPM and the Q100, the SW series come in a selection of different motor winds, so have wide differences in Kt from one to another. Unfortunately Bafang haven't been too clear about this, and have tended to just give wheel sizes to define the different SW series winds (for example, I have a "20" motor and a "26" motor, both are 24V, but have very different Kv's (and hence Kt's).
 
Jeremy Harris said:
d8veh said:
but the BPM's twice the size of the SWXH!

Here's a quick example just using BPM motors, using the assumption that torque is proportional to hill climbing capability (which it pretty much is):

If I was to put, say, 20A through a Code 10 motor (Kt ~ 1.09 N-m/A) then I'd get (ignoring the small gear and frictional losses) a torque of around 21.8 N-m at the wheel.

If I was to put the same 20A through a code 16 motor (Kt ~ 1.79 N-m/A) then I'd get (again, ignoring the small gear and frictional losses) a torque of around 35.8 N-m at the wheel.

Two motors of an identical size and type, running on the same controller at the same current limit, yet one has around 70% more torque, and hence hill climbing capability, than than the other.

If you want to get even more extreme, then take a look at the little Q100 with the 328rpm wind. That has a Kt of around 1.06 N-m/A, so at the same 20A it will give a torque at the wheel of around 21.2 N-m, pretty much exactly the same as the code 10 BPM.

Of course the Q100 will probably get warmer than the BPM, but that doesn't subtract from the fact that both have the potential to deliver around the same hill climbing performance when used at the same current.

Torque constant is only of significant importance if talking the same phase amps. With a 20A battery amp controller, both would adjust their phase currents according to their constants, and would end up at similar speeds, producing very similar torques.

But, there is no getting around the fact that small gearmotors reach saturation current and thermal runaway much sooner than BPMs. For the riding I do, there is simply no comparison... even at 20S/12A my GM mini begs for mercy while the BPM at 22A desperately screams for more.

The only reason the front Mini hasn't turned to dust yet is it's geared a bit slower than the BPM, effectively only putting out power during hills and acceleration. I had the BPM tuned to 25A before going 2WD and it was still happy.
 
miuan said:
Torque constant is only of significant importance if talking the same phase amps. With a 20A battery amp controller, both would adjust their phase currents according to their constants, and would end up at similar speeds, producing very similar torques.

??? The phase current is pretty much fixed by the assumed motor LR that the controller uses internally to calculate the phase current to battery current ratio from the settings. Sure, if the motor LR is significantly different from the controller's assumption (which may be the case with some motors) the controller will allow a different phase current for a different motor, when it's in battery current limit mode (which it would be at full throttle up a hill). The differences in motor LR for these relatively small geared hub motors is not that great though, so the phase current differences between them, when run from the same controller and battery, would be small.



miuan said:
But, there is no getting around the fact that small gearmotors reach saturation current and thermal runaway much sooner than BPMs. For the riding I do, there is simply no comparison... even at 20S/12A my GM mini begs for mercy while the BPM at 22A desperately screams for more.

A completely separate issue. Of course a bigger motor has got a greater thermal mass, probably has a better heat dissipation rate and will therefore sustain high power for longer. That isn't in dispute.

The key point I was making, which is valid, is that there is a wide variation in torque constant for the same motor in different winds, and, ignoring losses and potential overheating for the moment, that means that you cannot make a general statement that motor X has greater instantaneous torque than motor Y without being careful to ensure that the motors being compared have a similar Kv (and hence similar Kt).

The example I quoted above to illustrate this, of two different BPM motor winds run from the same controller with a 20A current limit, but with one giving around 70% greater instantaneous torque then the other, is valid. It does, of course, ignore the much greater I²R losses in the lower Kv, higher Kt, motor, and also ignore the significant additional heat that would arise from these losses.

The fact remains that, for the 20" wheeled bikes that I compared, the version of the SW series rear motor I have (admittedly over-run a lot) performed as well as a BPM motor when climbing hills when run using the same controller and battery. d8veh took issue with this, pointing out his experience was the opposite, but both of us were making an unfair comparison. In my case I was comparing an SW series hub with a very different Kv to the BPM hub, as I believe he was. If we could find an SW series hub and a BPM hub with the same Kv I suspect we'd both get different results, which is the key point I was trying to make.
 
That works looks really neat, I have to get one for the corner of my workshop. Not the bike, I have enough of those, but a Jeremy :D Would make all the projects floating around my brain so much closer to reality!
 
Jeremy Harris said:
If I was to put, say, 20A through a Code 10 motor (Kt ~ 1.09 N-m/A) then I'd get (ignoring the small gear and frictional losses) a torque of around 21.8 N-m at the wheel.

If I was to put the same 20A through a code 16 motor (Kt ~ 1.79 N-m/A) then I'd get (again, ignoring the small gear and frictional losses) a torque of around 35.8 N-m at the wheel.
...
If you want to get even more extreme, then take a look at the little Q100 with the 328rpm wind. That has a Kt of around 1.06 N-m/A, so at the same 20A it will give a torque at the wheel of around 21.2 N-m, pretty much exactly the same as the code 10 BPM.

Two questions:

Where are you getting these Kt numbers for any of these motors? It seems very useful, but I have not seen it anywhere else.

I'm very tempted to build a Swift. I'm a reasonably good cyclist, but an even better eater. Given my own weight (120kg), the hilly terrain around here and the fact that I may need to haul it up a couple flights of stairs in the train stations I expect to have to trade some speed for torque and some range for weight. I plan to pedal hard on climbs, the assist is more to keep average speeds up for commuting. I'd like to be able to sustain 32kph with about 100w of pedaling and I'd iike to be be able to climb 12% for up to 1/2 mile and 6% indefinately with about 200w of pedaling. I can deal with HK lipo but would prefer to keep it in the range 10-14s so that I can charge without taking the pack apart (Hyperion 1420). I've been all over the simulator and the BPM can do this. But, it is pretty heavy and I'd like avoid having so much weight in the ends of the bike .I think a rear drive might be better, but then there is the whole issue of getting enough gearing. The stock Swift setup seems pretty reasonable, but it is cassette and there are not many acceptable 11 tooth freewheels. I'm a little leary of the Q100 because of the bolt together axle setup. So what motor?

BPM rear?

SWXH rear?

SWXK front?

Comments please.
 
Back
Top