Categories
3D Printing Electric Skateboard Electronics

Custom lighting system for my electric skateboard

Recently I’ve joined a local electric skateboard group that goes on regular group rides. Unfortunately most of these are at night and I don’t have any sort of lights. It’s dangerous to ride at night as I can’t see what’s ahead of me and others can’t see me.

Instead of forking out a large amount of money for some pretty basic (and boring) lights I decided to make my own. I purchased some 300 LED/m WS2812B strip and a 15W LED light bar off eBay. The light bar requires 12v so I built a 3s3p (12.6v, ~6Ah) battery pack out of 18650 Li-ion batteries. This means I needed a 5v power supply to run the LED strips and ESP8266 micro controller. Products on eBay tend to be overrated so I normally aim for something rated much higher than necessary.

The 5v, 5A power supply used.

I designed and 3D printed a case to fit all of the batteries and electronics inside. It’s a bit bigger than necessary but I wasn’t certain on the size of everything when I made it. I designed it so the light bar attaches onto the front so it’s easier to mount on the board. The cables come out via two waterproof glands for the light bar, and charger (red, black) / led strip (yellow, green, white).

The controller box and light bar mount.

The adhesive that comes on the LED strip isn’t very good. I 3D printed some little plastic holders for the strip instead. Using some tiny screws, these screwed into the board for a really solid mount. Near the back wheels it was easier to use zip ties for mounting the strip.

The underside of the board with the light strips held in place by some 3D printed plastic clips.

The final result is great! It makes a huge difference while riding at night. I can clearly see what’s in front of me, and everyone can see me coming from ages away due to the fancy light show going on underneath the board and huge light bar on the front. 😉

Categories
Drones Electronics

DIY 3DR Solo Charger (also car charger)

So I bought a 3DR Solo “Smart Drone” and some spare batteries.  To charge them all faster I thought I’d make my own charger.  I’ve also made a little adaptor so I can charge them in my car.  (run another cable off the car battery or turn the current down when using a car)

First of all you must use a voltage and current limited power supply.  If you don’t you’ll damage the battery or worse, start a fire.  These may be “smart batteries” but they will happily accept more voltage and current than what’s good for them.

I’ve made lots of assumptions in this build log/tutorial.  if you can’t do some of the stuff it assumes then this project probably isn’t for you.

Before starting you should be comfortable with:

  • Using a multimeter for measuring voltage and current
  • Soldering
  • Reading basic circuit diagrams
  • Having a power supply of 12v at ~7A per charger

Parts:

Boost Converter ~$7 (link)

I used one of these boost converters off eBay.  They’re cheap and can be used for many things as you can set the exact output voltage and apply a current limit.  I ordered a couple to keep on hand.

Input Connector – XT60 (you can use anything)

I love the yellow XT60 connectors, they come on most LiPo batteries I buy and can handle 60 amps.  They are easy to solder and plug/unplug.  Anything I have that uses/supplies around 12v has an XT60 on it making lots of things interchangeable.  (like my glue gun that can be used on batteries, desk power supply and car) You can get these online or from HobbyKing.

Output Connectors – Copper Clad Board (link for Australia)

The output connectors are a bit tricky.  They don’t use a readily available connector.  I just found some copper clad board that fit snugly and cut out the correct size.  My calipers broke so I can’t measure it properly but I’d guess it’s the standard 1.5mm thick stuff.  I’m currently working on a 3D printed connector, at the moment you have to manually plug the +/- connectors in.  If you get the polarity wrong, you will blow up your boost converter and probably the battery controller.

Hint: shorten one side so it’s harder to short.

Optional Case/Fan

I also bought a plastic case for about $3 and used a random 12v fan I had lying around.  This makes for a clean setup that stays cool.

How to assemble

1) The Case/Fan

If you’re putting the boost converter inside a case like I did you need some form of active cooling.  I drilled a bunch of holes in the tops roughly the shape of where air blows from the fan.  I drilled about 1/3 of the holes on the side to force the air into the case then out the side.  I then use a rubber band to hold the fan in place.  I only put it over half so more of the blades were over the holes and so I can attach another charger.

2) Wiring

The wiring is pretty straight forward.  I’ve attached a diagram to help out.  Make sure you use cables capable of carrying 16.8v @ 5A on the output and 12v @ 7A on the input.

3) Setting Voltage/Current

If you got the same boost converter I did (or one that looks similar) you can probably use the diagram below for reference.  Turn the current limit all the way down to the minimum.  (you should hear clicking when the trim pot hits the min) Next, get your multimeter and check the voltage.  Keep twisting the voltage trim pot until it gets to exactly 16.8v.  If you go any higher you risk damaging the battery.

