Sunday, 8 August 2021

ESP8266 Remote Controls

Covid, working at home etc. Not published here since 2018.

But I have published here:

https://hackaday.io/projects/hacker/1200554

Ok, plan was to have ESP8266 based Controllers (Transmitters) and Receivers.

Hackaday is now a little dated.

The receiver is good:

Top is all bought in, 2 off 1200mAh LiPo batteries, simple motor, 3 servos.
Bottom left is a bought in ESC, £1.50 from AliExpress, middle is my charging PCB, right is my receiver. It's all mounted onto a piece or cardboard so I can put it aside to Work From Home.

The charger PCB has 2 off TP4056 LiPo charging circuits, 2 batteries are connected to PCB, in normal state they are connected in series through Normally Closed (NC) of relays giving 3.7V * 2 = 7.2V. The switch allows this to be used as output (or not).
When USB micro is connected then relays both switch, batteries are separated and each goes to a TP2046 charging circuit, LEDs are RGB, they light red to show charging, green to show charged. During charging there is no output.

Looking carefully at photo, both batteries connect to left of Charging PCB, output is on right and is connected to ESC. ESC normally has a switch, that is removed, linked to always on. It supplies fixed 5V to receiver via standard RC 3 way cable, (+V, GND, Signal). It is connected to motor and supplies voltage as dictated by RC cable signal.

The receiver contains an ESP-M2 module, it contains a regulator to convert the 5V from ESC into 3.3V for ESP. It contains CD40109 to convert ESP 3V3 PWM outputs to 5V for the channels. It contains a voltage divider which goes between the charger PCB output and the ESP ADC so that it can read the total battery voltage. It contains 4 standard RC channels each with standard 3 way headers (+V, GND, Signal). The receiver also contains a programming connector (6 way lower right).

Looking again at photo, left channel is connected to ESC, supplies 5V and controls motor. Other 3 channels are all connected to servos. Charger PCB and Receiver PCB were actually created by ELECROW, the first PCBs that I have ever had made, I usually create my own.
 

Programming lead, common to receiver and transmitters, connects to my PCBs on right, using standard FTDI board with USB micro connector to PC. Switch toward FTDI puts ESP into programming mode. Momentary resets ESP. Link to 3V3 on FTDI for development without my PCB powered, link off if powered. Nothing special, single sided, etched by me. I use 1 for receiver, 1 for transmitter.



My original 2 channel transmitter. A single joystick, up down is one channel to control speed, left right is other channel to control direction. It has an ESP-M2. It has a joystick connected to ESP via ADS1015 (I2C ADC). It has an 800mAH LiPo. Battery is connected through divider to ADS1015. It has a connector for 1.8 inch LCD (as used on Sipeed Longan Nano). It has a regulator to convert battery voltage to 3V3. It has a switch to turn it on/off. It has a TP4056 charging circuit to allow charging of battery over USB (as charger PCB). In use, LCD displays controller battery level, receiver (model) battery level and WiFi signal strength.
It is fully working, but case is hard to print and LCD support is not good enough (can get easily pushed in). PCB design is flawed, battery goes to regulator then switch. This means that regulator is always powered and battery goes flat. I've redesigned the case, currently printing. I've redesigned the PCB, but not made yet.
New 4 channel transmitter, very similar to 2 channel but with 2 joysticks. ADS1015 has 4 channels, now all used by joysticks, so battery voltage goes through divider to ESP ADC.

All files now published at:

Saturday, 27 October 2018

ESP32 play

Got a start point for ESP32
Bread boarded with 8 LEDs.
Ok, not that exciting, a set of 8 LEDs flashing in sequence. But that means I have tool chain setup and working and can program the beast. It's not in Arduino, that is available but has a lot missing at the moment, so I'm using the full Espressif tool chain:
I just took their standard Blinky example and tarted it up a bit.

I have a nice little 320x240 LCD with full touch and mmc card holder, works nicely on an Atmega 2560, lets see what I can do with an ESP32, have to interface with bread board first of course.



Sunday, 21 October 2018

ESP32

