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

VPN – Virtual Private Network

I had been quite happily using another VPN for several years, mainly to watch some european sports channels I subscribe to. However, one day it stopped working, and when I queried the help desk they were little use, basically telling me that it was my problem.

So I looked around and found Airvpn.

Airvpn provides the number of servers I need, they provide a quality service, and they provide a user interface (called Eddie) which works in Windows and Ubuntu. The cost is very reasonable, with daily, weekly monthly and yearly options available. So far, after several months use, Airvpn looks like really good value. Click on the picture below to go to their site.

Air VPN - The air to breathe the real Internet

Posted in Computer Stuff

Another Unfortunate Scam

Its sad when someone tries their best to solve problems for them selves and get scammed by some lowlife. This customer of mine had a small issue with her log on to get her Yahoo Mail, just a bit of a password problem. So she went onto the yahoo website, and saw what she thought was a link to the Yahoo help desk. She contacted the organisation, and was given a local (Auckland) number to call.
These people apparently spent several hours working on her machine, and other than thick accents seemed reasonable people. But bear in mind this customer is probably well passed retirement age and so thinks any body who helps her is wonderful.
Anyway, the service technicians politely but forcefully told her that her software was out of date and had to be replaced otherwise they could not help her. Fair enough she was using Windows Live Mail, but I have no problem with that. So they sold her a copy of the full version of Office 2016 for $399 NZ (including Visio and Publisher). If this was a valid sale, and had she needed this software, this price is quite reasonable. They also told her that her anti virus was not good enough. When she told them she had Windows security Essentials, they told her that this no longer ran on windows 7 and she had to replace it. So they sold her a copy of Norton 360 with a 3 year licence. All this was paid for with a bank draft via her local bank, who actually allowed her to do it!
Office was duly installed, her account switched over, emails moved from windows live mail to Outlook, and her contacts moved over. Except the contacts weren’t moved correctly, the mapping between the two system was not done correctly, and no email addresses were transferred over. In the p0rocess of trying to fix this, the technicians created a second profile for outlook,set up a duplicate account on it, and half fixed the contacts.
What she ended up with was an outlook system that just did not work. It defaulted to a profile which dod not have any of her email folders moved over, and only had half her contacts. If you forced it into the other profile, the emails folders were an appalling mess, with gmail folders within her yahoo folders. This caused IMAP synchronisation to take 30 minutes or so, every time she started outlook.

This is where I got called in. At this point she was still convinced that these people were honest and decent, but just a bit frustrated with her account set up. I spent a couple of hours analysing what they had done. I deleted all the profiles created by the technicians, created a new profile, set up her yahoo account in it as a pop3 account, and moved her emails and contacts order from windows live mail, giving her a usable email system on outlook. All well and good so far.
I also got rid of LogMeIn GoToOpener, their means of getting access to her PC. I changed her email password to as they had access to that at some time.

As a follow up I looked at how office had been licenced, and did not find a COA on her system, nor had she been sent one. And this is where the real scam comes in I think. Office has been installed and activated using a microsoft account, probably belonging to the organisation. If anything goes wrong with office she will have to get back to them to fix it. More importantly, they can, at any time remove her computer from there microsoft account, and her version of Office will not be activated.

So these low lives have taken NZ$500 of this customer and given her nothing. If office continues to work, we have no idea if it is a legal copy or a pirated copy, but I doubt if it is a real licence in her name.

So who are these people? They go by the name of MacGeeks PTY Ltd, and are supposedly based in Australia, but have offices in the USA too. The name of the owner of the domain name and the accents of the techicians makes me think this is just another Indian scamming company. They have a web address that is no longer working macgeeks.com.au, and they also use this web address for emails https://www.mycsdesk.com/

Posted in Computer Stuff

New Home Computer