Now set up your multimeter to measure the amps going into the battery from the charger.  Hook it all up, start charging the battery and measure the current.  Adjust the current up to a maximum of 5 amps.  Any more than 5 amps will damage the battery and be a fire/explosion risk as it can’t safely charge that fast.  I recommend doing this on a half charged battery for optimal results.

 

4) Fin.

Congratulations, you just made a $10-$15 solo battery charger.  Also at 5A, this charges approximately 50% faster than the original charger.

Categories
Electronics Home Automation

My home automation system overview (main components)

I’ve been working on my home automation system quite a bit recently.  So far I’ve automated a few things, namely my work room’s light and power, and my bedroom’s light and fan.  When I get around to it I’ll be automating all the outside lights and some more power points.  In this post I’ll quickly go over all the components you need for my home automation system and what they do.

The main components are:

  1. MQTT Broker (Server) – this is the “communications mainframe”
  2. Home Assistant Server – a nice interface/automation server
  3. Server Hardware – I use an orange pi zero
  4. Automation hardware – WiFi relays, sensors etc

1) Mosquitto (The MQTT Broker)

Mosquitto is an open source MQTT broker.  Now the first thing to explain is what is MQTT?  I mentioned it’s like a communications mainframe, well it kind of is.  If you aren’t familiar with the publish subscribe concept I suggest you read up on it.  However, the main concepts are you have clients that connect to a broker.  (MQTT terminology in bold) A client can subscribe or publish a message to a topic.  A topic might look like “sensors/kitchen/temperature”.  When a client is subscribed to a specific topic, that client will receive all messages published to that topic.

This tutorial by Digital Ocean is a fantastic resource for setting up the basics of an MQTT broker.  It’s a great introduction on how to set up a working broker, and how to secure it.  However, I reccomend that you go one step further.  See how to use ACLs and multiple user accounts to limit what topics each client can subscribe and publish to.  This ensures if an account is ever compromised, the damage can be contained.

2) Home Assistant

Home Assistant is an open source, python 3 based home automation hub.  They had me at open source and python 3. 😉 It is fairly easy to use but the killer feature is it’s integration.  It integrates with everything!  I can almost guarantee if you want something integrated it already has a compatible component.

The main components I use are WeMo (curse thee belkin, I should never have wasted my money on a WeMo), chromecast, MQTT, owntracks and pushbullet.  I’m still adding more when I have the time so this list will probably be out of date quickly.  It’s configured with a single yaml file, which is a little annoying and will definitely get convoluted fast.

To see the ever expanding list of built in components check out this link.  In my opinions its the best one out there.  It also has by far the nicest looking interface, it comes with a mobile friendly web app.

3) Server Hardware

This title is slightly misleading as you don’t really need a server.  I bought a few Orange Pi Zeros and have been pleasantly suprised at how well they work.  In Australia, I could get 2 for a similar price as a single raspberry pi zero.  The raspberry pi is also only available in quantities of one at the moment.  But the main reason I like them better for this purpose is the full size ethernet and USB port on board, and the built in WiFi.

The full sized ethernet port is a big plus, makes it so much easier to work with.  However, with great price comes terrible software support.  I didn’t feel that comfortable with a dodgy looking baidu cloud/google drive link for the operating system.  I ended up trying it on only to find out it wouldn’t boot from any “official” image.  However, armbian to the rescue!  They support the orange pi zero and it booted up straight away.  I could see it on my network so I went ahead and installed mosquitto and home assistant.

Here is the official armbian page and download links for the orange pi zero.  I like ubuntu so that what I went ahead with.  Note, neither of these operating systems contains a desktop environment so you’ll have to get familiar with the command line.

4) Automation Hardware

A couple years ago I bought a belkin WeMo for my 3D printer; I wanted to be able to turn it off when it was done and I wasn’t home.  However, it’s a terrible product.  Sorry Belkin, you tried, but it just doesn’t work.  It’s slow, laggy and never stays connected properly.  The only thing going for it is it’s price tag, oh wait I forgot it’s $70.  But at least they make an api available – actually nevermind they don’t do that either.  To be fair it was one of the first plug and play WiFi relays around so I’ll give them that.

My favourite piece of hardware at the moment is the sonoff by itead.  It needs a bit of hacking to get going.  But once you’ve loaded TASMOTA onto it they’re awesome.  TASMOTA is basically plug and play; upload, configure and you’re done.  Basically, you wire a sonoff in between any device/appliance you want to control wirelessly.  I’m renting and have decided not to modify any of the wiring in my house because I value our insurance validity.

NOTE: Do not try this unless you know what you’re doing and you have a qualified electrician look over your work.  Something as simple as mixing up the colour of the wire can cause someone in the  future to shock, injure or kill themselves! (electrical standards exist for a reason)