I want to use ESP8255, I think it has enough pins for what I want to do, but I'm waiting for delivery from China.
In mean time, I have a few ESP-WROOM-32 modules. Got 2 off Banggood for £3.42 each.
This is really too new, not fully supported by Arduino, but it is a very nice chip and a very nice module and I have some spare time.


Created a simple PCB to create a bread board friendly module.
Created minimum circuit, serial on TXD0/RXD0 to PC via FDTI, used FTDI 3v3 for power, reset momentary and flash/program slide switch.
Got the "Hello World" example up and running.
It's a good start point. Plus, I now have a new toy :-)



Monday, 15 October 2018

Electronics playing

It didn't work, no idea why. Just what I was worried about.
So, I simplified:



The connections are no longer sorted (simplified).
I actually drilled a 2.5 mm hole through PCB in center of IC base pad. After placing and soldering small pads, I soldered tinned copper wire to base of IC (from other side of PCB through hole) and filled with solder.
Still did not work!!!! Still no idea why.

I used a USB microscope to examine very carefully, all joints look good. All joints buzz out ok.
Maybe the oscillator is not good enough, maybe wrong choice of crystal, maybe wrong capacitor values, I would not have thought this would totally stop it working.
There is no recommendations from Espressif that I could find.
But, whilst I was looking at schematics to try to find a known good set of components, I came across this:
For breadboard, that is pretty close to what I want, ESP8285 with all pins broken out, a little PCB to translate connections to 0.1 inch bread board compatible and I'm up and running.
So, I've ordered 5.

What I want is some building blocks.
I want a block that is all basic known good components to give a basic working ESP8285 circuit.
A block that I can plug into a bread board and with other building blocks and quickly get something working.
A block I can put onto a PCB with other blocks to create what I want after bread board stage.
The ITead module should work as a stepping stone toward this goal.


Thursday, 4 October 2018

Electronic Playing

Assembled and plugged into bread board:
Using heat gun to put down 8255 and crystal seemed to work ok.
The '0603' capacitors were as difficult to hand solder as expected. You can't see 0.5 x 0.2 mm well. You pick them up with tweezers, too much pressure they are gone, try to move with end of hobby knife, it flexes, gone. 
Now still being a wimp. If it doesn't work, is it soldering? is it circuit? is it components? is it breadboard wires? has it got bootloader?
I'll get to it tomoz, had to try fixing a DVD drive in a telly tonight.


Thursday, 27 September 2018

More Electronic Playing

Ok, I'm still wimping out. I built the PCB, bit more complex that my usual. Main problem is ESP8255, it's a 5 x 5 mm, 32 pin chip, problem is that it's only Gnd (0V) is pad on bottom of chip, no way to route a track to it, not a problem with through plating, but somewhat of a bitch with home PCB.
My PCB drill now decides to play up, vibrations in the drill bit, snapped my only 0.6 mm bit, moved to 0.7 but the vibration causes it to drift around the pad, doesn't center on etched center hole anymore. I had the vias as 1mm, redesigned the PCB around 1.2 mm, made again, bought new drill and new chuck.
So, I have PCB and it's fully drilled. I have 5 off in dice pattern with pad under IC on both sides. I've put tinned copper wire through all vias and soldered. The hope is that I put down ESP8255 with heat gun, it seats on enough solder that wires drop down but remain sufficiently high to connect with pad and IC.
Component side, not my best PCB, ESP8255 area tinned ready.
Non component side, after ESP8255 the crystal will also need laying down with heat gun. Capacitors also tricky, I'm used to 0603 components, that is what I ordered, but 0603 capacitors are not 6 x 3 mm as I expected, instead they are 0.5 x 0.2 mm, I can hardly see the things, going to be tricky to solder by hand.

I think I have that covered: USB microscope
Kit is good, but I would have preferred it to plug into my phone, use it as a display near to PCB whilst I solder. But my phone does not support being a USB host. Works well on PC, but that is not next to my solder area. I'm working upon using Raspberry Pi as display. This is background task.