It’s not often I splash out on a new computer, normally my computers are Frankenstein machines rescued and upgraded using stuff abandoned by customers.
However, the last computer I bought for home, about 10 years ago, was starting to show its age. It is an Acer L3600, with a dual core E4600 processor, originally with 1GB of ram and a 500GB HDD, running Vista Media Centre edition, to make use of the Yuan TV card installed in it.
It served for 10 years as our “entertainment” PC, placed in the home entertainment system cabinet, and connected to the TV, VHS player, amplifier etc. When new it was reasonably quiet, and being small form factor (3litre – the size of a wine box) fitted quite nicely.
Over the years it acquired more ram, eventually reaching 4GB, moved from Vista to Windows 7, 8, 8.1 and 10, was dual booted into Ubuntu 12.04, 14.04, 16.04 and 17.10 at various times, and the HDD went from 500GB to 1TB, and eventually back to a 240GB SSD! I think I have sworn more at this computer than any other computer I have used!
Any way, I finally reached breaking point. After cleaning up windows 10, sorting out my router, and using a new VPN provider, I finally worked out that the dual core processor was not up to streaming full HD TV. As some of the sports we watch most frequently (cycling, WRC rallying, Formula 1) seem to only come in HD nowadays a change was due.
But money is tight, what to do? It had to be small, quiet, and fast enough to show full HD on our TV, streamed from sites in Europe mostly. I reckoned I would reuse the 240GB Kingston Solid State Disk, and that some where on my spares wall I would have any sort of ram required, and I would transfer Windows 10 from my existing system to the new (with the SSD), so a bare bones box was required.
I had a customer bring an Intel NUC i7 device in a few months ago, which was nice but a bit overkill. But, PBTech could supply me with a NUC6CAYH barebones computer. The spec of this is Intel Celeron J3455 Quad core ,up to 2.3GHz (but actually 1.5GHz),1 X SATA3 Support 2.5inch Drive , 2 X DDR3L SODIMM HDMI 2.0 / VGA, 4 X USB3.0, SDXC Slot, Intel Wireless AC 3168/ Bluetooth 4.2. Into this I slotted 8GB of PC3L 12800 ram I had sitting in an abandoned laptop, and my SSD as mentioned before. Its main features however are its size (120 by 120 by 40mm or thereabouts) and its silence. I don’t think is has a fan, but the BIOS and all the reviews mention fan speed – I haven’t heard it yet!
The build was easy, first of all if you use PC3 ram rather than PC3L ram (or DDR3 instead of DDR3L) it just shows a blank screen – nothing, no beeps. PC3L is 1.35V instead of 1.5V hence the L I suppose. Once you get the right ram, away it goes. SSR just fits in into the base, easy to get to.
I backed up my SSD and bit the bullet and ran a Windows 10 install for Windows 10 Pro, then an upgrade to Windows 10 1709 – Fall Creators, and then got it up to date with all outstanding updates. The only real issues were with PCI Simple Communication Controllers – as usual with Windows 10 installs. The other issue was reusing the license key from the Windows 10 Pro 32 bit installation on the SSD for a fresh install of Windows 10 Pro 64 bit. It was very keen on me buying a new key. But with a bit of persistence, I manage to attach the license key to my Microsoft account, and then had the option of going through the updated hardware path, where I could register that the PC was actually the same one as the previous PC with changed hardware, which it is (well the SDD is the same, and it is a replacement for it). So all legal and activated – Microsoft say so!
Then I installed Ubuntu 17.10, and set the machine up as dual boot. The drive is partitioned 200GB for Windows, 40GB for Ubuntu. As Ubuntu can see Windows files OK, but Windows can’t see Ubuntu files, this split of the disk works for me.
Windows and Ubuntu have been set up to be just entertainment devices. Most stuff runs on Ubuntu well enough, there is one TV channel in the UK that insists on using Adobe Flash and DRM together, which cannot and does not work on a Linux based machine, so Windows will persist on this machine until they sort that out.
Both OS use the HDMI as the audio output, so all sound goes via the Panasonic 40″ TV, but the optical audio out from the TV goes into my Onkyo amp and some good speakers, so picture and sound are good, without having to change my amplifier settings.
So far it is really an excellent set up. I am using AirVPN as my VPN service which so far has been faultless (much better than Private Tunnel, which stopped working when I swapped my router). The old Spark router (HG630B) was swapped for a better Spark router (HG659B)that a customer asked me to dispose of as Spark had sent them two! This router has a 5G channel, and this makes the WIFI connection for the new PC much better – as everything else in the house is 2.4MHz only.
We watched 2 hours of the China Formula 1 last night, no hesitation, full frame rate, full HD from start to finish. First time I have done that ever! We are looking forward to coverage of the Giro d’Italia and the Tour de France later in the year, F1 races either in highlight or full form as supplied by the UK channel and the rest of the WRC season from now until November.

Posted in Computer Stuff, Windows 10

Ebikes – DBMS issues with counterfeit parts

The DBMS worked fine for 50 or 60 km, but the behaviour of the various components – batteries, motor and controller and DBMS started to get erratic, and it started to get difficult to tell what was going wrong. I slowly removed items until I was back to a normal set up on both bikes, which seem to worlk normally with their own batteries and no DBMS. The DBMS seemed to be the main factor causing issues.

So having taken it off the bike I started bench testing with the lid off.

With just one battery connected, the Arduino fired up normally, and +5v was delivered to one of the relays, so the 50v-5v dc-dc converter appears to be working fine, and probably the diode too.

However, neither operating light was on on the relays. I tested the output of the relay which was receiving the switching signal, and it was giving 40V across it’s output terminals. However, when I tested the other relay, so was it!

When I disconnected the battery, I tested the resistance across the relay outputs, which should have been open connections, however I was getting zero ohms across both. So when the battery was connected, even without the computer connected, both relays were in the “On” status, so power was  passing through one relay, to the common output, and back through the other relay.

I removed a relay from the DBMS and opened it up. This is where it gets disturbing. Firstly there was signs of overheating around the terminals of the MOS Field Effect Transistor (MOSFET) which provides the main switching. When I tested the MOSFET, it was a dead short across the output terminals.

I moved the MOSFET so that I could read the part number which was IRFP250N. This is an interesting device, but is only rated at 30amps, and that at only 10V for continuous use. Given that the relay is supposed to be 60V 40A, this single MOSFET was not going to manage that very well!

The rest of the circuitry is interesting. When I ordered the part from https://www.ebay.com/usr/fashionstyle6?ul_noapp=true I assumed I would get a Fotek device like in the photo. Now the Fotek device has a couple of good attibutes. Firstly, Fotek has a reasonably good reputation, they provide good equipment at good prices. Secondly, the SSR-40 DD is an optically isolated device. This means that the control circuit, which is 3v to 32v and which I drive at 5v from my arduino, is completely isolated from the swiched output side, which I put up to 40V 10A though. The isolation is done with an opto-coupler which is an LED and a photosensitive cell in a tiny device, the input circuit causes the LED to shine, and the output circuit detects the LED shining and switches the relay terminals on and off.

