Posted on Leave a comment

Simple Arduino Pong Game

Another one of those long overdue articles. I originally created this pong game 3 or 4 years ago, but it has gone through several great iterations since them.
This portable pong game has been a work in progress for many years. The components have stayed the same, but the enclosures and format have changed a fair bit.
The first version was created on a breadboard and was mostly just a proof of concept and a platform to figure out the code.
The second version was built inside a 3D printed enclosure and was a mess of wires inside.
Next version (number 3), I created on a 7x9cm perfboard and managed to keep the wiring a little bit neater, but it looked much better than previous versions with the added benefit of being more compact.
For the final version (number 4), I designed my own PCB to hold all of the components, with an easily replaceable battery holder.
As mentioned earlier, the circuit stayed the same throughout all versions (with the exception of a power LED on some). So let’s take a look at what that circuit consists of. I used an Arduino nano to control everything, a 1.8″ LCD display, 2 10K potentiometers, a switch, a TP4056 charge and protection module, an 18650 cell, and a 5V boost converter. These were wired up in logical fashion so that the 18650 cell was protected and the voltage would be stepped up to 5V for the system, and the Arduino communicated with the LCD over SPI while using the potentiometers as analog inputs to control the paddles.
For programming this, and part of the original inspiration for this project, I found an example on the Arduino website that showed 1-player pong, where the paddle could move anywhere as the ball would bounce off of it and the edges. I modified the code for this to make a 2-player version.

By far, the custom PCB version is the best because it is compact, neat, durable, and easy to wire everything up. If designing the PCB again, I would definitely use a different software than EasyEDA, as the one thing that was especially annoying was the UI. I could not figure out how to create rounded corners on the PCB, and their guides were not much help either. Since designing this board, I have figured out how to do that, but I still don’t enjoy the interface.
As for improvements on the code, there are plenty of things I would change – the main ones being a better menu, text facing the right way, and the ball not removing parts of a dividing line. When programming this, I just programmed it up to the point that it worked, and then stopped making improvements, which I somewhat regret now, but is not something I am going to go back and fix, as I have too many other projects that I am working on now.

Project By: Micah Black
Written By: Micah Black

Posted on Leave a comment

My Vision for A2D Electronics

After spending 4 months away from Ottawa (and my business) at university, I wanted to figure out where I want A2D Electronics to be in the future.
I have spent a fair bit of time figuring out how to make this less work for me and potential future employees, but I also need some direction on where this business will be going in the future.

A2D Electronics exists to provide electronics at a reasonable and affordable price so that anyone and everyone can start making things. It does not exist to make me money. When this started almost 3 years ago now, I realized that the Ottawa maker community had a need for quick access to parts, and I could do something to help that. It was an idea that filled a need and one that I thought could make me some money.
Don’t get me wrong it does make money, but only enough to cover the projects that I make and post and some extra to reinvest in inventory and pay a little towards university. The most valuable things that this company has given me are first and foremost the connections that I have made, but also a feel for how business works on a small scale.

So where is this going in the future?
I want A2D Electronics to continue serving the community. From here on out, that is the main goal.
Before we take a look at how that will happen – let’s take a look at the current situation first.
The most time consuming tasks are restocking and re-ordering inventory, packing orders, scheduling local pickups, and adding new products. The biggest problem here is that I don’t have much time – between working full time on co-op, managing my own projects, other project, involvements in makerspaces and the Midnight Sun student design team leaves me with very little time. If only I could make myself an army of robot minions…
To continue serving the community, my focus will have to shift from being an order-packing robot to a community servant.
Making those tasks easier, more efficient, and streamlined has been on the back of my mind for the last month or so, and I have come up with several solutions that will be implemented in the near future. However, these changes alone are not enough to better serve the community.
One idea that I would like to flush out is to have ‘vending machines’ for electronic components in Makerspaces around the city. These would be amazing, but how would you keep track of everything and accept payments? Those are the questions that I have been dealing with.

So how does A2D Electronics better serve the community of makers?
By making access to components easier, faster, and more affordable. Doing this will mean flexible pickup times, possibly multiple locations, more products, and increased efficiency.
For the next few months, those items will be my focus.

Written By: Micah Black

Posted on Leave a comment

LiitoKalaa Engineer Lii500 Reliability, Accuracy, and Repeatability Test