I of course also have normal background jobs, clearing drive, varnishing rocks for grand kids, central heating needs fixing, etc. Oh and of course work ;-)

Now the ESP8255 module will allow me to use it on a bread board (if it works), that leads into playing with camera. I have lots of OV2640, but I've cheated and bought a module that will be easier to also put onto bread board:

I really need to push on....



Saturday, 22 September 2018

Electronic Playing

I've been playing with something that may become a product for the company I'm working for, so I won't say anymore about that other than it took a lot of time.

So, now I'm back to playing. I'd still like to make a really cheap Wifi Camera and I think I have all the tools and parts I need to do that.
I love Espressif devices, they pack a heck of a lot into small chips.
https://www.espressif.com/
There are now 3 main variants:

ESP8266
  This is the original Espressif chip, it has caused quite a stir in the hobby world.
  It's a single small 5x5 mm, 32 pin chip containing a processor and most hardware blocks to
  handle WIFI.
  There are an awful lot of different modules available containing these chips.
  Previously I created a remote control from an ESP8266-12 module.
  I've been buying these off Ebay, always under £2.
  Unbelievable value for money.

ESP8255
  This is the next stage, ESP8266 required a separate flash chip, all ESP8266 modules
  contain the main chip and a flash chip. ESP8255 now includes a 1Mbyte flash inside the
  chip. So it behaves and performs like an ESP8266, but modules are much smaller. My
  favorite so far has been the ESP-M2 by DOIT (Doctors Of Intelligence and Technology).
  I've been buying ESP-M2 off AliExpress, £1.41 each!!!

ESP32
  This is the very latest offering, not quite mainstream yet, they have gone very much
  upstream. I'm looking forward to playing with it.

The modules are all fabulous, but none of them seem to break out all the pins of the processor, and all of them are non bread board friendly. I've created PCBs where the module mounts to the board.
I have a PCB that connects ESP-M2 with micro SD card and RS485 bus as well as all the components to go from 12V to 5V and 3V3. This PCB is 63 x 26 mm. I had a few problems requiring putting 5V onto module pins and blowing them up, would have been much more advisable to have bread boarded it first.

So, I've fixed that.


I've created 2 small and simple PCBs, I can now plug my ESP-M2 into a bread board. Here's 1 I prepared earlier
Standard FTDI module at one end, supplies 3v3 and allows programming via Arduino.
ESP-M2 module at the other end. See lower photo, push button to reset the ESP, black push switch to switch between flash and run modes. See upper photo, 8 LEDs all attached to ESP GPIO.
Ok, it was just a setup to play, I have 8 useable GPIO, I have them flashing in all sorts of patterns. I didn't go further, I could have had them all controlled from a web page via WIFI, but I didn't.
These days I have ditched Eagle for PCBs, the constant nags to buy and the limitations got too much, I've moved over to using KiCAD and it seems to be a good decision.
I have KiCAD files for all these if anyone is interested?

The ESP8255 chip is much more than the ESP-M2 module, I've got some chips, so I'm currently creating my own module, this is a part of the ESP-M2 module schematic:
I listed the useable GPIO, IO16 isn't included above and IO2 can be used, that is the 8 off GPIO I used on bread board. This is a part of my ESP8255 module schematic:
Ok, bit complex to see clearly! But it has 14 useable GPIO. Though I have focussed on GPIO, they all have alternate functions, SDIO, ADC, PWM, too many to list, you need to look at datasheets for full details.

I've also been playing with other stuff. Got a darling little touch TFT LCD.
The LCD module is 2.4 inch, 320x240 pixels, £3.50 from Ebay. It's attached to an ARDUINO MEGA 2560 running demo paint program (not mine), works very well, has Full LCD, 4 wire touch and micro SD holder on the module. I want to get it running with the ESP8255.

I've also been looking around, I think I can plug an OV2640 camera into an ESP8255 and get it running, Wifi Camera next attempt. I can also buy all these chips at a very nice price from Mouser.

Ok, back to the real world, I've created this ESP8255 module with crystal and PCB arial, but I've not had the guts yet to build the damned thing, writing this has put it off, but time to bite the bullet.