One of the big advantages of this is it removes the need for a common earth – the two circuits can be completely separate. The other advantage is that if anything goes wrong, like a huge current surge of the output side, it will never ever get back to the input side and my arduino microprocessor.

What arrived was a CNMF part. When I took the failed unit apart and saw the under specced MOSFET, I wondered what else was wrong. It all looked quite good, well soldered, lots of resin around the parts etc.

The first thing I looked for was the Opto-coupler. While I am not an expert, I am fairly certain that there isn’t one on the circuit board. In fact there is a small transformer like device which seems to take its place. I examined the circuit further and I realised that the two sides of the relay were not isolated at all.

Power from the 5V input passes through the LED power indicator, and connects directly to the signal terminal  of the MOSFET, For this to work, both circuits must use a common ground, and when you trace the circuitry, this is in fact the case.

The result of this is that this is not a Relay at all, just a simple electronic switch. There is no isolation of the two circuits. A bit disappointing really, total rip off by these people https://www.ebay.com/usr/fashionstyle6?ul_noapp=true

Posted in Arduino, Computer Stuff, Dual Battery Management System, Electric Bikes, Other Technology, Yuba Mundo eV4

Ebikes – dual battery managment system more riding.

Two more days of testing, a week apart, building on the numbers from day one.

Total kilometres over the three days 66.4  and total time on road 3h22m, giving an average of speed of 20kph or thereabouts. The bike was definitely starting to get sluggish towards the end, and the gauge on the bike was showing either one bar or three bars depending on the battery.

Total Watt Hours used was 488.6, much less than the 1008 Wh calculated from 36 volts times 28Ah (13Ah plus 15Ah). Total amp hours used was 13.6.

Start voltage on the Lekkie on day one was 40.72, and it dropped 4.52V over the three days to 36.27 (at rest), and the Headway started at 40.2, and dropped 3.76 to 37.14.

If the total weight of me and the bike wasn’t close to 150KG, and if the climb each day was not 160metres, there might be some distance left in these batteries. On a long flat run without the hills I can see these figures getting closer to a 90 kilometre range. That should be another test in the near future.

Glitches with power drop, or Dead Spots are to do with the BMS or the state of one battery. Sudden heavy draw on the headway battery (twisting the throttle quickly, or switching batteries under full load) seems to make the Battery Management System switch the battery off briefly. This sort of implies a weak cell or a bad, intermittent connection somewhere internally, which is not showing itself in any other way at the moment. It takes a few seconds to recover, and it only really happens when the battery is really fresh, when the power is down a bit, its all good.

Swapping from one battery to the other becomes more obvious as the batteries lose power. The Lekkie battery is definitely much weaker than the Headway battery. There are still a few interesting features with using the two batteries together which I have to get my head around yet, but the DBMS and the Digital Power meter are both working well. Three full days travelling to Porirua and back is about as good as I could expect out of two batteries, 1.5 trips was about as good as I got out of each battery separately, and this bike is much heavier with a high rolling resistance!

The power meter is quite interesting in that at the end of the second day, the recorded Watt Hours used was 335.5, but when switched on at the start of the third day was 328.1. The only difference I can see is that a different battery was switched on with a lower voltage – implying the display is voltage dependent or it just doesn’t remember things very well. However, the bikes main display showed 66.4km total distance at the end of the third day, but when I connected the lower voltage battery read 65.8Km. Again, it looks like the display is voltage dependent. More analyses needed on these features.

I have uploaded a spreadsheet of all figures for the test here. DBMS Testing

Posted in Arduino, Dual Battery Management System, Electric Bikes, Programming, Yuba Mundo eV4

Ebikes – dual battery management system – first rides

I have waterproofed both the DBMS and the power meter, so am feeling a bit happier about going out for a ride or two.

I did my first ride just after I finished the basic unit, but it was all a bit short and hilly to get a grip on what was happening. I had a “dead spot” where power to the motor stopped for a few seconds, so wasn’t sure what was happening after that. However, I did 10-12km, and used power from both batteries, so something was working.

Today I went out with both batteries fully charged, the trip reset, and the power meter reset. Unfortunately, at the moment I have no data logging set up, nor do I have anyway of being sure which battery is attached at any instant. On steep hills, the new battery does suffer from more voltage drop, but normally the differences and the change overs are so subtle, I have no idea which battery is in use. Additionally, there is a good chance that at the point the processor decides to test the battery voltages I will be using no power, so the system may well stay on the same battery! Only when the first battery has been used enough to take the voltage below the second battery can we guarantee a battery change.

The power meter is excellent, easily readable even with polarised sunnies on, clear read out of volts, amps and watts, and 2 second scrolling through all the other various highs, lows and AmpHours and WattHours readings. In particular, the “uptime” is quite useful, I can work out when the next battery change might happen.

Start voltage on the 13Ah bottle battery was 40.72V, and on the 15Ah headway battery was about 40.2V.

I did 21.2Km, I was  moving for 62 minutes, and the DBMS was turned on for 69mins.

The whole system used 4.66Ah, or 171.8Wh. Peak amps was 14.97, Peak Watts was 551W. Lowest voltage recorded was 33V. Possible a connection not made properly, or a problem with the switch over algorithm.

At the end, Bottle battery was at 38.71, and Headway was at 39.76.

At the finish, the system was switched onto the headway battery, probably because the bottle battery had dropped below the voltage of the Headway. On a short ride like this one, balancing battery usage is not likely, but double the distance and we may start to see more equal usage of the batteries.