Accurately testing 18650 li-ion cells is a very important step in the process of re-using cells from laptop battery packs, or designing a new battery pack in order to create matched modules and maintain a minimum amount of balancing current to keep the modules balanced.
During my first term at the University of Waterloo, I joined Midnight Sun, the solar car student design team and am working on designing a new battery pack for the next car, MSXIV (Midnight Sun 14). During this process, we are looking to accurately test every single cells that we putting in to the car in order to determine their capacity and internal resistance. This will allow us to create perfectly matched packs if the testing is completed accurately.
New cells are being used in this car, and the tests must be able to distinguish cells that fall within the manufacturer’s specified tolerance ranges for the cells. That means that the testing method that is chosen must be accurate to 10mAh for the capacity and ideally less than 1mOhm for the internal resistance.
And so started my journey of figuring out how to test all the cells in a timely manner while not spending tens of thousands of dollars on proper commercial testing equipment.
Starting with, one of the cheapest and most popular cell testers on the market, the LiitoKalaa Engineer Lii500.
I have 9 such testers, part of my cell testing station, and used 9 different cells to test each one, one slot at a time.
Each module was tested with one cell in the same slot multiple times to determine the repeatability of a measurement in the same slot, then the cell was moved to a different slot to see how the measurements compared.
The results can be seen on this spreadsheet, and were somewhat surprising. For tests of the same cell in the same slot, the values did not vary too much, within a range of 20mAh. However, when the cell was moved to test different slots, results were changed to a spread of almost 100mAh for some testers, with the average spread between the 4 slots around 50mAh.
Given these results, these testers are unsuitable for determining small differences in capacity between a batch of new cells, but for testing cells from laptop pulls they are perfectly acceptable. Keep in mind though, that the results will be within a range of around 50mAh from the value that they show.

Test Conducted By: Micah Black
Written By: Micah Black

Posted on Leave a comment

Series and Parallel Cell Configurations

I do not claim to know everything there is to know about battery packs, but from building my fair share of packs, I am hoping to pass on a bit of knowledge.

In order to build a battery pack, individual cells must be configured in series and parallel configurations to achieve greater capacity and voltage.
Each cell has a certain capacity, voltage, and max current that can be determined from the cell’s datasheet. If a datasheet cannot be found, a general safe rule for 18650 style cells is a 1C (1 times the cell’s capacity) discharge rate.
There are a few basic rules to remember.

 

Parallel Connections:

Achieved by directly connecting the positive ends together and the negative ends together (+ to +, – to -).
Capacity of the cells are added together to achieve a higher capacity battery.
Voltage of the cells remain the same.
Before connecting all the cells together, be sure that all cells are at the same voltage (within 0.05V). If there is a large voltage difference between the cells, when you connect them in parallel with a wire (0 ohm resistance) then when connected together, the cells will try to balance out the voltage. With a larger voltage difference, the current flowing between the cells to balance them out will be large – and charging li-ion cells quickly will create heat.
Cells connected in parallel act as a single, larger capacity cell.
Another common question with parallel cell connections is if connecting cells with different capacities will be problematic. This in fact is not a problem. When discharging the cells with different capacities in parallel, the cell with higher capacity will discharge at a higher current in order to keep the voltage between the cells the same. If both cells discharged at the same rate, the cell with lower capacity would drop voltage quicker. Since the cells are parallel the voltage on each cell must be the same, so discharging cells at the same rate does not work. Both cells must maintain the same voltage, so the cells must discharge at different rates relative to their capacities.

 

Series Connections:

Achieved by connecting the positive end of one cell to the negative end of the next (+ of Cell 1 to – of Cell 2).
Capacity of the cells remain the same.
Voltage of the cells is added together.
Before connecting cells in series, it is advised but not necessary to balance the cells. The main drawback to connecting cells in series is that the cells must always be monitored to keep avoid over-discharging or over-charging individual cells.
The cells that are chosen to connect in parallel must ideally have the same capacity, age, and internal resistance (capacity is the most important) so that when charging the pack, the cells do not become unbalanced. When charging the pack, if one cell has a lower capacity than the rest, that cell will reach full charge before the others, but the battery will not be at a full charge voltage yet, so it will keep charging. The cell with a lower capacity will now be overcharged and risk heating up and going into thermal runaway. A similar thing will happen when discharging – the cells with a lower capacity will be discharged to a lower voltage than the rest and could be over-discharged if not properly monitored.
Because of this, it is strongly advised to have a Battery Management System (BMS) that is able to monitor the voltage of the pack and prevent over-discharging or over-charging cells. Higher end BMS systems will also include cell balancing – they will keep all the cells at the same voltage level either by bleeding off the extra energy in the high capacity cells through discharge resistors as heat (passive balancing), or by transferring charge of the high capacity cells to the low capacity cells through transformers or other methods (active balancing). Active balancing is generally the better option, as it does not waste excess energy, but it is more expensive to implement.

 

Naming:

A battery with X cells in parallel and Y cells in series is referred to as XPYS.
So a battery with 3 cells in parallel and 2 cells in series is referred to as 3P2S.
This battery has 6 cells in it with 3 in paralled, and 2 of those parallel groups in series. It has 2x the voltage and 3x the capacity of a single cell.