Watch this space.......


Thursday, 11 January 2018

eBike near done



The actual bike:

Pictures of components:

Freewheel side of back wheel pulley, mounts between freewheel and wheel, see how freewheel teeth sink into pulley to hold it.
Wheel side
Both sides of motor bracket and controller (VESC) box.
Close ups of the bike:

Basically, it's mostly done, ready for test ride this week-end. All plastics printed in correct colours and assembled to bike, all wiring loomed with and attached to bike with silver PVC tape.

13/01/2018
Test ride this morning, not too far, about 3 miles. Fine on flat and downhill, made some noise on hills. I think the drive belt needs tightening, I think it was jumping on the main pulley. Even with jumping, it took me uphill. Top speed between 21 and 22 mph according to bike computer.
I might tighten up the drive belt and give it another go tomorrow.
But 3 miles, took around 10 minutes, then 1.5 hours to charge the battery back to full.
On the other hand, as I was dressed at the time, I weight 15 stone 7 lbs which is above average, will probably be OK for my Dad.
So, I think this is a success, tightening belt may make it better. I'm still waiting on the battery level gauge, then I can try it on a bit longer journey.

21/01/2018
This project is now on Thingyverse:
Original didn't have source, I had to re-create all parts myself in OpenSCAD, so I added my sources just in case it was of use for someone else to customize it for a different bike.

Ok, so I don't understand Social Media!
I'm on Google+, not really sure what I'm supposed to do on it.
I joined this group "3D Printing" some time ago, just recently I thought maybe I should actually do something on it, they have a Section/Forum called "ShowNTell", lots of people showing off what they have printed. So, I added a link to the thingyverse item with title "Assisted Bicycle".
I got banned!!!!!! Owner says I was spamming his group.
As I said, I don't understand.
It's also so unjust, I've done nothing wrong, broken no rules, but I've been tried and convicted by some guy I've never met and don't know. Very frustrating.
Ah well, live and learn....


Sunday, 10 December 2017

EBike

This project scares me.

Battery: 5000mAh 20-30c battery, 5 Amps for 1 hour, but capable of supplying up to 150 Amps! Scary.

Motor: 2250 Watt = 2.22h KW, enough to drive an adult along on a bicycle. Easily take off fingers.
Scary.

VESC: Capable of supplying 50 Amps continuous.
Scary.

I'm having trouble with VESC. I was a prototype wireman a very long time ago, technology has gone forward. There is a forum, so that's useful. There is an IRC channel, but it appears to only have sleeping people who don't respond sitting in it. I originally looked to buy a ready assembled unit, but could not find 1! I now know that the designer has now been hired by a company that has chosen to copyright 'VESC', so you can buy them, but they can't tell you it's a VESC!!!
So, I've bought the bare PCB off Ebay and bought the components off Mouser.

Here's the set of kit:
Motor, battery, bare VESC PCB
Top to bottom, left to right, saddle bag, motor, battery, charger, drive belts, accelerator, multi-battery gadget for charger, battery connectors, motor connectors, drive pinion, black & red 10 AWG silicon wire for VESC to battery, white, yellow, blue 12 AWG silicon wire for VESC to motor.
Bottom of my assembled VESC
Top of my assembled VESC
Ok, so I built it the best I could. Spent a couple of weeks dithering after that. Needed to pick up courage to power it up. But I did. It didn't go bang, it did smoke, but so little that it took me some time to track it down. See bottom picture, top left component is a diode, protection of 5V rail, it was smoking. I took it off, checked pads, 9 Volts instead of 5V!!!
See IC in middle of Top photo, that's the DRV8032, it converts supply to 5V. It has a heat sink pad in the middle underneath, I saw that, so carefully added a layer of heat sink compound, this was wrong, it needed to be soldered! But the 3V3 rail was intact!
So, I connected it up to PC and ST-Link could see it and program the processor. But nothing after that.
I protected surrounding components with Kapton tape, used hot air gun, lifted DRV chip off, cleaned it up, soldered it back on using hot air gun. Result, now got 5V, took off Kapton tape. Still seen by PC, still programs, but then nothing, blue LED is on, but it's directly wired to supply, no red of orange LEDs. So I re-flowed the processor using hot air gun.
Singed some of the connectors, now it's not seen by PC, probably fried the processor.