I got a couple of “dead spots” but I still have no idea what is causing it, some serious thinking and analysis required. The low voltage of 33V that was recorded may be some part of the problem.

I am not going to charge the batteries or reset the trip or Powermeter, so the figures may get more meaningful on the next trip.

The watt meter on the King Meter display unit from Lekkie was inaccurate most of the time, reading between 30W and 100W high. Even the battery bars indicator bore little relationship to the actual voltage being recorded.

Eventually, I would like to detect the ampage within the DBMS, and calculate watts and WattHours, and use these to make a more sophisticated battery switch algorithm, and also add a data logger to record volts, amps, time and battery selected, which I could analyse in a spreadsheet. This may help with ironing out the small issues.

Soon, maybe. 🙂



Posted in Arduino, Dual Battery Management System, Electric Bikes, Programming, Yuba Mundo eV4

Ebikes – dual battery management system – build and install


After a few months of designing, prototyping and waiting for all the components to arrive, I finally had enough to build a working, install-able prototype of my Dual Battery Management system.

DBMS installed on yuba

DBMS installed on Yuba

It is still a prototype, and like all prototypes is too big, too heavy and too expensive. I am not an electronic designer, and despite dabbling for over 50 years, I am still incompetent with most aspects. So this device uses pre-made off the shelf components. If I was to have a thousand made in a factory somewhere, it would be a single board in a tiny case.

Even when the components finally arrived, I was still adding ideas and concepts, the most recent being adding a power meter to aid testing and development. More about this in another post. But it did involve a rather large “shunt” – a device which copes with large ampages, has a very low resistance, and allows amps to be translated into millivolts for measurement.



As you can see, it is large, 130mm long, 30mm wide and 38mm high, and heavy (250g?). This spoiled my proposed layout even into the new larger case I am using.

This case is 140mm long, and its internal width is 108mm. It comes in two identical pieces, which slot into each other along the edges, and has two end plates which hold it all together. Not by design waterproof, but I can work on that.

So I spent many hours arranging and rearranging components until I was happy enough with the layout to commit to cutting and drilling stuff.

Basic layout of components

Basic layout of components

First in was the shunt. A fair chunk of the 130mm length was the plastic plinth. The case half comes with a slot for mounting printed circuit boards (PCBs) in. The actual internal width of the case is 110mm, but the “groove” consists of two ridges along the length of the case, about a 1mm high, one at 8mm and the other at 11mm from the bottom approximately. I very carefully cut the plinth to exactly 110mm wide, and then cuts slots in the ends to match the PCB groove. The shunt now slides into the case and is securely held by the PCB groove.

The two relays were fitted next. These have heat sink plates built into them, so are held securely to the base with 4mm countersunk setscrews and nuts, with a smear of thermal paste to make good contact with the case, just in case they get warm. As the are well overrated for the task, this is unlikely.

Next in is the DC-DC converter, from up to 50V to 5v 3a. This is required to power the Arduino microprocessor, yet to be fitted in this photo.

Finally, a rectifying diode (two diodes with a common cathode) was attached to a piece of heatsink, which was attached to the case with a 2.5mm set screw, and a smear of thermal paste, but again this is well over specified for the task, so it is not likely to get warm. Its purpose is to take power from both batteries without allowing the batteries to discharge through each other, but provide a voltage to the power supply regardless of which battery is attached, or if both are attached, whichever has the highest voltage.

At this point it looks quite nice, almost elegant!

However …

High Voltage, high current wiring added

High Voltage, high current wiring added

the next step was to drill the end plate and install the 3 main high voltage, high current wires. These feed the two batteries into the device, and feed power to the motor controller. The bottom two wires are the battery wires. The ground wire from each of these goes to the same end of the shunt, crimped into high current eye connectors, and bolted down very securely to the shunt (M8 bolt!). The live wire from each does to the positive connection of a relay, one to each relay. Again, high current eye connectors under the retaining screw of the relay.

The negative side of the outputs from the relays are both connected to the single live wire of the cable which goes to the motor controller. You can just see the red wire between the two relay terminals. The ground wire from the motor controller goes to the other end of the shunt. The motor controller gets power from whichever relay is turned on at the time, and the relays ensure there is no possibility of one battery discharging through the other (so long as only one relay is on at a time). The power returns from the motor controller, and passes through the shunt back to the batteries. The minuscule resistance in the shunt causes an equally minuscule voltage drop between the two ends of the shunt (50mV at 100A – so 5mV at the usual 10 amp usage while the motor is running).

Still looks pretty good, eh?

Low current wiring added

Low current wiring added

So here we have added most of the low current wiring. First of all wires are run from the positive connections on the output of each relay to the anodes of the rectifier diode. The cathode of the diode is connected to the input of the DC-DC converter. The negative of the DC-DC converter is connected to the battery end of the shunt, which is used as the common ground for the whole device.

The output from the DC -DC is 5V up to 3A, which is connected via a micro USB cable to a SparkFun ProMicro arduino clone (from now on called the arduino). This is tiny (30mm by 17mm) and I am using it without header pins, soldering directly to the board. The arduino and all its connections are shrink wrapped in clear tubing, and mounted to the top of the relay with a piece of double sided foam tape. The ProMicro does not have mounting holes.