2S3P

3P2S

The order of the P and S designations in the battery can mean different things. I have heard differing opinions on about whether this 2S3P battery is the same as a 3P2S battery. Both batteries will contain 6 cells, but the order of how they are connected will differ slightly. A 2S3P battery will have 3 series strings of 2 batteries connected in parallel, while a 3P2S battery will have 2 series sets of 3 cells in parallel. The main difference with the 2S3P battery would be that there is no parallel connection across the first set of 3 cells. Each series string of cells should have its own BMS, as all 6 cells could be at different potentials (voltage). It is advised to go with a large parallel group of cells, and put those large parallel groups in series if possible, unless there are problems implementing such a system. When connecting multiple LiPo batteries in parallel through their power connectors, each individual cell should be monitored, as this is a 2S3P style system. A modular battery pack might also make use of this design so that some cells can be removed, while still maintaining the correct voltage to operate whatever device it is powering. The naming and the advice here are not strict rules, but just some of what I have come across on my extensive battery building journeys.

If interested in more information on lithium batteries, here is a great article.
It leans more towards information on charging and storage safety for LiPo batteries, but has tons of great information.

Posted on Leave a comment

Block Sorting Robotic Arm

For the past few years through the robotics club at my school, I have participated in the IEEE Arduino Challenges. These are complex design and programming challenges that will test the skills of the participants – high school students. In previous years, I have done the IBM LRT Detour challenge which involves line following, obstacle avoidance, and maze solving algorithms, as well as the Green Arm Challenge to detect, identify, and sort colored blocks.
This was my second year of the Green Arm Challenge, and through the last few competitions, I have learned so much – an introduction to graph theory with maze solving algorithms, fusion 360 assemblies, and especially time management (it helps to have a working robot on competition day!).
Now on to the competition. The goal of the competition is to detect, identify, and sort 3D printed coloured blocks, picking them up from one area, and placing them in other areas based on their color. The complete rules are available here. The recommended hardware (according to IEEE) is on that page as well, but of course I made some of my own adjustments.
As with most open-source hardware, there are always some modifications required. So let’s go over what I did:


Arm and Servos: The base platform is a MeArm – an open-source 4DOF robotic arm made by phenoptix. All the instructions and the laser cutting files are available on their instructables page here. The original one was purchased from robotshop as a complete kit for way more than what I would be willing to spend. After assembling it according to their instructable, the acrylic on acrylic rotation points were sticking a fair bit, so we tried putting nylon washers between the joints. Unfortunately, that did not solve the problem. It could have been because the bolts were too tight and threading directly into the acrylic, but if loosened, the robot would be too unstable. To fix all those problems, I downloaded the dxf files from their instructables page, removed the self-threading screw holes (as bolts and nylock nuts will be used), strengthened a few of the parts, and used the laser cutter at the Imagine Space in the Nepean Centrepointe Library to cut everything out of 3mm MDF. This arm was used in the first year of the Green Arm Challenge, but the next year I redesigned it again because it was still pretty flimsy. This time it used bigger servos (MG995) for the main rotation points (shoulder and elbow) because the smaller SG90 servos were a little too slow and not precise enough to make the new laser time of flight sensor worth it. I also modified the base of the robot to include a teflon rod in a circle around the base rotation to eliminate wobble of the whole robot by providing extra support at the front and back of the robot, while not sacrificing any speed or accuracy. In fact, it actually increased the accuracy of the height and distance of the robot because the wobbling was eliminated.


Claw Modifications: As for the claw, some modifications were required for this as well. The original acrylic and MG90S servo claws had the same rotation problems as earlier – they would get stuck. With the laser cut MDF wood version, it would not grip hard enough (this would also have been a problem with the acrylic version, had it not been getting stuck). Blocks would often swing out of the claw because there were only 2 points of contact on the block, and blocks would also often be dropped because it was not gripping hard enough.The way that this claw works is also not the best – the servo gets sent to a specific position, and in order to grip hard enough, the servo has the be trying to reach a position that it cannot reach because of the block it is gripping, and ends up grinding the servo gears and heats it up – obviously not ideal. So, I added some current limiting to the servo in order to avoid grinding the gears and heating up, but with this method the servo does not grip as hard. So, I also redesigned the claw to have 6 points of contact on the blocks rather than the original 2. I also put elastics between the contact points, in order to provide some extra grip on the block. Once the servo angles for opening and closing the claw were properly calibrated, a block was never dropped or swung out again.

