Electric Bikes – odometer

7th February 2017 – 7631 kilometres

4th November 2016 – 7432 kilometres

18th October 2016 – 7245 kilometres

5th October 2016 – 7080 kilometres

20th September 2016 – 6910 kilometres

7th September 2016 – 6803 kilometres

22nd August 2016 – 6703 kilometres

12th August 2016 – 6610 kilometres

5th August 2016 – 6553 kilometres

22nd July 2016 – 6389 kilometres since June 2014

Posted in Electric Bikes

Garage door opener – tiny computer project

Recently we had two new garage doors installed, to replace very old clunky things. The new doors are sectional, insulated and have brand new automatic openers. They are draft free and the temperature in the workshop is a few degrees higher, and the noise level is a lot lower.

With the doors came 4 key ring wireless remotes, and two wireless wall mounted remotes, one of which is mounted between the two doors, and the other is mounted by the connecting door between the garage and the main part of the house. When we bought the doors we considered getting either an external keypad entry, or a wifi base system that used an app on a mobile phone, but the extra cost put us off a bit. Under the covers of the door openers is a connector block, and a connection labelled OSC or O/S/C can be used to connect a momentary switch to control the doors manually, but this is not used in the installation, all controls being wirelessly attached.

Since then I have started to get irritated always having to carry one of the wireless remotes, they are small, but still a nuisance on a key ring, and I am always misplacing or forgetting to carry them. In  particular when I am working in the garden, when I want to use the garage without walking through the house in dirty boots. So I am revisiting the idea of a wifi based door opener, using my phone as the remote. Thing is, I am a user of Arduino, and Raspberry PIs, and have a couple of each lying around, and was pretty certain I could do something myself, and learn something about IoT (internet of things) at the same time.

The obvious place to start is on the internet, and searches found quite a few projects out there, each with their own good ideas and quirkiness. The most interesting of which seemed to be based on relatively new technology called the Onion Omega 2. This is an IoT specialist product. Barely larger than a large postage stamp, this device is reasonably capable Linux based computer (preloaded with linux), with built in wifi, GPIO pins and a bunch of other cool stuff, including very low power consumption. The main board requires an expansion board to be really useful (i.e. to give it a USB port, power supply switches, leds etc),  so the $7-$9 price goes up by another $15, and to control the doors I figured out I would require a relay board, which is available for another $15, and comes with two relays (one for each door).  This relay would be attached to the door openers, at the OSC and zero volts connectors.

So on the promise that I can program in PHP, not just Python or similar, I ordered the necessary bits, and in two or three weeks the courier will knock and I will take possession!

Until then, I thought I would prototype it with a Raspberry PI. Not quite as small, a bit more power hungry, but still a Linux based computer, with USB, power supplies, GPIO pins etc. No wifi built in on my version, but wifi dongles are fairly cheap. I have a spare Raspberry Pi 2 Model B in my box of bits, with a 4GB SD card loaded with Rasbian. Time to get started.

It booted up fine, but previous incarnations of this computer were still on it, namely a display of business related photos that started automatically at start up. I could not for the life of me remember how I did this, as it was at least 4 years ago, so I decided it was time to upgrade my version of Rasbian. A quick visit to the Rasbian download page and I was downloading the latest version, and using the suggested image burner to update my SD card. Except – my 4GB SD guard was no longer big enough! Linux bloat is even affecting tiny computers. Back to the download page and there sitting next to it was a “Lite” version, which does not have the desktop software included. As this computer is to run headless (no monitor, keyboard or mouse) I decided to bite the bullet and go for this version – it will save me the cost of a new Sd card! Downloaded, installed and plugged into the Pi, it was time to start the setup.

To get through the initial steps, I plugged in a mouse and keyboard, and an HDMI monitor. A number of set up changes and software installs are required, including.

  • Change the password to log on to the machine. Use sudo raspi-config.
  • Setting up the date and time zone, and allowing the whole of the SD card to be used as system memory. Use sudo raspi-config.
  • Allowing another computer to SSH into the computer. Use raspi-config again, as described here
  • Installing and enabling an FTP server, Proftpd was the one I used, description here.
  • Installing Apache and PHP, this page is useful
  • Installing the Motion software for the webcam, and allowing the webcam to be used on the local network. Useful webpage here and use sudo nano /etc/motion/motion.conf to change the camera setup as required.
  • Install the software for getting access to the GPIO pins. As I am now using a Raspberry Pi Relay Board, which uses I²C instead of GPIO pins, this has become a bit redundant, but details are here.
  • Some extra work around the SMBUS and I2C tools is required for the Relay hat, this page here will help.
  • Use  sudo visudo to modify  /etc/sudoers.  An extra line is appended to the end of the file, namely www-data ALL=(ALL) NOPASSWD:ALL. Beware - danger!
  • Installing and setting up the wifi dongle (an Edimax Nano type). Instructions here.
  • Setting up a fixed IP address for wlan0 while you are installing the wifi dongle, especially if your router won’t let you reserve IP addresses.
  • Set up a cron job to remove the days image files, useful page here. 
  • Or, instead of a cron job, update the /etc/motion/motion.conf values to switch off recording the images.