There are minimal connections into and out of the Arduino. Firstly there are two inputs, which allow the arduino sense the voltage of each of the two attached batteries. Wires are attached directly to the positive side of the relays again, and are attached eventually to the analog A0 and A1 pins of the arduino. However, the battery voltages are in the rage 33-41V, and cannot be connected directly to the arduino, which operates at 5V maximum. To drop the voltage voltage splitters are used, these are simple a pair of resistors, 390k ohms (r1) and 30k ohms (r2) connected in series between the +ve from the battery and earth. A take off is taken from between the r1 and r2, which is connected to the analog inputs of the arduino. The splitter formula is

Vout = Vin (r2/(r1+r2)

or in this vase Vout = Vin * 30,000 /(30,000+390,000)

which works out to Vin/14,  or 3V maximum with a 42V Vin.

The splitters are the lumpy red shrink wrapped wires running from the arduino up the side of the shunt.

The second set of connections  is the output from the arduino, which is through digital pins D6 and D7.

These are set to high or low depending on the programming of the arduino. In this case, every 150,000 milliseconds, the arduino tests the voltages of the two batteries, and sets one of the two pins to high, and after a 20mS delay, sets the other to low.

D6 and D7 are connected to the positive side of the input end of the relays (the end at the bottom of the pictures, the thin orange and yellow wires). The negative terminals of the relay are connected to the GND pins of the arduino board.

The net result is that the relay for whichever battery has the highest voltage is switched on, and 20mS later the other is switched off. The slight delay allows the relays to do their job, but the time is not enough for the batteries to do any damage.

The last connection is a wire between the negative of one of the relay inputs to the common ground on the shunt, which is just an extra safeguard to make sure the arduino is connected to the common ground directly, not just through the DC-DC converter.

OK, one final connection …

Completed wiring

Completed wiring

In this picture an output cable to the Power meter has been added. This has three connections.

First is a positive connection, which as this provides the voltage for the voltage part of the meter, is connected to the positive wire of the motor controller, where it attaches to the -Ve connection of the relay output!

Second is a connection to the common ground at the bottom end of the shunt. This acts as the GND for the meter, as well as one of the ammeter connections.

Thirdly, a wire is connected to top end of the shunt. This is the other ammeter connection.




Fortunately, the Yuba Mundo has stacks of room, and as many 5mm lugs welded in to the frame as you could possibly want.

I chose to install it in front of the back wheel, behind the bottom bracket. This meant for easy, short cable runs.

The case comes with T slots down the side of the case, you can see them on top of the device above, and in the end view photo at the top of this post.

I got some 1/8″ set screws, and filed one side of the head so that the screws slid into the T-Slots, and were held secure when the nuts were tightened on them. 6 of these bolts, three in each side of the case attach the case to a piece of 3mm aluminium plate, 40mm wide, and 200mm long. Mounting holes and brackets to fit lugs on the frame were added, and the whole device is securely and neatly mounted onto the frame of the bike. Wires from the two batteries connect easily to the device, and the wire from the motor controller plugs in to its wire. The power meter wire is threaded around the bike, and connected to the power meter which is on a bracket in the centre of the handlebars.

Power meter

Power meter

At this stage the power meter is not waterproof, so will be taken off when used in rain, and the device itself needs a bit of waterproofing also, which it will need sooner rather than later, as it is not easily removed.

More to come on first rides, development of the software, the worth of the power meter, and plans for a data logger using the spare capacity of the arduino.

Posted in Arduino, Computer Stuff, Dual Battery Management System, Electric Bikes, Programming, Yuba Mundo eV4

Counterfeit Laptop Power Supplies

A few months ago, I supplied a Dell charger and battery for an older laptop. Because I wanted to get them at the same time, with a single postage charge, and the battery was quite difficult to find, when I found a site that had both available, namely adaptershop.co.nz, I ordered them both. I realised this is a Chinese site with an NZ website  address, but I have had no difficulties with these types of suppliers in the past, especially when dealing with hard to get stuff.

All this started to wrong when they contacted me and told me that the battery was not available, would I like a full refund or to just get the charger. Being impatient, I decided to continue with the charger and just pay for it. I ordered the battery elsewhere.

When they both arrived, the customer brought back the loan charger I had supplied, and took the battery and charger away untested. A few weks later I got an email about the charger and battery not working, and another few weeks later, the laptop and charger was dropped off. Simple testing showed that the charger was providing some volts and amps, but was not being recognised as a Dell charger, so it was faulty in some way.

The new charger weighs significantly less than an original charger, but I thought that was down to new technology. A closer inspection of the labels shows that all the Dell trademarks etc look genuine, but the English on the label is terrible – Techogogy instead of Technology, Inddor instead of Indoor and some other spelling mistakes. See the photos above

So Adapter Shop Co,. Ltd as their invoice reads, is selling counterfeit Dell chargers as real ones. I doubt I will get any money back on this one, so a lesson has been learned.

Posted in Computer Stuff, Other Technology

EBikes – Dual Battery Management System

The only commercial developer of dual battery electric bikes I have seen to date is Bosch, who do an optional Dual Battery kit, which one or two manufacturers have taken up. Being proprietary technology, there is not a lot out there about it. The only two things I can glean are:

1. The real technology is in the Bosch controller, which manages use of the battery, charging and showing information about the batteries on the dashboard. This means it cannot be retrofitted to an earlier Bosch system yet.

2. It doesn’t connect the batteries in parallel, it switches to a battery and uses 10% of power, then switches to the other battery and uses 10% and repeats. This is designed to make sure a battery does not get too “tired” and can recover somewhat before being used again. This will extend the short term range of the two batteries, apparently more than doubling the range of a single battery, and presumably will also extend the life of the cells in the batteries.

This is great, but I cannot afford a bike with a Bosch system, especially as I have only just built my latest Bafang based bike.

Why do I want dual batteries? Firstly, the 13Ah battery supplied with the kit, while only 2 Ah less than the self build Headway battery I was using, is getting a bit frustrating, and secondly I have an excellent 36v 12 cell 15Ah LiFePO4 headway cell battery sitting on a bench not doing much. I could re-purpose the cells, but being able to use them to increase my bike from 430Wh to 1008Wh is quite attractive. These two batteries are an interesting combination. The 13aH Lekkie, is made from 18650 (18mm diameter by 65mm long) cells, some sort of LiPo (Lithium Polymer) probably, each cell being about 3.3 to 3.9 volts. 4 or 5 are grouped in parallel to give the 13 Ah and 10 groups connected in series to give the nominal 36v. The other is made of 40152 Headway cells (40mm by 152mm), each 15Ah, with a voltage range of 3.0 to 3.6v. 12 are connected in parallel to give the 36v nominal. The former weighs 3Kg and sits very neatly on the downtube, the latter is 8Kg and sits in a pair of plastic panniers on the rear rack! http://www.signsofsuccess.co.nz/batteries/ and http://www.signsofsuccess.co.nz/electric-bikes-back-again/

So what do I want this dual battery system to do?

1. I want both batteries to be physically attached for the whole ride, no stopping to physically swap cables etc.

2. I want the system to automatically swap the connection from one battery to another on the fly – no loss of power, no stopping to flick a switch etc. This means it will need to “make before break” – connect the next battery, and when connected, disconnect the previous battery so that it can rest. If a batteries voltage is less than the battery currently in use, the system will stay with the current battery.

3. It must cope with only one battery being connected at a time, or both.

4. There must be no connection between the two batteries while in use, other than the momentary “make before break”, so that the batteries do not attempt to equalize their states of charge.

5. The system shall be self powered by one or other of the attached batteries, no extra connection or battery will be necessary. Battery equalization through this power supply is to be avoided.

6. This is a development platform, the battery swap time, the delay between make and break and the swap algorithm should be easily reprogrammed.

7. It should look good on the bike, and be completely weatherproof, using the Lekkie/Bafang weatherproof connectors used to connect the motor and battery on a standard system.

8. Reverting back to a single battery should be easy and free – no damage to existing components.

How do I propose to achieve all this?

For the working prototype I have the following ideas.

  1. Obviously some reasonably simple control is required, I will use an Arduino micro processor to run a simple C program. I have experience of C on the Arduino, I have two development platforms I can develop and test the components on, and tiny versions are available which take up very little room, yet do everything I need them to do.
  2. Arduino devices run on 5v (or 3.3v) power, and this can be supplied directly to the board via the headers, or can be supplied via a micro USB  plug. To run this off the bike batteries I will need two things. The first is a DC-DC voltage converter, with an input voltage that can cope with a variety of batteries in various states of charge (12s – 41v to  33v, other batteries up to 60v). These converters are readily available. The second is a pair of diodes (or a single diode with two cathodes) so that both batteries can be connected to the input of the voltage converter, without the higher voltage battery trying to charge the lower voltage battery. I have a diode rated at up to 100v (60v RMS) and runs at 20A, with a 150A surge, which should cover all bases!
  3. The Arduino program will use two digital output pins to control two solid state relays (SSR). These SSRs optically isolate the high voltage circuit from the low voltage circuit allowing the relays to be used on the battery positives. They also stop any back flow from one battery to another. Other solutions using MOSFETs have issues with common grounds etc. In addition, the SSRs come ready built, just plug and play. I am using 100v 40 amp relays, to give a bit of leeway (maximum voltage should be about 42V, maximum current should be about 18A).
  4. In order for the Arduino to measure the state of charge of each battery, analog pins on the Arduino will be connected to the positives of each battery. Arduino analog pins have a maximum voltage of 5V, so voltage splitters will be added to reduce the voltage to under 5v, I will be using an 11 to 1 ratio between input and output, so 44v will be reduced to 4v for the Arduino.
  5. The program on the Arduino is quite simple (at the moment). Every 5 or 10 minutes (to be decided) the program will read the voltage of both inputs, and whichever has the highest value will be connected as the next battery, and after a short pause for the relay to do its work (10ms) the previous battery will be disconnected. If a battery is faulty or not connected, the voltage test will ensure that only the working or attached battery will be selected. 10% of usage on my batteries is between 7 and 9 minutes, so a simple timer will have a similar effect to using power meters to decide when to swap. Because the unit will have no switch, it will activate as soon a the first battery is attached, and that battery will be the selected battery. An initial pause of 30 seconds before the first automatic switch will allow both batteries to be connected, and the highest voltage battery to be used.
    // global variables
    //debug variable
    //#define debug 1
    //relay output pins
    const int r1Pin = 7 ;
    const int r2Pin = 6 ;
    //battery analog voltage pins
    const int b1Input = 0;
    const int b2Input = 1;
    //duration between switches
    const int duration = 450000;
    const int waitforbattery = 30000;
    //overlap for make before break
    const int overlap = 20;
    //constant to convert sensor to voltage
    // ((max voltage) / (resolution of analogread) ) * (voltage splitter factor)
    // (5.0/1024.0) * 11.0
    const float voltConv = 0.053711;
    //float variables
    float voltageB1;
    float voltageB2;

    void setup() {
    #ifdef debug
    //set relap pins to output
    pinMode(r1Pin, OUTPUT);
    pinMode(r2Pin, OUTPUT);
    //switch on a battery temporarily until both batteries are plugged in
    //wait 30 seconds for second battery to switched on or plugged in
    delay (waitforbattery);
    void loop() {
    //switch to better battery
    //wait a while before switching again
    delay (duration);

    void togglebattery() {
    // read analog battery sensor values and convert to voltage
    voltageB1 = analogRead(b1Input) * voltConv;
    voltageB2 = analogRead(b2Input) * voltConv;
    #ifdef debug
    // if battery one voltage higher than battery two
    // switch battery one on and switch two off after small delay
    if (voltageB1 > voltageB2) {
    digitalWrite (r1Pin, 1);
    delay (overlap);
    digitalWrite (r2Pin, 0);
    //else switch battery two on and battery one off
    else {
    digitalWrite (r2Pin, 1);
    delay (overlap);
    digitalWrite (r1Pin, 0);

  6. For a weatherproof case, I have a few spare controllers for use with Bafang rear or front wheel motors, one or two of which are not particularly useful. They do have excellent silicon gaskets to provide full weatherproofing, and are also aluminium extrusion which is designed to act as a heat sink for any hot components attached inside. As both relays and the rectifier diode being used on the power converted are designed to be attached to heat sinks, this saves me having to make anything else up. Matching up sizes of components and the case, all components should just fit into the case. The case has mounting points for easy attachment to the bike.
  7. The power converter will be plugged into the Arduino board via a USB plug. This will be easily reached just inside one of the end plates of the aluminium case. If I want to reprogram the Arduino, I can attach a programming cable to the same port, and update the code as required.
  8. I have purchased two Lekkie battery extension cables. This gives me two of each type of connector. The input to the DBMS will be two battery sockets, as found on the Lekkie/Bafang motor, the batteries will plug into these sockets. The output will be a single battery plug, as found on the Lekkie battery that came with the kit, this will plug into the Bafang motor instead of the single battery. This leaves me with a single battery plug, which I will attach via an adapter to the XT90 connector currently on my self built headway battery. At $16 for each cable, these provide a standard connection method, so adding or changing batteries later is easy, and the connections are waterproof.

Early days yet, most parts are ordered, a small circuit board for the power supply diodes and the voltage splitters has been built.


Posted in Arduino, Dual Battery Management System, Electric Bikes, Programming, Yuba Mundo eV4

Anatomy of a scam

This post may take a few days, so keep coming back!

Some background first. I repair computers, and a few customers (3 or 4) have been hit by the “Windows Corporation” scam, where someone thief rings up with a very Indian accent, but with a very English name, claiming to be from the Windows Corporation, or Microsoft, and tells the victim that their PC has been infected with malware and is busy infecting others and other bad things. Most people are not taken in by this but some customers get confused, maybe they have just seen an adware or malware message on their PC, or have just changed email addresses, or are not well at the time, and they are taken in to some extent. Most don’t actually pay these thieves any money, claiming to not have a credit card and are housebound etc. But by the time they get to this stage, the damage has been done. Next time they log on, the system asks for a Startup Password, which they of course don’t know. Soon after they get the second call from the thieves telling them what has happened and how much they have to pay. Fortunately for some, they call me rather than pay the thieves. I have a couple of effective solutions to unlocking the ransomed PCs in this case, and it normally takes just 30 minutes to undo the damage.

Strangely, I am also on every single list there is for these people, and I get several phone calls a week from similar callers. Because my home phone is forwarded to my cellphone, I can ignore them most of the time, but occasionally I get to the home phone in time and field the call. At first I called them names, or led them on and then told them they were stupid and hung up, but more recently I have decided to find out more about the scam and have been actively using the calls to get more information. It takes a good 30 minutes of my time, but some days I can spare it! To this end I have a “disposable” PC set up with nothing on it, which has no access to the rest of my network.

So, how do these calls go?

The opening blurb is much the same, introduces themselves with an English name (Jack Dawson was the latest, and the technician was Will Harris or something similar). They tell me that my PC has been monitored and has malware infections and has been doing all sorts of things, all of which  are bad. This is designed to scare and confuse.

I am told to get to a PC and switch it on, and pestered until I say it is on. In the meantime, they are asking questions about who uses the computer, how old it is, and whether I use it for secure applications, such as banking, shopping etc.

When the computer is going, they ask which key is at the bottom left of the keyboard, and then which key is next to it. They are obviously finding out if the keyboard has a windows key, but depending on the answers could be gauging the level of knowledge of the victim.

When answering these questions I have been a bit silly in the past, if I want to trap these people better, I need to pretend I know nothing about computers, but that I do internet banking with three banks, manage my stock portfolio and keep my bitcoin wallet on there!

Any way, once they know the keyboard layout, the fear and confusion continues. I am told to press the Windows key and hold it, then press the “r” key, and am asked what I see on the screen now. What you see of course is the run dialog box, and I am then asked whether the box on it is empty.

The thief then asks you to type in, one letter at a time (e for elephant, v for victor, e for elephant again etc) the word “eventvrw’, and as with all steps below, I am asked what I see now.

From here I am told to click on Custom Views in the left pane, then Administrative Events in the middle pane, and am asked what I see, which of course is red exclamation marks and yellow warning triangles with hundreds of errors. When I admit I don’t know what these are, they are described in gory detail as errors caused by all the bad software on my PC, and how only they can fix it. This spiel can take many minutes!

So having agreed that this is very bad and should be fixed, the thief offers to fix them for me. OK says I, let’s do it!

So, Windows R again, and www.1234computer.com in the white box. I have complained to the powers that be about this website, so it may be something different when you get your call! Of course this starts up a web browser with a quite sophisticated web page on it, very little of which actually works. At the bottom of the page are four flashing buttons labelled Server One, Two, Three and Four. Clicking on Server One starts a download of Teamviewer. All this is done while comforting words about how normal all this is and how it will help get rid of the malware.

Teamviewer is a legitimate application, which is used to give people you trust access to your computer, so that they can fix errors on it etc. Some computer technicians use this a lot rather than travel to customers sites. Personally, I like the personal interaction occasionally. However, when thieves and scoundrels get access to it, they can do so much bad stuff to your PC.

The other three buttons are links to alternatives to Teamviewer, like Supremo, ShowMyPc and AnyDesk. Other web pages such as AMMY.COM carry the same links.

So OK and download are clicked as requested, and TeamViewer downloads, installs and runs for the first time all with no further intervention. After describing what I see, it is explained that I am going to give their technician access to my computer.

This is the clever bit, I thought they would ask for the partner ID and password that is shown on the left of the TeamViewer screen, but what they actually do is give the victim the Partner ID and password generated on their technicians PC by team viewer. Now this would normally give me control of their computer, but a menu appears at the top of the screen, and I have to select/click the “Switch sides” button, which then gives them access to my desktop. At this point I am handed over to a technician on the phone.

The technician starts by repeating the eventvrw demonstration, adding the technical confusion to what the first guy said. He then uses Windows R and types in “inf”. This displays the contents of the /windows/system32/inf directory, which I never seen before. He then asks if I recognize any of these folders and files, to which I answer, honestly for the first time, “No”. Finally, he gets up a list of services, and explains that some of these services are stopped. Yes, I agreed. He then asks me to scroll down and see how many there are. I declined, saying I believed him, but then he came over all “school teacher”ish, and insisted I scroll down through the list and counted them one by one out loud! I gave him a not so small piece of my mind about what I thought he could do with that idea, which he accepted and moved on from.

Now, while continuing to talk about malware, stopped services etc. once again I saw the run dialog appear, and the word syskey typed in. Syskey would normally allow him to encrypt a very important part of the file system, and add a password to the encryption so that the computer will not start without the password. Unfortunately for him, I recently upgraded this PC to the very latest version of Windows 10 – the Fall Creators update, aka 1709. 1709 has many improvements, but an interesting one is that SYSKEY no longer works on this version of windows! I watched him try a few more times in obvious confusion.

In the meantime, the voice changed again, and I started to get the hard sell, that they would repair and maintain my PC for a payment of just $400 odd dollars, and how would I like to pay. I was going to go through the process and pull out at the last minute of give false credit card details when I realised I would be wasting my time, because they had no leverage over me (they could not hold my computer to ransom) they would just give up and not ring back. So I switched off the router and hung up before they got malicious and started deleting files etc.

So the anatomy of a scam is not complete, I need to take it to the point where they think they can ransom my PC, i.e where SYSKEY was successful.

I have two options, firstly I just finished building a Windows 7 Pro pc up from a cast off by a local business, and I could sacrifice that, allowing them to really use SYSKEY and lock it up. I would have no problems unlocking it.

Secondly and much more fun, I have developed a Windows application that exactly mimics the windows and navigation flow of the SYSKEY application. This took a few hours of development, it is just two screens and a couple of message dialogs, with radio buttons and buttons to navigate by. The main difference is that instead of encrypting the SAM hive file and adding a start up password, it just records the password on a text file. There is no real indication that it is not the real thing.

This program has been compiled into an .exe file, and it is just placed into the c:/windows/system32 folder, and it will run just like the real thing. Download a copy of the fake syskey in zip format here. Of course you could use this to replace the real syskey on any computer, just back up the original and replace it with the fake. You will need a folder c:\secret to store the password file in, otherwise the program will fail with a suspicious error message. Test it before you use it for real, to make sure it is allowed to run by windows, but set the password to spaces before letting a scammer loose on your PC.

This program displays the password if you need to demonstrate it to a scammer, all in the spirit of good fun of course. I leave it on the desktop, if no password exists it doesn’t do much, if one does exist it shows it.

So now I am just waiting for the next call!

I watched a video recently about scam baiting (one of thousands out there), and I am pretty certain it was the same guy as I dealt with, same script delivered in the same way, same web site, and the same method of using Teamviewer. The scambaiter didn’t click on the switch sides button, instead he clicked on actions/disable remote input, then attempted a syskey on the scammer. The scammer was immediately suspicious and disconnected the connection to his computer pretty quickly (I would switch the router off – by far the quickest option). I just tried it on my workshop machines, and if you worked really quickly you might just get away with it, the trick is to say the right things while you are doing it, the scammer can’t see what you are doing, but neither can he move his mouse or use his keyboard. Maybe something along the lines of “Hey, my Teamviewer has locked up, how about yours?”. Maybe I will try that in subsequent calls, or maybe after they have attempted a syskey on me!

Posted in Computer Stuff, Windows 10