Ultrasonic Distance sensor: To find the blocks, we had to use some sort of distance sensor. The first year, that sensor was an HC-SR04 ultrasonic sensor. Obviously not ideal, but that’s what we had to work with. Ultrasonic sensors are not ideal to be detecting the blocks the 45 degree ‘loading dock’ area, as their detection cone is around 30 degrees wide. So, any blocks it sees could be anywhere within a 30 degree angle. To try and fiw this, we ‘swept’ across the area, measuring the distance at each degree and found the lowest distance. Then we went to the angle that the lowest distance was found at and took off a loosely guessed 5 degrees to account for sensor error as it is sweeping across (it will see the block before it is actually in front of it). However, this method proved to be unreliable. Some other methods that we tried were desoldering the ultrasonic transducers from the board, and mounting the transmitter under the claw, pointing at a 45 degree angle upwards, and the receiver above the claw, so that the sound from the transmitter will reflect off the block only when it is in front of the claw. With this, we would have to sweep across the area, but also move the claw further from the base to detect the blocks that are further away. Unfortunately, mounting the ultrasonic transducers in this location made it so that the claw could not be lowered enough to grab the blocks. The transmitter would hit the platform before the claw was low enough to grab the block. Another method we tried was attaching circular cylinders to the front of the transducers in the original location (at the base of the robot), in order to direct the sound waves coming out of the sensor. While this method worked very well for objects further away (greater than 30cm probably), it does not work for close objects, as the reflected sound waves must be coming back parallel and a few cm displaced in order to be detected, but instead come back almost right into the first transducer. Long story short, the HC-SR04 ultrasonic sensor is not suitable for this application.

VL6180X and VL53L0X ToF distance sensors: A much better suited sensor to detecting blocks at smaller distances is the VL53L0X or VL6180X Time of Flight laser distance sensor. These are ideal mainly because they use light beams instead of ultrasonic sound waves to detect objects. As a result, these have a very small detection cone (it is just a beam of light), and will only detect an object when it is actually in front of it. These sensors are also made for the range that we are using them in. The VL53L0X has a distance of 3-200mm with an accuracy of 1mm so at first, this is the sensor that we went with as the maximum distance was perfect, and we were looking for the highest accuracy possible. When testing it however, this sensor was wildly inaccurate (off by 1-2cm) at distances longer than about 13 or 14 cm, getting worse as the distance grew closer to 200mm. After paying an outrageous amount for a VL6180X from amazon (instead of my usual Aliexpress orders – this one had a deadline), we were much more satisfied with the results. The VL6180X is made for distances from 30-2000mm, with a slightly coarser accuracy than the VL53L0X. This sensor matched exactly what we needed, and worked perfectly during testing.


TCS3200 TCS230 Color Sensor and mounts: These color sensors are the bog-standard color sensors in the Arduino community because they are so cheap. The one main problem with them is that they are very sensitive to external light. If any of the lighting conditions in the room change, they likely have to be recalibrated. The other problem that this creates is a very limited and precise range. I was able to get mine working in a roughly 0.5 – 1.5cm range. On the pcb they are mounted on, come 4 5mm white LEDs to illuminate the object. As the sensor gets closer to the object the accuracy increases, and these LEDs were getting in the way. So, they were removed from the board and mounted above the sensor. To get the most accuracy and consistency as possible, the sensor was mounted as close as possible to the blocks – in the crevice where the claw closes, using a custom 3D printed mount. This took a few revisions in order to get the optimal distance, and light positions. In the first revisions, the 4x5mm LEDs were mounted above the claw servo, but in the final version, a 1W LED with constant current driver made from 10W power resistors (what I had on hand) and some transistors to allow the Arduino to control it. This higher power LED was chosen to provide more light in general, as well as more directed light. This way, the small deviances in the distance from the sensor will matter less, because there is still enough light getting to the sensor.

Power Considerations (especially with sensor shield): To power all this, and keep the wiring manageable, a Sensor Shield for the Arduino Uno was used. In order to run the servos at the maximum possible speed, they were driven from 6V. Unfortunately, this created some complications with the Servo Shield. The external power terminal block was connected directly to 5V, and was routed around the board as 5V, including into the Arduino’s 5V pin. Driving this external block with 6V would clearly create some problems. So, some PCB traces were cut and re-attached with jumper wires in other places in order to route the terminal block input to the Arduino’s VIN pin, as this pin is regulated. From the terminal block, the 6V goes to the servo/sensor headers on the shield. The 5V pin on the Arduino was connected to all other devices on the shield – I2C, SPI, and other breakout pins. Now that the servos, and only the servos, were powered with 6V, we also have to take into account the current draw. With the larger MG995 servos having a max current draw of 2 or 3A, this robot can draw up to 8A under full load. However, that will never happen as the movement, claw grabbing, and light pulsing never never happen all at once. Also, the large servos will never draw their max current as moving a small robotic arm is not problem for them. As a power source, we went with a Li-ion battery custom-made from recycled laptop batteries (either 2S2P or 3S2P depending on which one was used) because there were tons readily available. To get the voltage down to 6V, a 5A 75W buck converter was used. We could have gone with a much beefier 9A module, but given that the large current draws for this robot are never sustained, and 5A buck converter is adequate. The 6V was fed directly in to the sensor shield’s external power terminal, and the Arduino was powered through the VIN pin.