Next step: protect surrounding components with Kapton tape, use hot air gun to lift off processor. Thoroughly check all processor pads are connected as needed. Solder on new processor. But I'm in silly mode again, Need to snap out of it and buckle down.

11/12/2017
Interesting day, did 'Next Step' above, could find nothing wrong, fitted fresh processor.
Still no joy.
Used ST Cube MX and Keil to create a very simple firmware that simply lit Green and red LEDs, debug on and using internal oscillator. No LEDs.
Replaced both LEDS, now work! No idea why they weren't working.
Altered test firmware to alternately flash LEDs every 500 mS, ran it, both LEDS flashing.
Altered firmware to use 8MHz crystal, built, flashed, ran, LEDS still flashing, so crystal circuit ok.
Put in standard firmware again, ran up BLDC_Tool, still shows firmware is tool old. Firmware tab shows it supports 2.17 or 2.18.
But I saw in conf_general.h that I'm actually building and flashing 3.32!!!!
Smelt a rat, used git tools, vedder has updated the firmware for V6.00 (since being recruited by company that copyrighted VESC).
Created branch at 2.18, built and programmed that, finally I have working BLDC_Tool!!!!
No such thing as xml files for motors, going to have to play this by ear too.
Time to solder on motor wires and attach motor......

12/12/2017
Did that, told it to discover motor, spun up motor for about a second, then big bang!
Blown 10 mm wide track between right 2 FETs.

FETs removed

Track repaired.
This time I've tinned bottom of FETs and used heat gun to bed them down.

13/12/2017
It started working again, started to spin up, then bang.
1 FET split in half, another was cracked, now constantly shows DRV fault, so that's probably trashed.
I'm going to remove all 6 FETs and DRV chip, check all ancillary components, check all FETs out of circuit, then put it all back together and pray.

14/12/2017
Checking FETs was frustrating, lots of places on-line where they tell you that you need a lot of complex equipment to test them properly, then lots of other places where they show you how easy it is to test using a meter in diode mode. Well it doesn't work with my meter in diode mode! But none are cracked, none have shorts and 1 place on-line goes through lots of ways to test them, then at very end says that they are very robust, if the don't look damaged and they have no shorts then they are usually ok! Be nice if that was the 1st link I found and be nice if he put that bit first!

Soldered on new DRV chip with hot air, powered up, no more flashing red LED, just constant green, nice. 
Soldered back on the 6 FETs, powered up, still constant green, nice.
Back to BDLC_Tool, run wizard, fails to complete! 
There are 3 modes for motor: BLDC, FOC or DC! None of this means anything to me and the software isn't telling!
DC = Direct Current (like a battery), not AC (alternating current, like mains)
ESC = Electronic Speed Controller. This is a standard acronym in the world of Radio Control.
BLDC = BrushLess DC Motor. This is a standard acronym in the world of Radio Control.
FOC = Field Oriented Control. This is a not so standard acronym in the world of Radio Control.
"Simple off-the-shelf ESCs use basic back EMF to control multi-phase motors. Field Oriented Control (FOC) is a sensor-less form of commutation that can be integrated into any UAV" - Sounds good, doesn't really explain it for me!
"Every single motor is unique and the VESC needs to know certain parameters to run the motor. The VESC needs to know the motor resistance, electrical inductance and flux linkage (λ). From these basic values other values can be calculated that are essential for the motor operation."
But there is a wizard, Step 1 = press the RL button to measure the Resistance and Inductance of my motor! Nice, except it's not!
It's not repeatable, but does come up with some values, for my motor it says:
R: 13210.19 mOhms L: 23.11 uH
The manufacturers web page says the internal resistance of the motor is 0.021 Ohm, which I figure is 21 milli Ohms, sometimes the software comes up with 21000 mOhms, maybe mOhms means micro Ohms, but it's not telling, no idea if 23.11 uH is correct.
Step 2 = measure λ.
It wants 3 values: I, D, ω
  • I is in Amps, it's current, but minimum current, maximum current, who knows, it's not telling.
  • D = Duty Cycle, so it's a value between 0 and 1, with 0.5 being middle, but it's not telling how to calculate or figure out what that is.
  • ω is in ERPM, no idea at all! ERPM appears to be Electrical Revolutions Per Minute. This appears to be VESC specific! "Erpm = (Mech.rpm) x (number of pole pair (magnets) of the motor)".
    Manufacturer doesn't advertise how many poles or magnets my motor has, but a search finds it has 14 poles.