There were myriad other little things I had to do, which I didn’t write down or remember. Once I had an IP address for the PI on the local network, I was able to use PuTTY to login to the new machine, and set up an FTP client to look at /var/www – I needed to change the permissions on this directory to get full access to to it. This meant I could remove the HDMI cable, mouse and keyboard, and the ethernet cable.

All this took a few hours of trial and error and finding out what I needed and how to install it, set it up and use it on the web.

At some point I created a “Hello World” PHP web page, and used a browser to look at the new IPaddress, which gave me the standard Apache opening page – index.html. As I wanted to get to index.php I wondered if I had to set up the Apache to look at this page, but I just had to remove the index.html page  from /var/www/html and the .php page was picked up and processed properly.

I added a form with a couple of Submit buttons and played with formats and actions, finally connecting the GPIO pins 17 and 27 to LEDs, and was able to turn LEDs on and off using the webpage on my phone or desktop. As the relays are going to simulate a momentary press, the buttons flashed the LEDs for just a second. I don’t have any relays currently, so this is as far as I can go down this path. I have orderd a Raspberry PI hat with 4 relays on from Nicegear, a NZ supplier, and this should arrive in a day or two and I can go on to the next phase of testing.

However, I don’t want to open and close the doors without making sure there is nothing in the way of the doors. If I am standing outside them with my phone, this is not an issue. If I am sitting upstairs wondering if the doors are shut or not it would be nice to know if they are open, and if the car or bike is parked halfway in! There are many sensors you can add  with safety beams, magnetic sensors etc, but I decided to add a webcam inside the garage allowing me to see the state of both doors.

When I downloaded and installed the Motion software to manage the web cam, it set up the camera on port 8081, and I made a couple of other changes to optimise for the rather slow R-PI and the rather rubbish web cam I found lying on my bits box. It turns out putting the camera onto the web page is as simple as

<img src= "" width="320" height="240"/>

The R-Pi is operating as a web server, serving up a simple web page direct to the  local IP address. It cannot be accessed outside the local network. The PHP program receives the input from a few buttons on the web page, and changes the state of a couple of GPIO pins, which flicks relays on and off, replicating a button press on the garage door opener.

By default the motion software records images when motion is detected, and records a video  until motion stops. This can quickly fill up an SD card. Use the following settings in the /etc/motion/motion.conf to get it all working properly. Framerates and image size may depend on your camera.

output_pictures off (default on)
ffmpeg_output_movies off (default on)
stream_localhost off
daemon on
stream_maxrate 10
framerate 10
weight 320
height 240

As the garage is dark most of the time, I may add a light which will be controlled by one of the spare relays on the PI Hat in order to see what is happening with the video camera.

OK, the relay hat for the PI has arrive, and I spent the first few hours staring at it wondering what I had bought! This is what I bought, a Seeed Studios Raspberry Pi Relay Board V1.0. Looks great, but it took me by surprise. I figured it would work by just setting GPIO pins on and off, on the basis it is plugged into the GPIO pins on the R-Pi. Instead, it uses I²C to connect from chip to chip, and the only pins it uses are the power and ground, and the two oins used for I²C. What this means is that there us a serious lack of information on how to use it. There is a WIKI entry on the page, which is a variation on this original page by John M. Wargo. The information here is not for the novice, and all the code is in Python, which I have little knowledge or experience of. Hours of fruitless searching resulted in no further ideas in how to use it in my PHP pages. I did however look at using Python Scripts in PHP scripts, and it didn’t look too hard.

So, I worked my way through Mr. Wargo’s page, installing and testing the card using a terminal to run the test scripts to test it all worked. I had  couple of things to install/change around the use of SMBus, this page here helped a lot. Eventually satisfying clicks were heard from the relays when the scripts were run from the terminal session.

The next job was to get scripts working in my PHP page. The concept is quite simple, use “exec (python /path/to/scriptname.py)”. In reality it is a little trickier. While the Python scripts run without root permissions in the terminal, to run them from php we need to use “exec (sudo python /path/to/scriptname.py)” . This throws up the issue of Sudo requiring a password to run. There is much about this, and the most common solution comes with dire warnings about using it.

It involves The reason this is so dangerous it that it means the apache user www-data has root permissions without requiring a password, which open up the Pi to all sorts of hacking. If this is important to you,don’t do it. If you do do, use visudo to edit the /etc/sudoers file, as it validates what you are changing. Getting back from a corrupted sudoers file is a pain.

Eventually satisfying clicking sounds were heard from the relays while running my test PHP script.  Two new python scripts were written, each hardcoded to switch a specific relay on then off again 0.2 seconds later, simulating a momentary switch. The python scripts look like this and are remarkable simple, making use of the library of functions provided on Mr. Wargo’s page (relay_lib_seeed.py).

 Switch relay 1 on, wait 0.2 seconds, and switch it off again
 By  Dave Glover