Control Library: The last main part of the build was programming – which was a fairly interesting problem. We needed to figure out a way to translate a given height, distance and angle of the claw in order to travel to a specific point and grab a block. There is an arduino library called mearm IK by yorkhackerspace on Github that works very well to control the meArm in 3D space, however I did not really like the way that you had to use it and the calibration instructions were not well documented. So I decided to make my own algorithm to control the height, distance and angle of the claw. This height, distance, angle option was chosen because block distance is a distance, height off the ground is also a distance, and the field was a semi-circle – so an angle for that makes sense. The angle of the base is controlled via a servo, which makes that part real easy. A bit of calibration to determine the maximum and minimum angles for each 45 degree area (which is not really 45 degrees on the servo) was everything required. Now for the height and distance, this was a little more complicated. After drawing out a large scale version of the robot, and some careful analysis, I noticed that the angles of the servo arms can be computed based on a cosine law. The 2 links having the same angle made this calculation a little easier as well, because we have an isosceles triangle. If I can find the messy drawings I made, I will include them here. Converting this to the servo angles proved to be a little more difficult. We had to map the angle based off of an imaginary bar parallel to the ground at the height of rotation of the servos. Slowing down the servos was also a major consideration. If the servos have too much jerk, then the block is more likely to fall out of the claw while it is moving. To limit the jerk while still maintaining maximum speed, an algorithm that found the distance to the start and end points of the servos, then slowed the movement of the servo down as it was just starting to move and as it approaches the end of its movement was implemented. In theory, this would have worked, but it seemed that the movement commands were getting ahead of the servo and as a result the decelaration as it approached the end point never happened. In the end, all the servo movements were slowed down because that was fast enough for our purposes. The first year, I put all this code to calculate the angles in the main program, and suffered through the endless amounts of scrolling. The second time around, I was a little smarter about it. I created my own library to with all the control code in it, which made the main program much neater and easier to understand.

Final Results: When the day of the competition came, we were fairly confident, having a functional robot that worked most of the time. We had even had extra time to program it to not place blocks down on top of each other if multiple blocks of the same color were gathered. After a bit of tuning to the proper layout of the field (different places to put the green and blue colored blocks), the robot was able to reliably find, retrieve, and sort the colored blocks.

Posted on Leave a comment

50W Solar Panel As Cheap As Possible

A few months ago, I found a 100W solar panel kit on kijiji for $50. I had previously built a smaller solar panel to see if tabbing cells myself was actually viable. Quite a few cells were broken in the process, but I got the hang of it and managed to build a small panel, so I decided to try a bigger one.


The bigger cells were thicker and easier to work with, but it still took a few broken cells to get used to them. A few broken cells means that I could not build a 100W panel, but after building a 50W panel I’m glad I didn’t have the option of a bigger one – it would have been too big.
I made this panel as cheaply as possible, and used some fairly unconventional and not necessarily recommended methods of framing and protecting the cells. Let’s go over the frame first. As you have probably guessed from the pictures, the outer frame is not made from the industry-standard aluminum, but 4 pieces of 1×3 that I got for under $5 at the hardware store. For the backing of the panel, all that’s needed is a solid material that is preferably as light as possible. I went with some rigid foam insulation, as it fit the requirements fairly well. Usually, EVA sheets are used for this, but that certainly did not fit the ‘cheap’ requirement. I used only about $4 of rigid foam insulation.


To cover and protect the cells, a piece of glass, acrylic, or epoxy resin are commonly used but again far from the ‘cheap’ requirement. I found a few posts on solar power forums using clear spray paint to protect the cells. This is certainly less durable than the traditional methods, but works for my purposes. I would not leave this out in the rain or in heavy wind, but on those days, there is usually not much sun anyways. The other thing I had to consider was the amount of light that gets through to the cells, which I tested by spraying 1 of my small cells with a generous layer of spray paint. I measured the short circuit current of that cell and an un-coated cell, and found about a 10% reduction in output current. The open circuit voltage did not change. I believe the commercial methods get about 2% drop in power.