Tried lots of different values in BDLC and FOC modes, got it so it spins up the motor and completes.
But there appears to be no way to test it, there is a little icon that allows control using keyboard arrow keys, but there are 4 keys and they aren't letting on what each means and it doesn't seem to do anything except make my motor do some weird sounds.
So, I went to App, wired up the accelerator, looks good in tool.
Does naff all with my motor!

All very frustrating and annoying.
At least with old system, I have full source, that I know.
So, I went back to old system, put in old firmware using ST Link, ran up old tool.
This actually explains some of the terminology better!
So, I'm basically sitting looking at it, deciding what values to use, it doesn't run unless attached to powered up PCB, so it's powered up attached to battery and motor, but should be doing nothing.
Then the PCB goes BANG! Blown a hole in the DRV chip!
This was 10:30, ordered some more DRV chips.

You ever get into a situation like this?
£350 spent, weeks getting to this point, not working. Too far in the quit?
I'm thinking "don't throw good money after bad", I'm thinking put the PCB on a nice solid floor and smash it with a club hammer.
I really do wish I'd never started this, but I'm just too obstinate to quit.

15/12/2017
Farnell order was out for delivery at 06:00 this morning.
Spent all day researching motor, battery, going through firmware code.
Whilst sitting here, UPS reports they tried and failed to delivery twice, blatant lie, I have full video surveillance and their was no 'not delivered' cards. Phoned UPS, if lucky I might get replacement DEVs tomorrow, also ordered some from RS for delivery Monday.
This is all a bit annoying.
Got some feedback on Forum, the DEV chip may have been half working previously, that made discovery fail, dying to give it another go.

19/12/2017
Took off DRV chip, lots of damage, blown off pad under lowest right pin. Fixed that, fitted new chip, attached to PSU, nothing, another big supply pad had blown, fixed that, PSU short.
Gave up, now building a 2nd VESC using new PCB, very carefully soldering on every component and fully checking each is soldered correctly. Had a few shortages, ordered from RS. Should be here tomorrow.

24/12/2017
Powered up the new VESC very carefully on PSU, nothing worked, was fine until I started trying to detect motor, then 3 red flashes, DRV8302 fault every time. Replaced DRV8302 and finally it is fully working.
10/12/2017 to 24/12/2017 = 2 weeks, was already practiced on drag soldering, can now do heat gun soldering. 1 scrapped VESC and parts.
This has been the hardest electronics I've ever built.
All I've now got to do is to fit it to the bike, how hard can that be?

27/12/2017
Been a bit busy with other things last couple of days :-)
This must be an electric assisted bike, it must fully function the same as it used to except when assistance needed, then it must behave like an ebike.
My Dad got a special wheel made up:


Standard gears in standard arrangement attached to standard side, but on this side it has a Sturmey Archer freewheel screwed on. The idea being that the motor freewheels whilst the bike is in standard use, but motor turns wheel in ebike mode, I need to attach the pulley to the freewheel.
Sounds good, but it can't work, using standard Sturmey Archer freewheel, it operates the other way, be fine if we want the bike to go backwards in eBike mode!
Many thanks to zigzag for his post here:
Based upon this, I'm going to hack it and reverse it!
Sprocket itself is easy, just turn it over (re-assemble upside down) :-)
Problem is the pawls, they can be reversed, but the pawl cutouts need modifying.