from __future__ import print_function

import sys
import time

from relay_lib_seeed import *



The full source for the single piece of PHP code is given below. The red lines are the two critcal ones for calling the python from within PHP. Security is based on this only being available on my home networks, so if you don’t have access to my networks, you can’t see the page.

<meta name="viewport" content="width=device-width" />
<title>Garage Door Control</title>
<style type="text/css">
body {background-color:lightblue;}
h1 {text-align: center; color:blue;}
img {width:100%; height:auto; display: block; margin: 0 auto;}
.inputform {width:100%; margin:auto; }
.buttonline {width:300px; margin:auto;}
.button {height:25px; width:100px; margin:10px 23px 10px 23px; 
 background-color:blue; color:white;}
.notification {margin:auto; text-align:center; color:blue; margin:20px;}
.footer {
width: 100%;
bottom: 10px;
text-align: center;
font-size: 8pt;

<div class="inputform">
<h1>Door Controls</h1>
<form method="get" action="index.php">

<div class="buttonline">
 <input class="button" type="submit" value="North" name="n">
 <input class="button" type="submit" value="South" name="s">

<div class="buttonline">
 <input class="button" type="submit" value="Video On" name="v">
 <input class="button" type="submit" value="Video Off" name="vo">



 exec('sudo /usr/bin/python /var/www/pirelay/relay_flick_1.py');
 echo '<div class="notification">North door activated</div>';
else if(isset($_GET['s'])){
 exec('sudo /usr/bin/python /var/www/pirelay/relay_flick_2.py');
 echo '<div class="notification">South door activated</div>';

 echo '<div class="notification">Waiting for input</div>';
else {
 echo '<div class="notification">Live video stream</div>';
 echo '<img src= ""/>';
<div id="myfooter" class="footer">
 Copyright Dave Glover (2017<?php if(date('Y') != 2017){echo ' - '.date('Y');}?>)

This is what it looks like

Screen Shot

and it is now installed and waiting for the upgrade to the Onion Omega 2 version!

I made changes to the physical installation, hanging the webcam from a ceiling bracket, so inverting the picture. Back into the camera config using sudo nano /etc/motion/motion.conf and change the Rotate value to 180, and it all looks good again.

Postscript 19/10/2017 – This webcam and garage door opener ran fine for a few days, but started to act badly after a week or so, not responding, SSH stopped working etc. Eventually while investigating what was wrong I got an error message about there being no space on the disk. I an using a 4GB SD card for my system, and it seems that the camera software “Motion” takes still photos and creates videos of everything it sees! This quickly mounts up and eventually the 39,000 images stored on the SD card swamped it! The files live in /var/lib/motion, and using “sudo rm *” is theoretically the way to get rid of them all (after CD /var/lib/motion of course). 39,000 is apparently too many parameters for the command, so I had to break it down into chunks by usin 0*, 1* up to 9* to delete 1/10 of the files at a time. To get round the problem I have added a cron job to remove the files once a day at midnight using “rm /var/lib/motion/*”.

Posted in Computer Stuff, Raspberry Pi

Yuba dashboard upgrade part 2

The new display panel has arrived, and was promptly fitted. Immediate thoughts were that it switched on and worked out of the box! Second thoughts were that the settings were also pretty good out of the box, with the exception of the top speed, which was set to 25kph. This is fine in those  countries with a speed limit, NZ only has a power limit (300w) so I can set the speed limit to anything I like. The number of PAS settings was set to 9, which I have left. One nice feature is that the clock works exactly as it should, and maintains time when switched off or the battery is disconnected, so whatever gave me the idea in the blog below was obviously incorrect.


DPC-14/850C on Yuba

The main display unit fits nicely over the handlebar extension, tucked down out of harms way if I have to turn the bike over to work on tyres etc by the side of the road. I rerouted the main loom and associated cables so they run under the handlebars rather than across the top or on the front. A wire runs from the display to the buttons which you can see on the left hand end of the bars.

DPC-14/850C on Yuba

The buttons can fit over the throttle mounting, giving very easy access with the left hand without any significant movement of the hand. Very ergonomic!

DPC-14/850C control buttons

DPC-14/850C on Yuba – set up from front

I downloaded two manuals for the device, one from a USA retailer (Luna cycles , or Empowered Bikes possibly) and one from the manufacturer (Tianjin APT Science and Technology Co. Ltd). They are noticeably different, in that the manufacturer’s version has 4 extra pages, mostly covering a whole bunch of very attractive advanced features, which duplicate some of those in the controller firmware. When I saw these I really got quite excited, thinking I would have lots of options to control the response of the motor to my riding style. Unfortunately, the reality is that when fitted to my BBS01B motor and controller, only the options documented in the retailers version of the manual are available!

Most of the options are to do with display, analogue versus digital, watts or amps, level of brightness. Others are operational, such as number of PAS settings ( 3,5 or 9), wheel size and speed limit. One nice feature is the ability to lock the device, so that a 4 digit PIN has to be entered before the bike can be used. This is a very useful, as it means the bike can be left with the battery switched on, and the system can not be activated. I once had a customer fiddling with my old bike in the shop, who turned on the bike and twisted the throttle to full. Fortunately, it was only 30cms from a wall, so it didn’t go far.

Pressing the up button for a second or more switches from daylight to night settings, pressing the down button in a similar way puts the bike into walk mode. Walk mode appears to work better than it did with the previous controller, which is a bonus. Pressing both the up and down simultaneously resets trip values – trip kms, trip time, average and maximum speeds.

On the road, the display is easy to read, very clear and right smack in the middle! The buttons are easy to get to, and the controls are pretty much the same as the C963 previously used. I haven’t done too much testing of the power delivery,  it is certainly no less comfortable to ride, and the extra PAS settings appear to be useful, they are different enough to warrant having the extra 4 settings.

Is it worth the money? The bike was perfectly usable with the old display, but I like the extra visibility and usability the new device gives, so yes, I think so.

Posted in Electric Bikes, Yuba Mundo eV4

Yuba dashboard upgrade

A few posts below I mentioned that the handlebar display panel was a fairly standard C963 display panel, branded as a Lekkie. It is based on the KM5S made by King-Meter. A quick review of its capabilities compared to what the KM5S manual contains shows that it is quite heavily customised. I am not sure if this is standard Bafang customisation, or whether it is a combination of Bafang and Lekkie requirements, in order to be able to call he motor a 300W motor. Either way, it is not possible to change the PAS settings to 9 from 5, it is not possible to change the top speed on the display panel, and it is not possible to get into the “Personalizes Parameter Setting” section, where there are many more settings of interest. None of this is a real issue, but I do like to tinker occasionally.

C963 Display Panel

C963 Display Panel

One of the main issues for me is the integration of the control buttons into the display panel. This means that I either have the display panel in the middle of the bars, and have to reach over to the panel to change the settings, or I move the display panel so that the buttons can be used while my hand is still on the left hand grip, which puts the display way over to the left, and because of the swept back bars makes it more difficult to read.

So I started to look around for something better. One or two suppliers of Bafang mid drives have started offering a couple of high end display panels, in some cases they are customised, as in the ones by Luna and EMPowered Bikes, and others seem to be as they come out of the factory, from places such as PSWPower and others. There are two models of interest, the DPC-14/750C  and the DPC-14/850C. Both are colour screens, both have separate push button units attached with waterproof connectors to the main unit.  You can look them both up on the internet, they are for sale in many places, on e-bay, Amazon, DHGate and AliExpress , for around the same price give or take $10.

Reading various forum entries, and write ups on websites of retailers, there are some significant differences. The 750C is landscape mode, whereas the 850C is portrait, and the 750C appears to be much more limited in what it can do. They are both direct replacement for the C963 on the BBS02 centre drive from Bafang, and have similar methods of changing parameters etc. Basic operation seems very similar to the C963, so there will be little extra to learn.

So I have taken the plunge and ordered a DPC-14/850C from AliExpress, which is actually being supplied by PSW Power who appear to be a rebranding of ELife Bikes, whom I bought my first ebike kits from! These are not a cheap unit, about NZ$115 delivered, but I am really looking forward to installing it and setting it up to suit how I want my bike to perform.

You can see a couple of its features below, namely a real voltage meter, a power meter as well as all the usual speed, avg speed, top speed, odo, trip options. It also has a clock, but as this does not have a battery, the clock needs resetting before each use. Great if you really need it, otherwise something to ignore. 3, 5 or 9 PAS levels are available via the settings. Bad points – it says Intelligent at the bottom of the main screen! Apparently while this is in firmware, no one knows how to change it yet.

DPC-14/850c display panel

DPC-14/850c display panel

It is in transit as I write, it left Hong King airport a couple of days ago, depending on how many other courier hub airports it goes through, it may be here in two to five days. Better photos and write up when it arrives.

Posted in Electric Bikes, Yuba Mundo eV4

Windows 7 – Windows 10 couldn’t upgrade error

I get this occasionally on computers that weren’t upgraded during the free Windows 10 period. Every time you go into the update screen, the first thing that pops up is an error regarding the Windows 10 upgrade failing. At first I thought this was a recent error, but t seems it is just a hang over from many months ago.

It is annoying, and difficult to find a solution for. This has worked for me a few times.

Open REGEDIT in administrator mode, and navigate to HKLM/software/microsoft/windows/currentversion/windowsupdate/ and delete the OSUPGRADE folder.

At your own risk, back up your registry before doing it etc.

Posted in Computer Stuff, Windows 10

Yuba – another ride in Kapiti with Lynn

Having spent a hard week in the workshop, and most of Friday and Saturday digging a patch of clay over in the back garden, Lynn and I decided to have a trip out on Sunday. I wanted to show off my new found knowledge of the Kapiti cycle ways, so we put two bikes on the back of the car, and headed off for the south end of Queen Elizabeth park in Paekakariki. Our intention was to find the new cycle way north to Raumati through the park. Unfortunately, it does not yet appear on maps, including the local councils cycle way maps, so we took the Inland Track into the park. This is an excellent walking path, but an exciting cycle path, with steep hills, gravel and grass sections.

We made it to the end, all the time catching glimpses of the smooth well graded tar sealed path to the east which we should have been on. The inland track and the new cycle way came together at the point where we crossed Whareroa Rd, so we were good for the route back. The second half of the park ride was much easier on the tar sealed track, and we arrived at Poplar Ave in short order.  A right turn along Poplar Ave took us to the south end of the Express Way cycle track, and off we went sticking alongside the Express Way.

This really is quite a pleasant ride, easy riding, lots to see, many people to say Hi to as you pass them. Great intersections, where there are special lights for bikes, and gentle hills and corners. We broke our trip north at Nga Manu nature reserve, north of Waikanae. This is just a few hundred metres from the express way, so is an easy diversion. We were hoping for a nice morning coffee break, but the pickings were slim, and we bought a couple of muesli bars, and had a pleasant hour or so walking around the reserve. We were last here over 25 years ago, but not much has changed really.

Back to the express way, and onward to Peka Peka, where we stopped for lunch at Harrison’s cafe at the garden centre. Excellent food and service, delicious coffee, and it was a mild day so we sat near the bikes to keep an eye on them. As we did 4 more e-bikers turned up, in fact two groups of two who seemed to have just met. So 6 e-bikes in the bike racks!

We headed off down to the coast at Peka Peka Beach, and then turned south to head back to the car. This time we managed to find all the correct turnings etc and took the intended route through Waikanae Beach and Paraparaumu Beach. It was not as nice a ride as the mid week ride, the roads were much busier, and some of the drivers were  a little careless around us, cutting us up, driving too close etc. In addition, a southerly wind came up as we rode through Waikanae Beach, at the same point my battery was starting to show signs of being a bit down on power, so the long coast roads were a bit of a struggle.

At Raumati Beach we headed inland, and turned down Matai Rd to avoid some of the coastal wind, and at Poplar Ave we got onto the tar sealed “inland track”. This was a pleasant ride, a bit less windy, no traffic obviously, and great fun swooping up and down the edges of the sand dunes and the farmland. At Whareroa Rd we went straight across and found the track we had missed on the way north, and rode the last few kilometers to Paekakariki. This track does not go into QE park, instead it continues past the park onto Tilley Rd in Paekakariki, which entailed a longish ride back through the village and into the park. Next time we will park at the railways station and ride Tilley Road until we get to the cycle path.

So a good ride together, 52.5 kilometres in 2h40m riding time, about 19km per hour average. One thing we do need is a better bike rack to carry both bikes, our rather old fashioned rack can be a bit of a pain with its hooks and extra rack that needs to be fitted after the first bike is loaded on.

Posted in Electric Bikes, Yuba Mundo eV4

Yuba – another go at the long ride.

So Tuesday 4th July, I took the car back to have the service and WOF finished (replacement radiator and steering rack bracket), and I put the bike on the back again.

Same drill, set off from Kapiti Honda at about 8:00, on a slightly overcast morning, so no sun strike this ride. Rather than use the bicycle path along the Express Way, I used the old SH1 which the Express Way replaced, to see how empty it was.

Being the old state highway, the road is in pretty good condition, with bicycle lanes painted along the side, and some short bike paths at roundabouts and key pinch points. So a quick whizz up past Lindale, over the Otaihanga roundabout, and along into Waikanae, across the lights, and on to Peka Peka. There wasn’t a huge amount of traffic on SH1, obviously all the locals still use it so it is still a busy road at times.

I was much too early for Harrison’s cafe, arriving at 8:35, so I carried on down Peka Peka road to Peka Peka beach. Here a left turn onto Paetawa Rd took me south towards Waikanae Beach. Some maps don’t show the connection between Peka Peka and Waikanae beach, so I am assuming that the Rutherford Rd extension of Paetawa Rd is relatively new (15 years or less). Rutherford Road quickly takes me into Waikanae Beach, turning into Williams Rd as it does.

I got a bit lost here, and ended up taking a fairly circuitous route to get down to Tutere Rd near the water front. Continuing south down Tutere Street and I came to a dead end, but the Kapiti Cycle Route continues on up the Waikanae River on well made tracks, and a little bit of single track where the river has washed some of the track away. I crossed the river on the foot bridge to Otaihanga Domain, and headed down the river through housing developments, again getting slightly lost before finding my way down to the beach road from the Kenakena shopping mall.

Once on the coastal road, it was plain sailing (literally as the wind was on my back) all the way through Paraparaumu beach, to Raumati Beach and then on to Raumati. At Raumati, I stopped at the Raumati Social Club for a cheese scone and a coffee, before continuing on, with a quick detour into Queen Elizabeth park, via Tennis Court Road, Forest Rd and Mackenzie Ave. In the park, I headed for the Inland track to the east, and then rode back out of the park using the new tar sealed bike path. This path joined Poplar Ave opposite Matai Rd, so I rode along Matai Rd to Raumati Rd, under the Express Way and then left onto Rimu Rd, to finish the ride at Kapiti Honda again.

A good distance again, plenty of battery left, and lost of exploration done ready for the next ride with Lynn. Mid week is a great time to ride these small local roads, most drivers are very cycle aware, and it is not too busy. I saw at least 4 other electric bikes, including an electric recumbent trike!

Posted in Electric Bikes, Yuba Mundo eV4

Yuba – a nice long ride

On Tuesday I took my car up the coast to Kapiti Honda to have it serviced and a WOF. Rather than come home again on the train and make a return journey, I strapped the Yuba onto the back of the car. Two tricks I learned – one take the battery off – the bike is heavy enough to lift without that brick attached! Two, turn the front wheel until it is facing backwards, this shortens the bike by a few inches.

So at 8:00 a.m. on a crisp June morning, I set off for a bike ride along the new cycle tracks along side the Kapiti expressway, which goes from Poplar rd in Raumati, to Peka Peka in the north, about 20km each way. At 8 a.m. in the winter, the sun is directly in your eyes virtually the whole way to Peka Peka, maybe I will start a little later next time.Still, most of the time I was watching the scenery and the wildlife – so many Pukekos and Paradise ducks in the wetlands, flood ponds and storm water treatment areas along side the track.

There were quite a few early risers out and about, but the most pleasant thing I saw was the number of secondary school kids riding to school using the new tracks. There were dozens of them, most appeared to be going to Kapiti College I think. What a great thing if a major road development encourages kids to ride bikes to school.

The other nice thing I noticed immediately is how little the noise of the traffic intrudes while you are riding, yes it is there, but it seems to just disappear as you ride.

Harrison’s garden centre has a cafe, so at 9:00 I dropped in for a coffee and a cheese scone, then set off back, and when I got back to Paraparaumu I kept going to the other end of the track, then headed down into Ruamati and along to Raumati Beach, then back into Kapiti Honda. The car wasn’t ready, so I did another couple of loops around the area. Total kms about 47, battery showing 3 bars out of 5, but was dropping to 2 bars under load. Probably could have got 60kms if I had carried on. Great range for a small battery and a big bike!

Posted in Electric Bikes, Yuba Mundo eV4

Electric Yuba – settling in

It seems like weeks since I made the last modification to the bike, other than some panniers, I think it is basically finished. The last mod was a new front brake cable to give a little more slack when handling the bike. I rode down to Pack and Pedal, our LBS to borrow some cable cutters to trim the inner cable, and gave Darryl a view of the bike. He seemed impressed, even if it is not his sort of bike. And that is the story of the Yuba, wherever it goes, people notice it, some smile, some laugh, some comment on some aspect of it but even school kids think it has a certain “coolness” about it.

I overtook another electric bike the other day while going over the ramp in Porirua, one of my computer customers in fact, which surprised me a little, as I know he likes to get a move on when he is riding his bike, which is a German brand with a Bosch motor system. Still felt good though!

I am now up to 330km, which is not a lot, but the weather was particularly foul for the first few weeks of ownership, and the last couple of weeks have been nicer, but I have been busy, and quite a few jobs involve picking up and dropping off fragile computers. However, I am getting the feel of the motor system and the bike. There are definitely tricks and wrinkles to getting the best out of the bike while making it fun to ride. The first is not to be afraid of upping the PAS level when riding hills, yes it uses a bit more power, but it does mean I can pull a higher gear without straining my aging body! The second is to use the gears and to change gear early (because of the gear sensor). A lot of time is spent in higher gears, at a high pedalling cadence with zero assistance, which is great. When the cadence drops, power gradually kicks in which is starting to feel very natural.  It is really difficult to describe all the different subtle things that one learns riding this type of system and bike.

I have taken to riding the local cycle paths to Porirua, through Bothamley park. On the long wheelbase, heavy bike this is so much fun. The bike is steady as a rock, corners so smoothly, rides the bumps on it’s 2.125″ tyres. Downhill is so much fun, completely powered by gravity! Uphill is where the bike comes into its own, with gears and power to spare it really is a fun ride back up to the top! The old ebike was excellent too, just in a different way.

The coffee cup holders built into the rear deck work really well, the sales assistants in Mega Mitre 10 really liked them as I rode through the drive through to pick up some galvanised bolts!

Posted in Electric Bikes, Yuba Mundo eV4

Electric Yuba – well it is a cargo bike!

The build of the Yuba is nearing completion, only one project to complete after the fitting of these bits and pieces.

So the Yuba is a cargo bike, and I bought it to serve as a business vehicle so that I can visit customers within a 10-15km range of the workshop, without spending $6-10 dollars on petrol. It is also a point of difference for the business which I will make more of in the future. You can buy a whole bunch of cargo carrying bits and pieces to fit a Yuba, which are all beautiful bits of kit, but with the prices to match. This was always going to be a budget build, I saved about $2500 to $3000 building it myself, so I am not going to spend another thousand bucks on flash Yuba branded gear that doesn’t quite do what I want.

Luckily, the Yuba comes with lugs, many many lugs, threaded in various sizes, and usually with the correct setscrews already fitted into them. This means that designing and making your own parts is relatively easy.

So phase one was the rear of the bike. The rear rack which is a substantial part of the bike comes without a deck, but has 8 lugs with bolts ready to attach one. I looked at what was available, and decided it was a relatively simple design job. So I measured carefully the position of all the lugs, the diameter of tubes etc, and designed a deck, which I cut out of some building ply I had lying around. As a bit of customization, I cut two cup holders into the deck, so that I can carry a long black (for me) and a large cappuccino for Lynn from our favourite coffee carts to Lynn’s work or to nice parks to drink them.

Phase 1a was the “footboards”. The frame for these is removable, and also comes with lugs. I was in two minds whether to put these on, and still am unsure about whether to continue using them. I am getting my foot caught under them when I set off using the throttle, and my feet trail behind the pedals. However, if they are on they need something to fill in the gaps. Again, fitting lugs were provided, however measuring their positions accurately was much harder, lots of trial and error making paper versions, foamboard versions, and finally ACM (aluminium composite material) versions. Even in the final versions I had to modify the hole positions as I fitted them to the frames! The ACM  is white, so I made some black vinyl graphics to fit.

Phase 2 is a little different, and I am quite lucky with how this worked out. From a source I cannot mention in a public space, but which is totally legal and above board, I acquired a front rack with a delivery box with a rather dilapidated lid. The rack is lightweight aluminium, and may be a prototype rack that was never put into production. However, it was designed to fit a completely different bike, with rack mounting points welded to the head tube. The whole thing is designed to carry about 15kg of weight, 250 days a year for 20km a day. The Yuba has its own front rack (Bread Basket) mounting system, which consists of threaded lugs behind the head tube, through the “boom tube” and the down tube. These are about 60mm further back than the mounts the rack is designed to fit, and a little narrower than the intended fit,

Luckily for me, 20,000km away, I have a son who is a qualified general technician, who has access to some sophisticated CAD/CAM equipment for cutting and bending some rather nice materials. So I again did some very careful measuring, and did a reasonably accurate rough design, which Richard interpreted into two absolutely superb brackets. The bike is not as accurate as the brackets, so I needed to relieve the bike attachment holes in the brackets by a total of 0.5mm to fit the slightly mismatched lugs, but the bolts between the rack and the brackets just slipped through all 6 holes – magic! When all was tightened up, the rack was as firm as could be, really rigidly fixed to the bike.

Pictures of the brackets

Pictures of the rack fitted to the brackets. The orange sections of tubing are covered in a 3M reflective vinyl, the same vinyl which is used for the sign writing at the rear, and around the edge of the footboard frame (covering the scrapes and damage that a shop soiled bike will have). Its a pretty good match for the metallic orange Yuba paint, until you shine headlights on it at night, then its like a big Christmas Yuba!

The lid on the delivery box was unsuitable for what I wanted, with wire supports, transparent panels and all sorts of clever stuff. I liked the way it fitted to the box, so I deconstructed the lid, and used just the part that is yellow, which has all the fitting poppers, eyelets and elastic draw cords. To that I attached a new flat lid panel, made of two layers of a cordura type nylon, with a panel of 10mm closed cell foam (sleeping mat material) sandwiched between them. I reused the bias binding off the original lid to tidy up the sewn edges. The delivery box is big enough for my large laptop case, in which I can carry two laptops, chargers, my eftpos terminal and a variety of cables and knick knacks that I may need at customers premises (the space for a second laptop is reserved for when I need to take a laptop to/from a customer). There is also room for spare waterproofs, hats and gloves etc

The front brake cable was a little short to go either way, around the outside (as in the pictures above) or down the middle like the rest of the cables, and was getting stressed when maneuvering the bike in and out of the garage and parking places. I bought an outer cable about 300mm longer, and a replacement inner cable, and routed the cable down between the rack mounting plates, and looping out to provide as gentle a path as is possible to the V-Brakes. The rear brake and gearchange cables go down the middle and back to the boom and downtubes with little extra stress. The smooth top tube of the rack provides a nice track for the cables to slide along when the wheel is turned. The electric system loom also goes along the handlebars and down the stem and around the head tube quite nicely.

The final project is a pannier, or set of panniers, tailored to fit the rear of the bike, at least one of which will be padded and of a size to carry a desktop computer without it getting damaged or wet. A tall order, but I am part way through the design now, and have all materials ready to go.

Posted in Electric Bikes, Yuba Mundo eV4

Electric Yuba – programming Bafang BBS01B

As I have described before, I am not particularly happy with the performance of the Lekkie 300W mid drive motor out of the box. It’s good, but it does not suit me.

The problem is, we are all different, ride different bikes in different ways, and have our own requirements. The Lekkie Summit 300W is the Bafang BBS01B 350W (I think) which is branded and labelled as a Lekkie, and has its own firmware version which may or may not de-tune it to 300w – whatever 300W means on an electric bike. Not sure who did this, I thought it would have been Paul at EM3EV, but it is different to what I have seen of his firmware, which makes me think it is uniquely Lekkie. Anyway, whoever did it did not know that I weigh 102kg, ride a Yuba cargo bike, and like to pedal fast and get assistance as I ride up hills and along the flat.

I have done a bit of research, which nowadays is incredibly easy, all the hard work has been done and documented on places like Endless Sphere, UK pedelecs and many other places. Thanks guys, much appreciated. Even the home made cables are now available for $16 from suppliers in china.

So I now have a cable, which I got to work after a bit of fiddling – some connection somewhere was intermittent, possibly a dry solder joint on one of the pins on the USB serial adapter.

I will just give a single source for how I did this, a wonderful person called Penoff, who resides in Norway, but I don’t think he is Norwegian! Anyway, he did all the research, created a simple web page and a document that describes how to make a serial adapter, how to connect it and how to use it. Additionally he took the open source software used by provided by Bafang, and rewrote it so that it works, it is in readable, understandable English, and made it available for us all to use. Inside the program folder is a help document that explains how to use it.

However I did read a lot of other stuff, which may be worth while just as background knowledge. Just search for programming BBS01, and lots of stuff pops up.

So, the programming cable goes into the display connection from the motor (you have to unplug the display) and the other end goes into a USB port. Penoff’s program is a single click to get going, and the port being used by the serial adapter should already be in the drop down. If you don’t know which one to use, Penoff explains it all in his document. Switch on the battery, click on connect, and you know it is working when the hardware and software information is populated.

The first job is to Read Flash – which reads the settings from the controller into the program. At this point I save them to a file called Lekkie 300.el, in case I wanted to revert to them later.

At this point I was a little surprised by the values already programmed into the controller – they are already quite aggressive and not far off what I was going to change them too anyway. In particular, the Speed Limits on each assistance level were already all set to 100%. Not what I was expecting, but they are what I was eventually going to change them to. Images of the settings follow.

Next I changed the values I wanted to change, and used write flash to update the settings on the controller, then did a read flash to make sure they were right.

So what did I change and why?

On the basic screen, nothing. If the Current Limit had been 15 as I was expecting, I would have changed it to 18, but that’s what it was already. This would have allowed for more current and more torque. However, I think the C963 control panel may override this value, and the control panel is locked down so that I can’t get to this value.

If the speed limit values had been something other than 100% for each pedal assist I would have changed them (but may have gone for a spread from 75% to 100% over the 5 usable values). Changing the Speed Limits means that the drop off as the cadence rises is delayed until much later, as it will attempt to get to the full programmed speed limit in each setting.

On the Pedal Assist screen I changed a few values.

I left speed limit at 40kph, it will never get to it, but it means that the % of speed limit will be a percentage of 40kph, not a % of 32kph (20mph), so it will not cut out too early.

I changed the Start Degree from 4 to 10, as I like a little leeway when I start pedaling before it kicks in.

I changed the Current Delay to 8 from 6, 8 is the maximum, and it means that the current does not decay until the latest point on the cadence range.

I also changed Keep Current to 100% for the same reason.

On the throttle page, I reduced the Speed Limit to 32kph and I may decrease the designated assist later. 9 gives 100% current and 100% of the speed limit, but I am not too keen on an aggressive throttle, level 5 would suffice.

And that is it, I did 23k on it today, and while it will never be a racer, I can now ride comfortably both slowly and at a reasonable speed along the flats and uphills, without using any PAS level higher than 3. It seems to be more efficient using power, I get help when I need it at a reasonable level, which stops me winding on the throttle or kicking the PAS level up to 4 or 5 so that I get assistance when I am pedaling at a higher cadence. So a nice easy job, and great results.

The C963 display panel is also branded Lekkie, and is a King Meter KM5S model under the skin. However, there are aspects of this meter which can be programmed by the user normally using the Personalised Parameter Setting functions. Unfortunately this display appears to have been modified so that this function can’t be used. This means I cannot change the available PAS levels from 5 to 9, but it also means that the “Controller Over-Current Cut Setting” may be set to 15A or 300W rather than the 18A or 350W which the controller is set to. I might be totally wrong on this whole thing, but I feel this is how the kit is sold as a 300W system.

Maybe I will acquire a non branded controller and see what I can do.

Posted in Electric Bikes, Yuba Mundo eV4