Now to go through tabbing the cells. This is definitely the most tedious process of building this panel. As mentioned earlier, this is a skill completely different than soldering 2 wires together. The general process is to put flux on the cell, then lay the tabbing wire across the pads, and drag your soldering iron along the whole length of the cell. The tabbing wires should be just shorter than the length of 2 cells, so that when you connect them in series, there is no risk of shorting a cell and losing power. Once 36 cells are tabbed along the front, I laid them out in 4 strips of 9 cells that I will wire all in series later to get an 18V open-circuit panel. Each cell produces roughly 0.5V, 36 in series gives 18V. This is the recommended configuration for charging a 12V battery bank, as when a load is placed on the panel, the voltage will drop.


After finishing tabbing all the strings, I laid them down on top of each other (big mistake) and did not have time to come back to them for a few weeks. When I finally got back to them, some of the had stuck together where the solder joints were, and I broke 2 or 3 cells trying to free them. After laying the 4 strips out on the foam backboard, I passed the main positive and negative wires through to the back side, wired the rest of the cells up in series with some bus wire, and added a 20A anti-backfeed diode to prevent the batteries draining in to the panels.
When spraying on the clear spray paint, one of the brands I tried started reacting with the rigid foam insulation and melted the top layer of it. If you were wondering why the back and front of the insulation look so different, that’s why.


Testing it revealed an open circuit voltage of roughly 17V, and a short circuit current of 3.5A. Total cost of the project was around $60. For a 50W panel, I’d say that’s not too bad.
This panel will be used to charge my DIY Powerwall once I get a boost converter figured out, as the Constant Current on the 1500W one I bought does not work. With a solar panel this is not a problem, but charging from mains I do not want to draw too much current from any power supply that I use.
If I were to make my own solar panel again, I would not put a strict price constraint of the cheapest possible panel on myself, and would go for an epoxy resin cover instead of the spray paint. This would be much more durable, and thus I would use it much more.

Written By: Micah Black

Project By: Micah Black

Posted on Leave a comment

Testing TC4056 Modules – Fake TP4056 Clones

I recently bought 150 TP4056 charge and protection boards to make a bunch more Eco-Charge power banks. Once I received them, I noticed that the ICs they were using were another type of TP4056 clone that I had not seen before – the TC4056. I had previously used and tested 4056E chips without issue, but I wanted to test these as well just to make sure.
My giant 18650 testing station is ideal for testing, because it has slots that perfectly fit the voltage and datalogger that I made earlier. The problem is that all the chips on it are of the 4056E variety, so I got my hot air rework station and went to work. I first practiced on a few of the boards that I had destroyed, so that I could get a hang of desoldering ICs with a connection on the bottom of them as well. Once I got the hang of it (it takes longer to melt the solder than on small passive components), I removed the 4056E from one of the board currently in the testing station, and replaced it with a TC4056 from one of the new boards.
After letting it cool down, I plugged in the datalogger and charged up a cell. The graph can be seen below, and is perfectly acceptable for charging 18650s. Like the 4056E chips, this one got quite warm as well, so I left the small heatsink on it as I had done with all the 4056Es in my testing station.

Project By: Micah Black

Written By: Micah Black

Posted on Leave a comment

Dual Power 3D Printer (AC Adapter and Battery) – with Supercapacitors

With the recent addition of a powerwall to my workshop, I’ve been running everything I can from it. That includes my 3D printer. I wanted to have dual power sources for and be able to switch between mid-print, so I could use an AC adapter for overnight prints, and could print from the battery during the day while I can monitor it (I do not have a BMS installed yet – I bought a 7 cell monitor with 50mA balance that I will eventually install).

Before jumping in to that, I figured I should clean up the wiring.

I used a 3 position switch to switch between AC power, Battery power, and OFF.

When switching from AC to battery I used a supercapacitor bank to power the board for the few milliseconds while the contact switches position. The supercapacitor module I used has 6 2.7V 100F supercapacitors connected to a overvoltage protection board. I could have used some batteries for this, but supercapacitors work very well and charging/discharging batteries properly would have been more complicated, heavier, and less appealing. Charging the supercapacitors could have been achieved just connected directly to 12V, but if they are dead to start it would draw a huge current and charge up very quickly which is usually the good side of supercapacitors. However, the problem with this is overcharging and staying balanced. The charging current would also be too much for the 12V 20A power supply, and the voltage would probably drop too much. Being chinese parts, I did not trust that the supercapacitors that I used would be balanced, so I decided to limit the charging current to 1A with a 10ohm resistor in series with the supercapacitors. This resistor would also limit the discharge current of the supercapacitor bank, which I did not want – so a 20A diode in parallel with the resistor was added to be able to discharge the pack at up to 20A. I also added a switch inline with the capacitor bank to connect or disconnect it from the 12V system. This will hopefully put less wear on the supercapacitors and let them last longer (especially considering I do not think they will last too long being chinese parts – one was already dead out of the box).