What I’ve decided to do is buy some slampher‘s to go on my lights where they fit.  You can modify the button and wire one into a blank faceplate.  This means you’ve still got a manual butotn but it’s WiFi connected.  For all other appliances I’m making up power boards and extension boards with a sonoff built in.  This means I can plug anything in and make it WiFi connected – all without voiding my house insurance and upsetting my landlord.

Another option for lightswitches is the sonoff touch.  However I don’t like it’s price tag or the fact I legally have to get an electrician to install it for me.  I’d rather a slampher and DIY button for a fraction of the cost. That being said, they do look really nice.

 

That’s my brain dump for tonight.  I’ve gone into more detail of my MQTT setup and will eventually do the same for all the other topics. (see what I did there 😉 )  Hopefully this is a good overview of all the major components needed and will point you in the right direction.

Categories
Electronics Home Automation

How to use Espressif SDK functions in the Arduino ESP8266 IDE

I found myself wanting to use one of the espressif SDK functions in the ESP8266 Arduino IDE.  It took me longer then it should have to work it out so I thought I’d share it!  The first step is to make sure you’ve got the ESP8266 library and boards setup properly.  (see the documentation) In the sketch you’d like to include the espressif function in, paste the following up the top:

extern "C" {
    #include "user_interface.h"
}

Just replace “user_interface.h” with the name the espressif documentation tells you to.  What this does is tells the arduino IDE to include the espressif library.  (which is a standard C library)  This little trick should also work for any standard C library.

The correct name for each API can be found at the top of the relevant espressif documentation page. (their documentation – choose the latest “NON-OS SDK”)  Here is an example of the force sleep api:

Categories
Electronics Power Wall

Make a 10 way Li-Ion battery charging station for $10

So my DIY Powerwall (like the Tesla one) project is moving along quite nicely.  I’ve just finished my mass charging station design and I’m quite happy with it.  This design is a lot simpler/easier to make (for most people) than my normal designs.  It doesn’t require any laser cutting because the laser cutter at HSBNE (brisbane hackerspace) was out of action briefly.    It still requires 3D printed parts but a bit of extra work means you can use the normal 18650 holders.

The Components

1) Ply wood mounting plates.

I used two rectangular plywood plates that I cut out by hand.  (yes, I didn’t use a laser cutter 😉 )  The top one is for mounting everything to, whilst the bottom one is to allow for a level bottom and to hide all the wiring.  Cut out the two plates so you can fit everything on with some room around the edges for the wiring.

2) 18650 Chargers (TP4056)

These are one of, if not the cheapest Li-ion/LiPo battery chargers that exist.  It’s an all in one board with through holes for 5v in and a battery output.  They will charge any Li-ion or LiPo battery up to full from either a USB connection or 5v to the two pads either side of the USB plug.  The cheapest place to get them I found was Aliexpress.  (I got mine for 30c each on the 11/11 sale!)

tp4056

3) Computer power supply

Any generic 5v power supply will work.  However, you’ll need quite a lot of current to charge more than a couple of batteries at once.  Old (or new) computer power supplies are perfect.  Most can supply around 30 amps on the 5v rail.  Each battery needs about 1 amp so this means it should be good for about 25-30 batteries at once.

Tech Tip: Some power supplies only watch the 12v line for voltage drop, so if there is no load the 5v rail could drop below 4v!  The easiest way to fix this is to put a load on the 12v rail.  I find putting a few 12 fans to cool the chargers down helps.  See below for optional monitor.

psu1

psu2

4) Wiring, connectors and (optional) fan

You’ll need a bunch of wiring and a connector if you want to easily disconnect it from the power supply.  I find old network cables are great for this job.  A single 5m network cable has about 40m of wiring in it!  The wires are tiny and can carry enough current for this job, making them the perfect fit.  Solder one wire to each + and – near the USB connector, join them all up and use some thicker wire to join the bunch to a connector.  Connect the fan to the 12v rail and glue it onto the side.  If you get a small bit of cardboard/wood you can direct the flow a little better.

wires

5) Voltage Monitor (optional)

I bought a few of these voltage monitors off eBay.  They are super cheap and easy to wire, simply put the red wire on the positive side and black on the negative side of whatever you’re measuring.  It even powers itself from the same source.  This is great for watching the voltage of the power supply.     I have mine on the 5v rail of the power supply so you can keep an eye on it.  Cheap Voltage Monitor (eBay link)

voltage-monitor

 

 

fin

Once it’s all put together this is what it looks like.  Quite a good little package I think, and really cheap at about $1 per battery slot.  (assuming you have access to a 3D printer, box of power supplies, network cables and connectors like me 😉 )battery-charger