PCB drill with dremel type bits and a little later....
I made it the same depth after taking photo.
During re-assembly. Now fully working reversed, I still have concerns over fitting to wheel, it's left hand thread which means it tightens up in standard use, but I've reversed it, so now it will unscrew in standard use! Maybe locktight will do it, but I'm thinking I may need to add some locking rods through the threads, still thinking this through....

30/12/2017
Rear pulley done and fitted, hub is 2 piece to sandwich freewheel, spokes all printed separate, pulley ring printed in 4 segments, was the only way I could get all the weird angles. All dove tail joints, then all glued together with epoxy.
Pulley and drive band on bike.
Very happy with how true it is, nothing even close to rubbing, at least 2 mm clearance everywhere.
Locking the freewheel on the threads with a pin proved to be impossible, freewheel case must be hardened steel, I couldn't touch it, and even if I could, it's so thin that it would be severely weakened.
So, I've been a bit of a cowboy, Araldite 5 minute epoxy now on the threads. If it ever needs to get undone then I'm hoping a little heat will free it up.
Next challenge is to mount the motor on that very thin upright. Even worse than that, motor has to be mounted some way out or the drive band will rub the upright due to the angles.

1/1/2018

Motor mounted to bike, plugged it in, wife on throttle, works quite well, though of course off load. Had to hold her back, wife was going for full throttle! Yeah, motor bracket is red, I ran out of light grey, on order, will reprint once I get it. Control box to mount VESC to frame next, then I can adjust wire lengths and actually try it on the road, then just for completeness I'll make a box to hold and protect battery in saddle bag.
Testing on road will be a problem, I'm back at work tomorrow, next time I'm home with daylight is next week end.

2/1/2018
Designed and printed VESC case in red PLA. It fits nicely under mini-rack (saddle bad support). I adjusted the length of motor wires, added long thin wires from VESC battery terminals (to route to handlebar mounted power gauge), then waterproofed VESC electronics.
I roughly tie wrapped motor leads in place and roughly tie wrapped cables between VESC and handle bars. I roughly mounted accelerator in place on handlebars.
All wires will be wrapped in silver PVC tape and mounted to frame using same tape, so they should be mostly invisible. I connected battery inside saddlebag.
Ok, so it's fully functional. It will be mostly completed when I get the silver PVC tape, light gray PLA filament and battery gauge, all expected some time in the next 2 weeks.
But now was the moment of truth, get aboard and see how it moves slowly between hall and living room.
This is where it mostly went down hill :-(
Ok, face the truth, I'm a short arse, I can't actually get on the bike, my legs are too short!!!!! Even if I put the saddle down to lowest, I think I'd struggle!!!!
I did manage to sit uncomfortably on the cross bar, tried to go forward and it made a horrible noise. Got back off and examined, take off from static is a bit dodgy under load with VESC, that was the noise I heard. If I very slowly and carefully use accelerator, sometimes it's ok.
It may be ok for my Dad as he is much lighter than me.
But I'm now awaiting the post man for a while.

6/1/2018
Light Grey PLA and Silver PVC tape arrived, still awaiting Battery Gauge. Re-printed (but not fitted) VESC box, still need to re-print motor mount.
But this morning I lowered the seat and took it for a test drive. Felt good for a very short time (about 50 yards), then it didn't sound or feel right. Pushed it back home. Pulley at motor had come loose, has 2 grub screws, 1 now gone. It was too loose to work, but too tight to take off, it had worked it's way up the motor shaft causing belt to come free.
One of the few parts I haven't made and thought would be ok! Is that good news or bad news?

The grub screw mountings (1 screw missing)
So, I've modified:



I've ground a flat in the shaft where the remaining grub screw hits.
I've ground a groove in the shaft, I then tried to drill a hole between pulley and shaft to make a key way into which I planned to put a piece of rod. This didn't work, drill snapped off. But this could be a good thing, the drill acts as a hardened steel key stuck in place on the pulley. This could work.
I've ordered some more pulleys, they are very low cost, I'm considering ordering a new motor shaft, maybe I could weld them together some how. Pulleys are aluminium, shaft is hardened steel.