The other reason for adding the resistor in limiting the charge current was to completely eliminate any chance of the supercapacitors overcharging. The bleed resistors on the supercapacitor board can keep the cells under 2.7V while they are being charged at 1A.
An XT-60 connector was used for the battery connector. One issue I have found is the converting my 24VDC powerwall to 12VDC cheaply, and transmitting 20A current over almost 12 ft from my powerwall to my printer. I have a few different models of DC-DC buck converters on order, and will test them out once they arrive – the one that I currently have has too much of a voltage drop when drawing 20A, and the printer shuts down.
This has been a fun project, and it was amazing when it worked on the first try (powered from a smaller 12V battery).

Written By: Micah Black

Project By: Micah Black

Posted on Leave a comment

2.4kWh DIY Powerwall

My 2.4kWh powerwall is finally complete!

Printing the holders took a long time to do, and I thankfully had a friend help out with the printing. I had to print out almost 100 holders, using just over a full roll of filament.

Then came the brunt of the work – making over 1500 solder connections for this build (It took a while). I did most of the soldering outside because there is much better ventilation, and the weather was nice, so why not take advantage of it?

The positive end of each cell was soldered to a 4A fuse. I chose 4A, as this power wall was also designed to be able to run an electric car that I worked on for the Waterloo EV Challenge with the EVPioneers. and needed to be able to supply 150A burst current. I only had enough 2A and 4A fuses, and the 2A would not give me enough power. For use as a power wall, I would recommend using 1 or 2A fuses because it will keep the cells within reasonable operating limits. Yes, most cells when new can do 4A (2C) continuous, but after a long life in laptops, it is safer to keep them under 1C continuous.

The negative end was connected to the bus bars with the extra legs of the fuse wire that were cut off from the positive end.
And that brings me to the bus bars. I was originally planning on using copper – either flattened copper pipes bars, but after checking prices and feasibility, I decided against it. I couldn’t find an easy way to attach the 8 cell modules to the copper pipes without soldering, and comparing prices of copper bars to aluminum bars, I went for 1/8″ * 3/4″ aluminum bars.

Attaching the 8 cell modules to the bars was another adventure. On each of the 8 cell modules, the fuses were soldered to a wire with a screw terminal on the end in order to be able to swap out the 8 cell modules without soldering. I was originally planning on using 16AWG wire for this, but after checking out the 12AWG wire that I had lying around, the 12AWG was a lot easier to strip, and would heat up less under heavy loads. On the positive end, I made the wire just slightly longer than the modules in so that they would fit in the smallest space possible, and have just enough room to crimp a screw terminal on to. The negative end got a wire that was bent up to the same level as the positive wires. I covered this longer wire with heat shrink as much as possible, 3 separate sizes to prevent it shorting out where the positive end just pokes out the end opposite of its screw terminal.

Now for actually getting these parts – a $70 trip to the hardware store later, I came back with 8ft of aluminum, 100 12AWG screw terminals, 200 6-32 nuts and bolts (they were the cheapest), and some wood for the frame.

I cut the aluminum into 1ft lengths, then drilled lots of holes in it for mounting the aluminum to the frame of the power wall, and for the screw terminals to attach to. I did not want to have to get out a pair of pliers to hold the nuts in place and risk shorting something out when screwing the packs on to the bus bars, and I had recently seen Adam Welch make some captive nuts on his solar shed bus bars. So I designed a similar system that will hold 2 nuts. After printing out 56 of them, I started putting the nuts in, and sliding them on to the aluminum bus bars.

The frame of this power wall is made out of wood. I really should have used something non-flammable to mount everything to, but I could not find a metal cabinet or something similar in the right size. I also didn’t want to spend $150 on an enclosure, so wood it is. With all the testing I have done on these cells, and individually fusing each one, I do not think there will be any problems. I will be constantly monitor this looking for heaters, and checking voltages.

Each parallel group is separated with a piece of 1×3, which I mounted the aluminum bus bars on top of. Once all 8 bus bars were mounted, I started adding the packs in, balancing capacities as best I could while at it. I used an impact driver to tighten all the screws – I had previously replaced the aging NiCad in the impact driver with 18650s, and it’s still working great. I did run in to one 3D printed holder that I stripped, but thankfully it was at the end of one of the bus bars, so it was an easy replacement.
To finish up, I added a 150A circuit breaker to the positive end, and added a 1/4″ clear acrylic sheet over the top of the batteries to prevent any shorts.

The inverter I used for this is a 1000W modified sine wave inverter. It was one of the cheapest ones on Amazon, and that would probably be the one component I would change if I did do this again. On the other hand, pretty much my whole workshop is powered with DC, so it’s not too big of a problem. I do like it though, because it heats up my 60W AC soldering iron better than the house AC. My regular soldering iron – a Hakko T12 clone – is powered with DC, as well as my lights, and I will eventually add my 3D Printer to that list as well.
I have yet to stress this battery out, or do a proper capacity test, but so far, it’s been amazing.

Project By: Micah Black

Written By: Micah Black

Posted on Leave a comment

DIY Arduino-Based Bike Computer

The inspiration for this project came from trying to repair the bike computer that I had originally. I lost the base for it, and figured I could print a new base, and given that there were only 2 contact points for the magnetic sensor, I figured that it had to be a reed switch.
So I held the 2 leads of a reed switch to the 2 contact points, while moving it over a magnet, and sure enough, my assumption was correct. At this point, I knew what I had to do to fix the bike computer I had now, but there were still a few things I didn’t like about it – current speed was not available, and it had too many other metrics that I don’t care about.
The only logical solution was to build my own custom bike computer. Breadboarding the circuit with an Arduino, an OLED, and a reed swith connected to an external interrupt capable pin (D2 or D3 on the Uno, Nano) of the Arduino was simple. Figuring out the proper calculation to get from number of rotations per millisecond to kilometers per hour was a little trickier than expected. I did easily find one online, but wanted to see if I could come up with the same result.

With the basic circuit and programming complete, I started to design an enclosure for it in Fusion 360. The enclosure mounts to the bike through a separate piece which is zip-tied to the handlebars. The reed switch is will be permanently mounted to the bike (again with zip ties) to the fork. To connect the permanently mounted reed switch and the removable Arduino parts, I used an XT-60 connector. It’s only electrical purpose is to pass the signal from the reed switch to the Arduino, but it also holds the removable part in place. I could have accomplished the same thing with some dupont-style 2.54mm pin headers and designed a clip on to the model, but I went the route of XT-60 connectors because I felt it was easier.

In the removable part of the bike computer, I had to fit an Arduino nano, an OLED, a sliding power switch, 4 push buttons for menu navigation, the XT-60 connector, as well as a li-ion battery, a TP4056 charge and protection board, and a 5V boost converter. It was a tight fit, but I managed to get everything in.

The battery I used for this build is not the typical 18650 that I have in so many other projects, as that would have required the enclosure to be a lot bigger. For this project, I took a cell from an old cell phone that I got from an electronics recycling, removed the plastic casing and protection circuit, tested the voltage (it was around 2.7V), and charged it up. The cell was rated at 895mAh, and the TP4056 modules are pre-set to charge at 1A, which would be just over 1C for this cell, I decided to change the charging resistor on the TP4056 board. I could have done this with a soldering iron and a fine tip, but given that I recently got a hot air rework station, I figured now would be a good time to use it. Typically, Li-ion cells can be charged at 1C, but given that this cell was used and sitting at under 3V for a few years, I decided to go for a 0.5C (roughly 500ma) charge rate.

The appropriate resistor for that would be around 2.5K ohm, but the closest bigger resistor that I had was 3.3K, which worked out to roughly a 350mA charge rate. I replaced the resistor, and charged it up without issue. The battery got connected directly to the BAT+ and BAT- pads of the TP4056 module. The OUT+ of the TP4056 gets connected to one side of the power switch, while the other side is connected to IN+ of the boost converter. OUT- of the TP4056 is connected directly to IN- of the boost converter. The boost converter output was originally a USB type A port, which I removed, and soldered wires directly to the 5V and GND pads on the PCB (the outer 2 pins of the USB connector). They are not labelled, but the GND pad is directly connected to IN-, so I got my multimeter out to check continuity. Once I had that figured out, I connected the wires to 5V and GND on the Arduino. All the buttons got connected one side to GND and the other side to a digital pin, declared as INPUT_PULLUP in the code.

It was a very tight fit getting the Arduino into the enclosure. While putting it in the first time, I dislodged one of the SMD capacitors on the back of the board. I soldered it back without issue, but then it would not accept uploading a program to it. Most likely, I also damaged some of the traces going to the capacitor, but I’m not sure. I replaced the Arduino, and got everything properly mounted in the enclosure. I soldered the OLED to the Arduino before screwing it in to the enclosure with 4 M3 screws. Then the Nano went it next, secured with friction for now. I put the XT-60 connectors in both parts of the mount, and secured them with two-component adhesive, which I also used to secure the Arduino at this point, and the power switch. After soldering the 4 push buttons for menu navigation to the Arduino, they got glued in with a generous amount of hot glue. The TP4056 module went in directly on top of the Arduino, the boost converter slid in behind the switches, and the battery fit over top of everything. I’m sure I could have made the wiring more elegant, but it would have taken much more time.

Overall, this accomplished exactly what I wanted it to do – get me information on current speed, and distance travelled while riding my bike. I also added in some functionality to track trips, and save up to 10 of them in EEPROM memory.

 

Project By: Micah Black

Written By: Micah Black