<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Rob's Tech Blog</title><link href="https://blog.s3nt.net/" rel="alternate"></link><link href="https://blog.s3nt.net/feeds/all.atom.xml" rel="self"></link><id>https://blog.s3nt.net/</id><updated>2023-02-23T00:00:00+08:00</updated><entry><title>Adding Automation to the blog</title><link href="https://blog.s3nt.net/adding-automation-to-the-blog.html" rel="alternate"></link><published>2023-02-23T00:00:00+08:00</published><updated>2023-02-23T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2023-02-23:/adding-automation-to-the-blog.html</id><summary type="html">&lt;p&gt;&lt;img alt="code pipeline" src="https://blog.s3nt.net/images/sysadmin/Arch_AWS-CodePipeline_64.png"&gt;&lt;/p&gt;
&lt;p&gt;This blog is a static site,  meaning that there are no cookies or server-side processing performed to display the content.&lt;/p&gt;
&lt;p&gt;I chose to use &lt;a href="https://getpelican.com/"&gt;Pelican&lt;/a&gt; for site generation since it is developed with python which I'm most comfortable with.
Up until now, I've written the content, process the pages into …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="code pipeline" src="https://blog.s3nt.net/images/sysadmin/Arch_AWS-CodePipeline_64.png"&gt;&lt;/p&gt;
&lt;p&gt;This blog is a static site,  meaning that there are no cookies or server-side processing performed to display the content.&lt;/p&gt;
&lt;p&gt;I chose to use &lt;a href="https://getpelican.com/"&gt;Pelican&lt;/a&gt; for site generation since it is developed with python which I'm most comfortable with.
Up until now, I've written the content, process the pages into HTML files and after reviewing the new content uploaded it manually to the web server. 
This has been fine for a long time however I've made the odd mistake during generation which caused a broken web page for a short period while I fix it.&lt;/p&gt;
&lt;p&gt;I recently decided that I should treat the process a little more seriously as it is good practice to follow industry standards when doing personal projects as long as the effort doesn't outweigh the benefit.&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;The issue&lt;/h3&gt;
&lt;p&gt;Writing content for the blog is pretty easy however the publishing process isn't as straightforward as I would prefer.&lt;/p&gt;
&lt;p&gt;Order of operation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Write a markdown document in the website project folder.&lt;/li&gt;
&lt;li&gt;Preview the new page using pelican built-in web server to check the page looks ok.&lt;/li&gt;
&lt;li&gt;Make edits if needed.&lt;/li&gt;
&lt;li&gt;When I'm happy with the page, I run the command to generate the page for publishing.&lt;/li&gt;
&lt;li&gt;manually upload the html files to the web server.&lt;/li&gt;
&lt;li&gt;double-check that the site is loading fine.&lt;/li&gt;
&lt;li&gt;commit the changes to my private git repo.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;These steps are very easy, to be honest, steps 4-7 probably take five minutes to do.&lt;/p&gt;
&lt;p&gt;Repetitive tasks no matter how easy, over time get skipped or forgotten by people. &lt;/p&gt;
&lt;p&gt;&lt;img alt="bad footpath design" src="https://blog.s3nt.net/images/sysadmin/footpath-design.jpg"&gt;&lt;/p&gt;
&lt;p&gt;It kind of reminds me of this footpath design. I'm sure you've seen this in your city/neighbourhood before.&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;The solution&lt;/h3&gt;
&lt;p&gt;Automation!!&lt;/p&gt;
&lt;p&gt;Why not use automation to minimize the number of manual steps required to create content?&lt;/p&gt;
&lt;p&gt;I've taken advantage of the DevOps tools that are built into AWS and are free (if you adhere to the free tier rules.).&lt;/p&gt;
&lt;h4&gt;I started out by fixing my git hygiene.&lt;/h4&gt;
&lt;p&gt;A branch for production and a branch for development are all that's needed at the moment since I'm the only one writing content.&lt;/p&gt;
&lt;p&gt;Instead of the commits happening at the end of the process, it now needs to happen earlier on in the content writing process. lots of smaller changes are better than one big one at the end.&lt;/p&gt;
&lt;p&gt;While writing the content and reviewing the page locally, there may not need to be a whole lot of commits but it does depend on how much is being changed.&lt;/p&gt;
&lt;h4&gt;Using AWS CodeBuild to generate the pages&lt;/h4&gt;
&lt;p&gt;Codebuild is a service offered by AWS that takes a list of instructions in the form of a 'buildspec' file, collects all the relevant artifacts and can then build your software automatically.&lt;/p&gt;
&lt;p&gt;I started creating a Codebuild project to get pelican to generate the pages, however, while testing the process I got pretty impatient while waiting for codebuild to initialize a worker. &lt;/p&gt;
&lt;p&gt;Luckily AWS provides CodeBuild images that can be run &lt;a href="https://docs.aws.amazon.com/codebuild/latest/userguide/use-codebuild-agent.html"&gt;locally on docker.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I downloaded the dockerfile for the image I wanted to use and started the process to build the docker image. This took a long time since Australia still has terrible internet... 😠&lt;/p&gt;
&lt;p&gt;After the docker image was built, I was able to test the build process on my machine very quickly to ensure that the correct version of pelican was used and a few other checks were performed on the data before the content was generated.
Here's a simplified version of the 'buildspec.yml' file I was using while testing the process.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;

&lt;span class="n"&gt;phases&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="k"&gt;install&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;runtime&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;versions&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;3.10&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pip3&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;pelican[markdown]&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;## downloads pelican onto the codebuild worker.&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Build&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;started&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n n-Quoted"&gt;`date`&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pelican&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;## Generates html files&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="n"&gt;post_build&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Build&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;completed&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n n-Quoted"&gt;`date`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Buildspec files are used to instruct the codebuild worker what files and tools are required to put together the code written and build the software.&lt;/p&gt;
&lt;p&gt;I then added a few more steps to the buildspec file to check for errors, detect syntax issues then upload the files to the web server.&lt;/p&gt;
&lt;h4&gt;Setting up CodePipeline&lt;/h4&gt;
&lt;p&gt;CodePipeline is another service provided by AWS that joins together all the stages of a build process: repository &amp;gt; build &amp;gt; deploy.&lt;/p&gt;
&lt;p&gt;CodePipeline allows for each stage to be automated to the point where after a developer writes the code, the rest of the stages don't require human involvement. Makes things significantly faster with less room for mistakes.&lt;/p&gt;
&lt;p&gt;I implemented the pipeline to watch for changes in the source repository, generate the files and deploy it to a staging web server.&lt;/p&gt;
&lt;p&gt;Once the staging site is online, I've implemented a few tests to check if the page is rendering correctly. if staging looks good, a pull request is generated for me to manually review. once approved the changes are deployed to production.&lt;/p&gt;
&lt;p&gt;The code pipeline looks like this (some parts redacted or hidden):&lt;/p&gt;
&lt;p&gt;&lt;img alt="codepipeline" src="https://blog.s3nt.net/images/sysadmin/codepipeline.png"&gt;&lt;/p&gt;
&lt;p&gt;Since this blog is a static site, a deployment stage is not necessary. when a build is successful, the files are sent to the web server.&lt;/p&gt;
&lt;p&gt;The new order of operation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Write content.&lt;/li&gt;
&lt;li&gt;Review the page locally.&lt;/li&gt;
&lt;li&gt;Make edits if needed.&lt;/li&gt;
&lt;li&gt;commit changes to the development branch.&lt;/li&gt;
&lt;li&gt;codepipeline triggers a build of the development version of the site and publishes it to the staging version of the blog. (Automated)&lt;/li&gt;
&lt;li&gt;Review to ensure the blog is working as expected. (Automated check)&lt;/li&gt;
&lt;li&gt;create a pull request to merge development to the production branch. (Automated)&lt;/li&gt;
&lt;li&gt;Codepipeline triggers a build to production and publishes the site to &lt;a href="https://blog.s3nt.net"&gt;https://blog.s3nt.net&lt;/a&gt;. (Automated)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;As seen above, steps 5-8 are fully automated now (with the exception of approving the pull request)&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Roll back procedure&lt;/h3&gt;
&lt;p&gt;Rollbacks are just as easy. 
Changes are tested in staging before going to production. &lt;/p&gt;
&lt;p&gt;if there was a problem with the site and I miss it during the review, I can roll back to the last good production release.&lt;/p&gt;
&lt;p&gt;Rollback is using CodePipeline and therefore fully automated.&lt;/p&gt;</content><category term="sysadmin"></category><category term="aws"></category><category term="automation"></category><category term="blog"></category></entry><entry><title>Relay Controller Project</title><link href="https://blog.s3nt.net/relay-controller-project.html" rel="alternate"></link><published>2023-01-06T00:00:00+08:00</published><updated>2023-01-06T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2023-01-06:/relay-controller-project.html</id><summary type="html">&lt;p&gt;&lt;img src="https://blog.s3nt.net/images/solar/relay_board_box.jpg" alt="relay controller" style="width:50%;height:50%;"&gt; &lt;/img&gt;&lt;/p&gt;
&lt;p&gt;I've been running the Solar system for a few years now without much trouble. Over time the battery capacity has slowly decreased to the point where the system gets dangerously low voltage overnight.
The batteries I've been using are second-hand sealed "standby batteries" which were never designed to handle constant …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img src="https://blog.s3nt.net/images/solar/relay_board_box.jpg" alt="relay controller" style="width:50%;height:50%;"&gt; &lt;/img&gt;&lt;/p&gt;
&lt;p&gt;I've been running the Solar system for a few years now without much trouble. Over time the battery capacity has slowly decreased to the point where the system gets dangerously low voltage overnight.
The batteries I've been using are second-hand sealed "standby batteries" which were never designed to handle constant use and they already had been used for a few years before I bought them. &lt;/p&gt;
&lt;p&gt;I've been connecting up a 24V battery charger on an ad-hoc basis over winter and sometimes have had to go turn it on before bed if I could see that the system wouldn't last the night.&lt;/p&gt;
&lt;p&gt;I've only been using the system to charge power tools and run a deep freezer (surprisingly low power usage!). Due to the freezer turning on more when the weather heats up, i've found that the batteries just cant handle it any more.&lt;/p&gt;
&lt;p&gt;I intend on replacing this ageing battery bank with a new-ish lithium bank that is correctly sized, however even second-hand cells are a little bit out of my budget for something that is pretty much just a hobby system. So in the meantime, I have a solution....&lt;/p&gt;
&lt;h1&gt;Relay controller&lt;/h1&gt;
&lt;p&gt;I like the whole IOT-controlled power outlets but I dislike the reliance on the internet/cloud servers due to security and reliability issues. I decided to create my own solution to this problem.&lt;/p&gt;
&lt;p&gt;The features that I consider important for designing a home automation/IOT power control:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;wired connectivity&lt;/strong&gt;&lt;ul&gt;
&lt;li&gt;The device must have a wired connection for communications. It can have a wireless control component but it cannot solely rely on wireless.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Manual Over-ride&lt;/strong&gt;&lt;ul&gt;
&lt;li&gt;The device must have a manual override, where you can turn on the outlet via a switch in the case where the internet/network isn't working or the "&lt;a href="https://en.wikipedia.org/wiki/Bus_factor"&gt;&lt;em&gt;bus factor&lt;/em&gt;&lt;/a&gt;" occurs and someone else needs to turn on the device.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;simple function&lt;/strong&gt;&lt;ul&gt;
&lt;li&gt;The device can be self-contained with some automation such as simple timers or similar. ideally, i want the device to only do what is expected of it and the smart stuff is moved onto a computer for better flexibility around the choice of software.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Designing the relay controller.&lt;/h2&gt;
&lt;p&gt;The relay controller will be based on an Arduino nano.&lt;/p&gt;
&lt;p&gt;I've settled on using off-the-shelf hobby components with a little bit of a challenge to minimize the number of pins used on the Arduino.&lt;/p&gt;
&lt;p&gt;Relay board:
&lt;img alt="relay board" src="https://blog.s3nt.net/images/solar/8CH-relay-board_arduino.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I picked up one of these hobbyist boards online. This board takes 1 pin for each relay. since the Nano has limited pins I don't want to waste valuable I/O on turning on and off a relay.&lt;/p&gt;
&lt;p&gt;The relays are powered by 12VDC and the MOSFETs require 5V signals. I'll use a 24V to 12V regulator for the relays and for 5V signalling I'll use the 5V supply from the Arduino.&lt;/p&gt;
&lt;p&gt;My solution to minimize pin usage is to use a shift register IC to power the relay pins. I've never used a shift register before but I'll figure it out.&lt;/p&gt;
&lt;h3&gt;Schematic&lt;/h3&gt;
&lt;p&gt;I did some googling, read some data sheets and watched some youtube about shift registers, they seem simple enough so I made a schematic of the circuit I want to make.&lt;/p&gt;
&lt;p&gt;&lt;img alt="relay_controller_schematic" src="https://blog.s3nt.net/images/solar/schematic_relay_controller.png"&gt;&lt;/p&gt;
&lt;p&gt;The shift register I decided to use was a &lt;code&gt;74HC595N 8bit tri-state CMOS IC&lt;/code&gt; which is a Serial-in/Parallel-out type.&lt;/p&gt;
&lt;p&gt;In the above schematic, I've included 9 toggle switches. 8 switches for relays and 1 for 'manual-override' mode. in normal operation, the Arduino would be controlling the shift register. The Arduino would then take its commands via USB(Serial) connected to my raspberry pi.&lt;/p&gt;
&lt;h2&gt;Building the relay controller.&lt;/h2&gt;
&lt;p&gt;I've still not figured out how to create a PCB Mask and etch my own PCBs so it's protoboard again...&lt;/p&gt;
&lt;p&gt;&lt;img alt="relay_board_box" src="https://blog.s3nt.net/images/solar/relay_board_box.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I, unfortunately, didn't get any good photos of the protoboard while I was making it. &lt;/p&gt;
&lt;p&gt;For those with protoboard experience, I'm sure you can imagine what the solder tracks look like 😂.&lt;/p&gt;
&lt;p&gt;I ended up damaging a few shift registers during the breadboarding process, I accidentally gave them 12V instead of their max input of 5V. 🤦‍♂️&lt;/p&gt;
&lt;p&gt;It took me a while to figure out that I had damaged the IC since it would work if I manually shifted the bits in using push buttons to simulate the Arduino. But when I used the Arduino, the IC appeared completely dead.&lt;/p&gt;
&lt;h2&gt;implementing the relay controller&lt;/h2&gt;
&lt;p&gt;My plan is to use the solar analytics data that I've been collecting with my Raspberry Pi to determine when to turn on the battery charger while continuing to utilise solar power for the majority of the charging.&lt;/p&gt;
&lt;p&gt;some Pseudo code that would run on the Raspberry Pi:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;If&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;PV_Voltage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;.&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;AND&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;Battery_Voltage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;23&lt;/span&gt;.&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
{
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;Batt_charger&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;Enabled&lt;/span&gt;
}
&lt;span class="k"&gt;Else&lt;/span&gt;
{
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;Batt_charger&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;Disabled&lt;/span&gt;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This IF statement should only turn on the battery charger when the battery bank is Low and when the solar panels are not generating reasonable power.
I'm expecting that this should cover most situations. Summer/Winter, Cloudy Days, solar panel fault, etc..&lt;/p&gt;
&lt;p&gt;This doesn't account for the increased load from devices, though. I'll need to keep in mind what loads are being left on overnight and ensure I'm not exceeding the battery chargers rated current.&lt;/p&gt;
&lt;p&gt;The 7 other relays are not in use yet, but I intend on adding more devices that can be programmed to utilise as much of the excess solar power as possible.&lt;/p&gt;
&lt;p&gt;For example, I could use the relay controller to heat water during the day when there's excess power and then use it to provide hot water to the house.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;it works!!&lt;/h2&gt;
&lt;p&gt;I implemented the first version of the scripts and the difference is pretty obvious.&lt;/p&gt;
&lt;p&gt;Here's a graph of the battery voltage overnight, with no charger*:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Before_graph" src="https://blog.s3nt.net/images/solar/before_graph.png"&gt;
The voltage gets to 22V and as low as 20V just before sunrise. 
This is way too low for lead-acid batteries and I'm sure this has done some damage.&lt;/p&gt;
&lt;p&gt;Here's the graph after I added the relay controller*:&lt;/p&gt;
&lt;p&gt;&lt;img alt="after graph" src="https://blog.s3nt.net/images/solar/after_graph.png"&gt;&lt;/p&gt;
&lt;p&gt;While the voltage does still dip to 23V (still not good) it now doesn't drop to &amp;lt; 22V overnight. I'll need to make some adjustments to allow the charger to turn on earlier to maintain a better voltage.&lt;/p&gt;
&lt;p&gt;The small dip and spike between 0500hrs and 0600hrs is the solar panel voltage going over the threshold to keep the charger turned on. Some trees block the solar panels in the morning which would explain why the charger turns off and then back on a short time later.&lt;/p&gt;
&lt;h3&gt;Some Notes.&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;*Keep in mind that all battery measurements on this page are measured under load which is not the right way to measure battery State of Charge. I should be doing quarterly capacity tests to get a better idea of the health of these batteries.&lt;/li&gt;
&lt;li&gt;The batteries were tested at 80% healthy when I bought them and that was a few years ago. These batteries don't have much life left, I'm just kicking the can down the road for a bit until lithium batteries/cells get a little cheaper which at this rate could be 6 months from now.&lt;/li&gt;
&lt;li&gt;The other benefit to using the relay controller over just connecting the battery charger full-time or on a timer is that this solution doesn't need adjustment when the seasons change. Because the charger isn't staying on full-time, the solar panels are doing the majority of the charging and the charger is acting as a safety buffer.&lt;/li&gt;
&lt;li&gt;I'm intending on publishing the code used on my personal Github in the future. I'll update this post with links when I do that.&lt;/li&gt;
&lt;/ol&gt;</content><category term="Projects"></category><category term="solar"></category><category term="electronics"></category><category term="arduino"></category></entry><entry><title>Quadbike Project (Part 07)</title><link href="https://blog.s3nt.net/quadbike-project-part-07.html" rel="alternate"></link><published>2022-10-06T00:00:00+08:00</published><updated>2022-10-06T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2022-10-06:/quadbike-project-part-07.html</id><summary type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-05.html"&gt;Part 5 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-06.html"&gt;Part 6 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Getting off the breadboard&lt;/h2&gt;
&lt;p&gt;Now that i've tested the throttle and steering circuits/code, i need to get this stuff into an enclosure.&lt;/p&gt;
&lt;h3&gt;Motor Controllers&lt;/h3&gt;
&lt;p&gt;For the enclosure, i've decided to use two cast-aluminum …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-05.html"&gt;Part 5 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-06.html"&gt;Part 6 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Getting off the breadboard&lt;/h2&gt;
&lt;p&gt;Now that i've tested the throttle and steering circuits/code, i need to get this stuff into an enclosure.&lt;/p&gt;
&lt;h3&gt;Motor Controllers&lt;/h3&gt;
&lt;p&gt;For the enclosure, i've decided to use two cast-aluminum boxes instead of one. My thoughts were that the motor speed controllers may emit a fair amount of EMF, so separating them would be a good idea.&lt;/p&gt;
&lt;p&gt;&lt;img alt="esc_top" src="https://blog.s3nt.net/images/quadbike/esc_top.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I'm using two motor speed controllers, one for steering control and the other for the brake motor. &lt;/p&gt;
&lt;p&gt;The motor controllers fit quite well in the enclosure however the terminals were the wrong way around.
&lt;img alt="esc_terminals" src="https://blog.s3nt.net/images/quadbike/esc_terminals.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I was able to de-solder and reverse the terminal pins to allow for the wires to fit in the box.
These green terminals were reversed to point the other way.&lt;/p&gt;
&lt;p&gt;&lt;img alt="esc enclosure" src="https://blog.s3nt.net/images/quadbike/esc_enclosure.jpg"&gt;
It was a tight fit getting both motor controllers inside the case.&lt;/p&gt;
&lt;p&gt;I de-soldered the header pins and soldered the wires directly to the board. i used a combination of Hot glue, dielectric tape and Sikaflex to help prevent anything from moving around.&lt;/p&gt;
&lt;p&gt;For cable choice i used 7-core trailer wire for the high-power side and for the signalling wires i used one of those USB-C cables used to connect a laptop to a laptop dock.&lt;/p&gt;
&lt;p&gt;Turns out that USB-C cables are a great source of thin but strong cable that is heavily shielded and has plenty of cores (close to 20-cores if i recall).&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Arduino and the rest.&lt;/h3&gt;
&lt;p&gt;I added the throttle circuit components to a breadboard. The board is also hosting "interconnects" that sit between the arduino and the wiring harness.&lt;/p&gt;
&lt;p&gt;&lt;img alt="throttle_board" src="https://blog.s3nt.net/images/quadbike/throttle_board.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I've never been able to create a breadboard circuit without it becoming spaghetti. i hope to replace this with a custom printed PCB in the future.&lt;/p&gt;
&lt;p&gt;The Arduino was added to another breadboard with all the wires connected. 
Thankfully the USB-C cable has color coded shielding.&lt;/p&gt;
&lt;p&gt;&lt;img alt="arduino_board" src="https://blog.s3nt.net/images/quadbike/arduino_breadboard.jpg"&gt;&lt;/p&gt;
&lt;p&gt;The arduino, throttle breadboard, RC receiver and power regulator were all crammed into the enclosure.&lt;/p&gt;
&lt;p&gt;&lt;img alt="arduino_enclosure" src="https://blog.s3nt.net/images/quadbike/arduino_enclosure.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Just like the motor controller enclosure, i used a combo of Sikaflex, Hot glue and high-strength double-sided table to hold everything in place.&lt;/p&gt;
&lt;p&gt;I tested everything after installing in the enclosure and it looks good!!&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;Part 8 Coming soon....&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category><category term="arduino"></category></entry><entry><title>Quadbike Project (Part 06)</title><link href="https://blog.s3nt.net/quadbike-project-part-06.html" rel="alternate"></link><published>2022-08-12T00:00:00+08:00</published><updated>2022-08-12T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2022-08-12:/quadbike-project-part-06.html</id><summary type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-05.html"&gt;Part 5 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;RC Control&lt;/h2&gt;
&lt;p&gt;As mentioned in part 5, i've purchased a Turnigy GT6 Surface radio. This radio (along with other Hobby RC units) outputs a pulsed signal to control the servos. 
I cant directly connect the RC …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-05.html"&gt;Part 5 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;RC Control&lt;/h2&gt;
&lt;p&gt;As mentioned in part 5, i've purchased a Turnigy GT6 Surface radio. This radio (along with other Hobby RC units) outputs a pulsed signal to control the servos. 
I cant directly connect the RC receiver to the motors, i need to interpret the signals then drive the steering, brake, throttle on the bike.&lt;/p&gt;
&lt;p&gt;I decided to use an Arduino Nano v3 for this task. It will be used as a translator between the RC receiver and the motors on the quad bike.&lt;/p&gt;
&lt;h4&gt;A high level diagram:&lt;/h4&gt;
&lt;p&gt;&lt;img alt="arduino high level" src="https://blog.s3nt.net/images/quadbike/RC_high_level.png"&gt;&lt;/p&gt;
&lt;p&gt;The intention is feed the RC receiver into the arduino, the arduino interprets the pulses and then reacts accordingly.
i'm using the 'BTS7960 High power motor driver modules' to control the motors and 10K potentiometers for position feedback.&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Getting Steering working&lt;/h3&gt;
&lt;p&gt;To start off, i've used some code that others have used to interpret RC signals.&lt;/p&gt;
&lt;p&gt;There are two main methods of processing these signals on the arduino, &lt;code&gt;PulseIn()&lt;/code&gt; function or assigning interrupts for the pins coming from the RC receiver.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PulseIn:&lt;/strong&gt; is a simple enough function to use, however it is a blocking function. 
Meaning that while the PulseIn function is running, nothing else can be performed. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Interrupts:&lt;/strong&gt; this is a far more complicated function however it allows for the arduino to be doing something else and when an interrupt gets triggered,  the arduino will quickly process the signal and get back to what it was doing.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;when i found that the PulseIn function was blocking, i started imagining the scenario where the bike is driving down the road and it gets stuck processing a signal causing the bike to crash into some bushes or something.
I've settled on the Interrupt method as i believe it will be safer.&lt;/p&gt;
&lt;p&gt;I wired up the steering motor, controller and RC receiver on my desk and using some basic "move a motor with an RC controller" code i found online.&lt;/p&gt;
&lt;p&gt;Here's a short clip of the motor being used with positional feedback:&lt;/p&gt;
&lt;video width="500" height="300" loop autoplay muted&gt;
&lt;source src="https://blog.s3nt.net/images/quadbike/servo_feedback.webm" type="video/webm"&gt;
Your browser does not support the video tag.
&lt;/video&gt;
&lt;p&gt;I'm using a 10K potentiometer (under the black square) with some scrap wire to link the motor and the pot. &lt;/p&gt;
&lt;p&gt;I'm now confident that the steering is sorted out. i still need to mount it and make permanent wiring.&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Throttle control&lt;/h3&gt;
&lt;p&gt;Throttle control is a tricky problem. i can see two different methods in getting this working:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;install an R/C servo inside the throttle box to control the throttle sensor.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;: simple solution, R/C servo is cheap and easy to source.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cons&lt;/strong&gt;: servo would be an interference mechanism, meaning that in some cases the servo may hold the throttle open or prevent the thumb throttle from moving.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;bypass the throttle box all together by re-generating the throttle signal.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pros&lt;/strong&gt;: non-interference solution since the throttle box is bypassed. A challenge.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;cons&lt;/strong&gt;: more complex, custom circuitry required, i have no experience with this method.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After some more research, i believe option two should be tried first and one can be the fallback.&lt;/p&gt;
&lt;hr&gt;
&lt;h4&gt;Generating the throttle signal&lt;/h4&gt;
&lt;p&gt;I've tested the throttle box hall-effect sensor with my multimeter.&lt;/p&gt;
&lt;p&gt;the sensor is generating a linear voltage range that is in relation to the distance from the magnets.&lt;/p&gt;
&lt;p&gt;neutral: 3.5V&lt;/p&gt;
&lt;p&gt;full throttle: 0.7V&lt;/p&gt;
&lt;p&gt;I cant generate a voltage with an arduino, i can only generate a PWM signal. additional circuitry is needed.&lt;/p&gt;
&lt;p&gt;My idea for this circuit is that the PWM signal from the arduino can be used to generate an analog signal by charging and discharging a capacitor.&lt;/p&gt;
&lt;p&gt;I've created a test circuit on Tinkercad which i feel will do the job.&lt;/p&gt;
&lt;video width="600" height="300" loop autoplay muted&gt;
&lt;source src="https://blog.s3nt.net/images/quadbike/throttle_sig.webm" type="video/webm"&gt;
Your browser does not support the video tag.
&lt;/video&gt;

&lt;p&gt;The waveform in the above video is not very smooth, it's more of a sawtooth. 
I don't think this will be an issue as the bike's speed controller is also a digital device.&lt;/p&gt;
&lt;p&gt;The speed controller will be sampling the throttle sensor at a set frequency, i just need to tune my circuit to be smooth enough to trick the motor speed controller.&lt;/p&gt;
&lt;p&gt;Schematic of the throttle signal circuit:
&lt;img alt="throttle_circuit" src="https://blog.s3nt.net/images/quadbike/throttle_circuit.png"&gt;&lt;/p&gt;
&lt;p&gt;*msft01 is going to the arduino.
I added a 500R multi-turn potentiometer to fine tune the output voltage.&lt;/p&gt;
&lt;hr&gt;
&lt;h4&gt;Testing the throttle on the bike&lt;/h4&gt;
&lt;p&gt;I replicated the Tinkercad circuit onto a breadboard and took it into the workshop.&lt;/p&gt;
&lt;p&gt;I used the R/C transmitter to control the PWM duty-cycle.&lt;/p&gt;
&lt;p&gt;Here's a video of the throttle test.&lt;/p&gt;
&lt;video width="600" height="300" loop autoplay muted&gt;
&lt;source src="https://blog.s3nt.net/images/quadbike/throttle-test.webm" type="video/webm"&gt;
Your browser does not support the video tag.
&lt;/video&gt;

&lt;p&gt;Note the vibrations at full RPM, there's not much i can do about it. This bike is quite poorly built from the factory and those tyres need replacing...&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-07.html"&gt;Part 7 Here &lt;/a&gt;&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category><category term="arduino"></category></entry><entry><title>Quadbike Project (Part 05)</title><link href="https://blog.s3nt.net/quadbike-project-part-05.html" rel="alternate"></link><published>2022-07-01T00:00:00+08:00</published><updated>2022-07-01T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2022-07-01:/quadbike-project-part-05.html</id><summary type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Gameplan&lt;/h2&gt;
&lt;p&gt;As part of the quadbike rebuild project, i want to be able to drive the quad remotely like a R/C car. &lt;/p&gt;
&lt;p&gt;There's quite a few things wrong with the design of this bike. it definitely is …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Gameplan&lt;/h2&gt;
&lt;p&gt;As part of the quadbike rebuild project, i want to be able to drive the quad remotely like a R/C car. &lt;/p&gt;
&lt;p&gt;There's quite a few things wrong with the design of this bike. it definitely is a cheaply made quadbike, the quality control is terrible.&lt;/p&gt;
&lt;p&gt;My plan is to go over the entire bike and re-fabricate sections that would be used for radio control gear, such as servos and sensors. Along with fixing bad design decisions when it was made.&lt;/p&gt;
&lt;p&gt;There isn't much room anywhere on this bike. 
its going to be a challenge to find space to put all of this equipment.&lt;/p&gt;
&lt;h4&gt;Radio control&lt;/h4&gt;
&lt;p&gt;For radio control, i've purchased an off the shelf surface radio and receiver. &lt;/p&gt;
&lt;p&gt;i'll have enough challenges in this project as it is, i don't need to be troubleshooting radio issues as well.&lt;/p&gt;
&lt;p&gt;i've purchased a Turnigy GT6 Surface radio, which has plenty of functionality for what i need.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Turnigy GT6" src="https://blog.s3nt.net/images/quadbike/turnigy_gt6.jpg"&gt;&lt;/p&gt;
&lt;p&gt;It has 6 channels along with drifting control and ABS (i'll probably never use this but its cool anyway).&lt;/p&gt;
&lt;p&gt;Since this isn't a 1/8th scale RC car, i wont be able to use normal Servos to control this bike, its going to be a custom made solution for this bike.&lt;/p&gt;
&lt;p&gt;The intention is to use a Arduino Nano to interpret the R/C receiver's signals, then control the motors.&lt;/p&gt;
&lt;h3&gt;Steering Control&lt;/h3&gt;
&lt;p&gt;I'm going down the tried and tested method of using a windscreen wiper motor to steer the bike.&lt;/p&gt;
&lt;p&gt;&lt;img alt="wiper motor" src="https://blog.s3nt.net/images/quadbike/wiper_motor_example.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Note: example motor&lt;/p&gt;
&lt;p&gt;The benefit of these motors is that they are mated with a gearbox by default along with a powerful motor.&lt;/p&gt;
&lt;p&gt;The front of the bike has a little bull-bar, i've found that even with a compact windscreen wiper motor, i can't fit a steering mechanism in.&lt;/p&gt;
&lt;p&gt;&lt;img alt="front rebuild" src="https://blog.s3nt.net/images/quadbike/frontend01_labels.jpg"&gt;
i've fabricated a new bullbar to allow for the steering mechanism to fit while still allowing the original mudguards/fairings to be used.&lt;/p&gt;
&lt;p&gt;The red box is the original chassis that i've cut off. i'm replacing with square box section. in the image, the other side has already had the box section installed.&lt;/p&gt;
&lt;p&gt;&lt;img alt="motor dry-fit" src="https://blog.s3nt.net/images/quadbike/frontend02.jpg"&gt;
Test mounting the steering motor&lt;/p&gt;
&lt;p&gt;&lt;img alt="steering linkage ver1" src="https://blog.s3nt.net/images/quadbike/steering_linkage01.jpg"&gt;
First attempt at a steering linkage seems to work.&lt;/p&gt;
&lt;video width="600" height="600" loop autoplay muted&gt;
&lt;source src="https://blog.s3nt.net/images/quadbike/steeringv1.webm" type="video/webm"&gt;
Your browser does not support the video tag.
&lt;/video&gt;
&lt;p&gt;Demo video of the motor steering the bike.&lt;/p&gt;
&lt;h2&gt;Brake Components&lt;/h2&gt;
&lt;p&gt;Since this bike has been around for a while, i was hoping there might be spares available to replace the brake components.&lt;/p&gt;
&lt;p&gt;The brake line had a small leak, so i had to at least replace that. &lt;/p&gt;
&lt;p&gt;I visited a quadbike business that sold chinese quadbikes for kids, they told me "you'll never find spares for these bikes anywhere".&lt;/p&gt;
&lt;p&gt;I was able to convince the worker to check their parts bin just in case they had a spare brake line that would suit. 5 mins later they walked back holding the brake caliper, brake pads and a brake line.&lt;/p&gt;
&lt;p&gt;The new parts were an exact replacement and fitted the bike fine.&lt;/p&gt;
&lt;h2&gt;Suspension Bushes&lt;/h2&gt;
&lt;p&gt;The design of this bike has 3 suspension bushes. The pivot point at the middle of the bike and the 2 bushes for the shock absorber.&lt;/p&gt;
&lt;p&gt;I had previously tried to make replacement bushes using Sikaflex. 
This solution worked well however it wouldn't work for the middle pivot point since the bushing was at least 100MM long.&lt;/p&gt;
&lt;p&gt;I had some Nolathane bushes that were originally purchased for my car but i had ordered the wrong ones and they didn't fit.&lt;/p&gt;
&lt;p&gt;These bushes fit the pivot point after a little bit of trimming. I ended up replacing the diy Sikaflex bush with a Nolathane one as well. &lt;/p&gt;
&lt;h2&gt;Wheel bearing replacement&lt;/h2&gt;
&lt;p&gt;I was expecting this bike to not even have replaceable wheel bearings after my challenges with the brake components. 
Luckily, the bearings were standard size. &lt;/p&gt;
&lt;p&gt;I replaced the two for the rear driveshaft and four for the front wheels.&lt;/p&gt;
&lt;p&gt;&lt;img alt="wheel bearing" src="https://blog.s3nt.net/images/quadbike/wheel_bearing.jpg"&gt;
This is the used bearing. When i replaced them, i found that i probably didn't need to as they don't seem very worn.&lt;/p&gt;
&lt;h2&gt;Next Steps&lt;/h2&gt;
&lt;p&gt;Part 6 focuses on the electrical/programming sections of this project.&lt;/p&gt;
&lt;h2&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-06.html"&gt;Part 6 Here &lt;/a&gt;&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category></entry><entry><title>Quadbike Project (Part 04)</title><link href="https://blog.s3nt.net/quadbike-project-part-04.html" rel="alternate"></link><published>2022-06-01T00:00:00+08:00</published><updated>2022-06-01T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2022-06-01:/quadbike-project-part-04.html</id><summary type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;New Battery Upgrade&lt;/h2&gt;
&lt;p&gt;After killing the batteries previously, the bike has just been sitting around.&lt;/p&gt;
&lt;p&gt;I finally decided to purchase a replacement battery bank. Since there are significant performance issues with lead-acid batteries (weight, power characteristics) i purchased a Lithium-Ion …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;New Battery Upgrade&lt;/h2&gt;
&lt;p&gt;After killing the batteries previously, the bike has just been sitting around.&lt;/p&gt;
&lt;p&gt;I finally decided to purchase a replacement battery bank. Since there are significant performance issues with lead-acid batteries (weight, power characteristics) i purchased a Lithium-Ion battery pack.&lt;/p&gt;
&lt;p&gt;I purchased a 48V 15AH lithium pack for bikes.
&lt;img alt="new battery" src="https://blog.s3nt.net/images/quadbike/lithium_battery.jpg"&gt;&lt;/p&gt;
&lt;p&gt;The pack came with a charger too.&lt;/p&gt;
&lt;p&gt;Since the pack doesn't offer any impact protection i knew i had to protect it somehow.&lt;/p&gt;
&lt;p&gt;I decided to use an ex-military ammunition box. i found that the 30 cal box was the perfect size for this battery. &lt;/p&gt;
&lt;p&gt;The added benefit of using the ammo box is that if the battery went into thermal runaway, the box should keep most of the fire inside.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ammo box 1" src="https://blog.s3nt.net/images/quadbike/ammo_box1.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Foam pad was added to the box to help with shock absorption and to prevent movement.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ammo box 2" src="https://blog.s3nt.net/images/quadbike/ammo_box2.jpg"&gt;&lt;/p&gt;
&lt;p&gt;The battery fit quite snugly.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ammo box 3" src="https://blog.s3nt.net/images/quadbike/ammo_box3.jpg"&gt;&lt;/p&gt;
&lt;p&gt;A hole was drilled in the lid to allow for the power cables.&lt;/p&gt;
&lt;p&gt;&lt;img alt="ammo box 4" src="https://blog.s3nt.net/images/quadbike/ammo_box4.jpg"&gt;
completed battery enclosure&lt;/p&gt;
&lt;p&gt;&lt;img alt="new_battery_mount" src="https://blog.s3nt.net/images/quadbike/new_battery_mount.jpg"&gt;
Angle steel tabs were added to allow for the new battery to slide in. elastic Strap holds the battery in place.&lt;/p&gt;
&lt;p&gt;The result was an immediate performance improvement with low-speed torque and overall the bike is a lot nicer to ride.&lt;/p&gt;
&lt;h2&gt;Bike upgrades&lt;/h2&gt;
&lt;p&gt;The bike is running great, but now i want it to do more!&lt;/p&gt;
&lt;p&gt;Quadbike rebuild project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;re-fabricate motor mount.&lt;/li&gt;
&lt;li&gt;replace worn brake components.&lt;/li&gt;
&lt;li&gt;upgrade suspension bushes.&lt;/li&gt;
&lt;li&gt;replace worn wheel bearings.&lt;/li&gt;
&lt;li&gt;re-paint bike frame.&lt;/li&gt;
&lt;li&gt;repair fairings and repaint.&lt;/li&gt;
&lt;li&gt;add remote control functionality &lt;/li&gt;
&lt;li&gt;autonomous/semi-autonomous driving&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-05.html"&gt;Part 5 Here &lt;/a&gt;&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category></entry><entry><title>Adventures of Custom Solar Monitoring</title><link href="https://blog.s3nt.net/adventures-of-custom-solar-monitoring.html" rel="alternate"></link><published>2021-10-28T00:00:00+08:00</published><updated>2021-10-28T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2021-10-28:/adventures-of-custom-solar-monitoring.html</id><summary type="html">&lt;p&gt;I've been toying with small solar systems for 15 years or so. &lt;/p&gt;
&lt;p&gt;My largest system so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;800W of free solar panels&lt;/li&gt;
&lt;li&gt;1KW MPPT Solar charger&lt;/li&gt;
&lt;li&gt;400AH (used) standby batteries&lt;/li&gt;
&lt;li&gt;2.5KVA Pure-Sine Inverter&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I wanted to monitor my solar controller for solar predictions and load graphing.&lt;/p&gt;
&lt;p&gt;I purchased a …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've been toying with small solar systems for 15 years or so. &lt;/p&gt;
&lt;p&gt;My largest system so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;800W of free solar panels&lt;/li&gt;
&lt;li&gt;1KW MPPT Solar charger&lt;/li&gt;
&lt;li&gt;400AH (used) standby batteries&lt;/li&gt;
&lt;li&gt;2.5KVA Pure-Sine Inverter&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I wanted to monitor my solar controller for solar predictions and load graphing.&lt;/p&gt;
&lt;p&gt;I purchased a Epever Tracer3210AN, which is a fantastic solar controller for price and functionality.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Epever tracer 3210AN" src="https://blog.s3nt.net/images/epever-tracer3210AN.png"&gt;&lt;/p&gt;
&lt;p&gt;I purchased a combo from an eBay seller that included the 'Epever eBox-WIFI-01' WiFi unit. 
when i set all of this up and used the android app it worked great, however i wanted to capture this data and store it in influxDB with Grafana. i couldn't see an easy way to poll the WiFi module for the data.&lt;/p&gt;
&lt;p&gt;further digging around using wireshark to man-in-the-middle the communications between the app and eBox i found that it wasn't using a "web-friendly" protocol like XML or JSON. the communications were instead MODBUS over TCP (later finding that it's actually MODBUS RTU over TCP).&lt;/p&gt;
&lt;p&gt;a quick internet search i found that most people just connect the cable directly to their computer instead of messing about with the eBox.
i have no idea about modbus other than it is a reliable protocol used in industrial applications heavily.&lt;/p&gt;
&lt;p&gt;i ended up putting eBox on the shelf and buying a Epever RS485 to USB cable.&lt;/p&gt;
&lt;p&gt;&lt;img alt="USB Serial Cable" src="https://blog.s3nt.net/images/CC-USB-RS485-150U PC Communication Cable.png"&gt;&lt;/p&gt;
&lt;p&gt;i connected it up to my raspberry pi, slapped together some code to poll the solar controller based off &lt;a href="https://github.com/alexnathanson/EPSolar_Tracer"&gt;https://github.com/alexnathanson/EPSolar_Tracer&lt;/a&gt; repo.&lt;/p&gt;
&lt;p&gt;This all worked great for about a year. 
I then hit the power limitations of running the solar system in a 12v configuration (390W@12V vs 780W@24v), so i purchased more batteries and changed the system to 24V.&lt;/p&gt;
&lt;h3&gt;When it all went wrong&lt;/h3&gt;
&lt;p&gt;I had just finished the wiring to upgrade to 24V and the batteries were charging fine.&lt;/p&gt;
&lt;p&gt;i was running the Raspberry Pi off the batteries as well, tapping off one of the banks so i could still get 12v then feeding this through a car USB adaptor to get 5V for the Pi.
i checked the voltages and 5v was coming into the Pi and it booted fine. I then plugged in the USB cable for the Epever comms, suddenly i heard a *&lt;strong&gt;&lt;em&gt;pop&lt;/em&gt;&lt;/strong&gt;* and could smell burning electronics. The pi was dead.&lt;/p&gt;
&lt;p&gt;i couldn't figure out what was different (other than the obvious 12 -&amp;gt; 24V change). i had checked multiple times and the Pi power supply was still providing 5V. &lt;/p&gt;
&lt;p&gt;i tried another pi after confirming the voltages and again *&lt;strong&gt;&lt;em&gt;pop&lt;/em&gt;&lt;/strong&gt;* magic smoke from the pi and this time the controller also put out a bit of smoke (controller still worked the comm port was smelly though??).
i put down this project for a bit while i think about what had happened.&lt;/p&gt;
&lt;p&gt;i eventually figured out that the comm port ground was grounded to the 24v ground and it must have been feeding the &lt;em&gt;24v ground&lt;/em&gt; into the raspberry pi via the USB port, killing the pi(s) almost instantly.&lt;/p&gt;
&lt;p&gt;since i had broken the solar controller's Comm Port now as well, i reluctantly purchased another solar controller.
i Purchased the Epever TriRon 4210N. Which is the newer model than the 3210AN.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Epever_Triron" src="https://blog.s3nt.net/images/Epever-TiRon.png"&gt;&lt;/p&gt;
&lt;p&gt;This time i wasn't going to make the same mistake, i had to protect the comm port while also interfacing it with the raspberry pi. i looked into building a USB cable with opto-isolators but this was going to be a bigger task so i returned back to the eBox WiFi again.&lt;/p&gt;
&lt;p&gt;i plugged in the WiFi module and opened the app, all worked good. Now i needed to somehow extract the data from the eBox and get it into the (new) raspberry pi.&lt;/p&gt;
&lt;p&gt;So i opened up wireshark, got the Windows Epever software going using a 'virtual com port'. Reading the captured packets just confused me even with the wireshark "Decode As..." set to modbus.&lt;/p&gt;
&lt;p&gt;More googling and i found that the python library 'pymodbus' also supported TCP mode. 
So i updated my code to use the ''ModbusTcpClient". 
no luck, i enabled debugging and no matter what i tried i couldn't get the eBox to send data at all or if it did it was invalid.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sync&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Connection&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Modbus&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;established&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Socket&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="mf"&gt;11.11.11.3&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;46349&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Current&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;IDLE&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Running&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;SEND&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x6&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x32&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x3&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sync&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;SENDING&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Changing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;SENDING&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;WAITING&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;FOR&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;REPLY&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;failed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Modbus&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Invalid&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;No&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;received&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;least&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;received&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;framer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;socket_framer&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Processing&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Getting&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nl"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;pymodbus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Changing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;PROCESSING&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;REPLY&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;TRANSACTION_COMPLETE&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt;
&lt;span class="n"&gt;Modbus&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Input&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Output&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Modbus&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Invalid&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;No&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;received&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;least&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;received&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Above example of the errors i was getting.&lt;/p&gt;
&lt;p&gt;I found this &lt;a href="https://stackoverflow.com/questions/64549610/pymodbus-failing-to-rtu-over-tcp-due-to-adding-tcp-header"&gt;Stack Overflow&lt;/a&gt; post where OP was seeing a similar issue. &lt;/p&gt;
&lt;p&gt;In here i spotted that OP was using a ModBus Framer. Not sure exactly what it does but i suspect it filters out the TCP/IP stuff before it's used by the client object.&lt;/p&gt;
&lt;p&gt;I made 2 changes to my script and retried, this time it worked!!!&lt;/p&gt;
&lt;p&gt;Here's what my script looked like before the Framer changes:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/usr/bin/python3&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pymodbus.client.sync&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ModbusTcpClient&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ModbusClient&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ModbusClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;11.11.11.254&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8088&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_input_registers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x3100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;solarVoltage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;solarCurrent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;solarPowerL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;solarPowerH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;batteryVoltage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chargeCurrent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chargePowerL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chargePowerH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;loadVoltage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;loadCurrent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;loadPower&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;batteryPercentage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Do something with the data&lt;/span&gt;

&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PV Voltage: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;solarVoltage&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PV Current&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;solarCurrent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Battery Voltage: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;batteryVoltage&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Charge Current: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chargeCurrent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Load Current&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;loadCurrent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Load Power: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;loadPower&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And after the addition of the Framer:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/usr/bin/python3&lt;/span&gt;

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pymodbus.client.sync&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ModbusTcpClient&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ModbusClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pymodbus.transaction&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ModbusRtuFramer&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ModbusFramer&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ModbusClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;11.11.11.254&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8088&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;framer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;ModbusFramer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_input_registers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0x3100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;unit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;solarVoltage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;solarCurrent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;solarPowerL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;solarPowerH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;batteryVoltage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chargeCurrent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chargePowerL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chargePowerH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;loadVoltage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;loadCurrent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;loadPower&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;batteryPercentage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;registers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Do something with the data&lt;/span&gt;

&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PV Voltage: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;solarVoltage&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;PV Current&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;solarCurrent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Battery Voltage: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;batteryVoltage&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Charge Current: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chargeCurrent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Load Current&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;loadCurrent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Load Power: &amp;quot;&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;loadPower&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Adding the Framer to the ModbusClient was what fixed it for me.&lt;/p&gt;
&lt;p&gt;here's the output:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;PV Voltage: 77.95
PV Current: 1.05
Battery Voltage: 27.52
Charge Current: 2.98
Load Current: 0.16
Load Power: 0.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The solar data is now being sent to my local InfluxDB and Grafana instance. &lt;/p&gt;
&lt;p&gt;&lt;img alt="Graphana_screenshot" src="https://blog.s3nt.net/images/Graphana.png"&gt;&lt;/p&gt;
&lt;h3&gt;In Summary&lt;/h3&gt;
&lt;p&gt;I recommend using the USB cable to poll the controller in most cases.
If you're doing something like me where you're trying to get 12V from a 24V battery bank, either purchase the proper "24 to 12 converter" or make sure the 12V devices do not electrically interact with any 24V devices or you may kill the 12V device.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Running a 12V fridge directly off the 12V side of the 24V bank would be fine, if the fridge then connects to another device like a 24V powered fridge controller or something is where the danger arises.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Be aware that tapping 12V from one side of the 24V bank is going to cause an imbalance and probably shorten the life of the batteries. In my case, these are used batteries, so i don't care too much.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</content><category term="Projects"></category><category term="solar"></category><category term="troubleshooting"></category></entry><entry><title>Quadbike Project (Part 03)</title><link href="https://blog.s3nt.net/quadbike-project-part-03.html" rel="alternate"></link><published>2021-02-07T00:00:00+08:00</published><updated>2021-02-07T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2021-02-07:/quadbike-project-part-03.html</id><summary type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;How does it drive?&lt;/h2&gt;
&lt;p&gt;I've been riding the quadbike around for around 6 months now. Just cruising around.&lt;/p&gt;
&lt;p&gt;it runs pretty good, it can get uncomfortably fast on the straight. &lt;/p&gt;
&lt;p&gt;At top speed (&amp;gt;50KM/h) the steering gets very unstable and the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;How does it drive?&lt;/h2&gt;
&lt;p&gt;I've been riding the quadbike around for around 6 months now. Just cruising around.&lt;/p&gt;
&lt;p&gt;it runs pretty good, it can get uncomfortably fast on the straight. &lt;/p&gt;
&lt;p&gt;At top speed (&amp;gt;50KM/h) the steering gets very unstable and the death wobbles start. I've rolled it a few times, thankfully its a small bike so only a few scratches.&lt;/p&gt;
&lt;p&gt;I've found that the low speed torque is non-existent, the bike can't really climb hills without getting a run up. i've looked around and cant seem to find an easy way to reduce the gear ratio any further. I'll probably need a metal lathe :-(&lt;/p&gt;
&lt;h2&gt;Dead Batteries&lt;/h2&gt;
&lt;p&gt;I've accidentally left the bike turned on for what must have been a month without noticing.
all four of the lead-acid batteries are dead, showing around 2V when tested with a meter.&lt;/p&gt;
&lt;p&gt;I'm pretty annoyed as these batteries haven't even been used for that long.&lt;/p&gt;
&lt;p&gt;Not sure what the next steps are.&lt;/p&gt;
&lt;h2&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-04.html"&gt;Part 4 Here &lt;/a&gt;&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category></entry><entry><title>Quadbike Project (Part 02)</title><link href="https://blog.s3nt.net/quadbike-project-part-02.html" rel="alternate"></link><published>2020-08-13T00:00:00+08:00</published><updated>2020-08-13T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2020-08-13:/quadbike-project-part-02.html</id><summary type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Oh no, A plastic burning smell?&lt;/h2&gt;
&lt;p&gt;Well the relay configuration worked a little too well i guess?&lt;/p&gt;
&lt;p&gt;&lt;img alt="burned contacts" src="https://blog.s3nt.net/images/quadbike/burnt_relay.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I suspect this issue arose due to two things, using relays that aren't rated for this amount of power and using lead acid batteries.&lt;/p&gt;
&lt;p&gt;lead acid batteries …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Links to other parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-01.html"&gt;Part 1 &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Oh no, A plastic burning smell?&lt;/h2&gt;
&lt;p&gt;Well the relay configuration worked a little too well i guess?&lt;/p&gt;
&lt;p&gt;&lt;img alt="burned contacts" src="https://blog.s3nt.net/images/quadbike/burnt_relay.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I suspect this issue arose due to two things, using relays that aren't rated for this amount of power and using lead acid batteries.&lt;/p&gt;
&lt;p&gt;lead acid batteries tend to drop in voltage quickly when under load. a voltage drop would increase the current and melt the relay contacts. &lt;/p&gt;
&lt;p&gt;I ended up removing the relays all together and instead just wiring the bank for 48V. 
I reluctantly bought a cheap 48v lead acid bike charger as well.&lt;/p&gt;
&lt;h2&gt;Quadbike throttle conversion&lt;/h2&gt;
&lt;p&gt;Until now i'd been using the go-kart pedal that came with the motor kit. Next step was to find a way to use the original 'Thumb Throttle'  that the quad originally used.&lt;/p&gt;
&lt;p&gt;The original throttle is just the normal wire pull type.&lt;/p&gt;
&lt;p&gt;&lt;img alt="pedal from kit" src="https://blog.s3nt.net/images/quadbike/pedal.jpg"&gt;
pedal that's included in the kit.&lt;/p&gt;
&lt;p&gt;Internally, there's a spring that returns the pedal to idle position. i removed it, cut down the pedal and put a stiffer spring on the outside.&lt;/p&gt;
&lt;p&gt;&lt;img alt="added spring" src="https://blog.s3nt.net/images/quadbike/pedal_spring.jpg"&gt;&lt;/p&gt;
&lt;p&gt;while pulling this housing apart, i discovered that the motor controller uses a hall-effect sensor with two magnets opposing each other.&lt;/p&gt;
&lt;p&gt;&lt;img alt="internal throttle" src="https://blog.s3nt.net/images/quadbike/pedal_housing.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I drilled holes through the housing, added a random nut to hold the throttle cable in place. &lt;/p&gt;
&lt;p&gt;&lt;img alt="throttle conversion" src="https://blog.s3nt.net/images/quadbike/throttle_wire_conversion.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Eh, it does the job.  &lt;/p&gt;
&lt;video width="500" height="300" loop autoplay muted&gt;
&lt;source src="https://blog.s3nt.net/images/quadbike/throttle.webm" type="video/webm"&gt;
Your browser does not support the video tag.
&lt;/video&gt;

&lt;p&gt;Now it can be ridden without having to hold the pedal in your hand.&lt;/p&gt;
&lt;h2&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-03.html"&gt;Part 3 Here &lt;/a&gt;&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category></entry><entry><title>Quadbike Project (Part 01)</title><link href="https://blog.s3nt.net/quadbike-project-part-01.html" rel="alternate"></link><published>2020-01-20T00:00:00+08:00</published><updated>2020-01-20T00:00:00+08:00</updated><author><name>Rob</name></author><id>tag:blog.s3nt.net,2020-01-20:/quadbike-project-part-01.html</id><summary type="html">&lt;p&gt;I've wanted to build an electric vehicle for a long time, due to cost of components i have put it off.&lt;/p&gt;
&lt;p&gt;Recently i found a facebook marketplace ad for a children's 50CC quadbike for $150.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Kazuma as new" src="https://blog.s3nt.net/images/quadbike/Kazuma_Meerkat.jpeg"&gt;&lt;/p&gt;
&lt;p&gt;The seller advertised that it was only missing a fuel tank and is running. As …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've wanted to build an electric vehicle for a long time, due to cost of components i have put it off.&lt;/p&gt;
&lt;p&gt;Recently i found a facebook marketplace ad for a children's 50CC quadbike for $150.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Kazuma as new" src="https://blog.s3nt.net/images/quadbike/Kazuma_Meerkat.jpeg"&gt;&lt;/p&gt;
&lt;p&gt;The seller advertised that it was only missing a fuel tank and is running. As with all online marketplaces, this was not exactly the truth.&lt;/p&gt;
&lt;p&gt;From what i could tell, someone with no technical skill but with plenty of confidence, attempted to get the quadbike running by cutting and joining wires while blindfolded.&lt;/p&gt;
&lt;p&gt;There was no way this was going to run without a whole lot of work. I low-balled the seller $90 and took it home.&lt;/p&gt;
&lt;p&gt;&lt;img alt="bike stripped" src="https://blog.s3nt.net/images/quadbike/stripped_frame.jpg"&gt;
stripped down to bare chassis.&lt;/p&gt;
&lt;h2&gt;Converting to electric&lt;/h2&gt;
&lt;p&gt;The initial plan was to try and do this project as cheap as i could. I started with a Ebay 1800W Brush-less motor kit and some lead acid batteries.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Battery Holder" src="https://blog.s3nt.net/images/quadbike/battery_mount.jpg"&gt;
Fabricated battery mount&lt;/p&gt;
&lt;p&gt;&lt;img alt="Battery dry fit" src="https://blog.s3nt.net/images/quadbike/Batt_dry_fit.jpg"&gt;
Dry Fit of Batteries&lt;/p&gt;
&lt;p&gt;I was able to clear the frame when testing the suspension movement!&lt;/p&gt;
&lt;p&gt;&lt;img alt="Motor Sprocket original" src="https://blog.s3nt.net/images/quadbike/motor_sprocket.jpg"&gt;
I attempted to use the original sprocket that the petrol motor used. This didn't turn out as there wasn't enough torque with this gearing ratio.&lt;/p&gt;
&lt;p&gt;I ended up buying a electric bike sprocket and chain kit that had a far better ratio.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Motor Sprocket new" src="https://blog.s3nt.net/images/quadbike/new_motor_sprocket.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I had to drill new holes in the larger sprocket to align with the bike's driveshaft. Centering this sprocket turned out to be very hard, i wish i owned a metal lathe :-(&lt;/p&gt;
&lt;h3&gt;Charging 48v batteries with a 12 charger?&lt;/h3&gt;
&lt;p&gt;Since it was a 48V motor kit, i had this idea to use 4 relays to break up the 48V battery pack into 4 x 12V batteries in parallel for charging, saving me the need for an expensive 48V charger.&lt;/p&gt;
&lt;p&gt;gif of the relay circuit, Note that i used DPDT (Double Pole Double Throw) relays which halved the number of relays to 4. DPDT relays aren't supported in &lt;a href="https://falstad.com/circuit/"&gt;falstad circuit simulator&lt;/a&gt; so its a mess of wires to get the same functionality.&lt;/p&gt;
&lt;video width="600" height="600" loop autoplay muted&gt;
&lt;source src="https://blog.s3nt.net/images/quadbike/1248v_demo.webm" type="video/webm"&gt;
Your browser does not support the video tag.
&lt;/video&gt;

&lt;p&gt;This circuit worked as designed. i was able to charge these batteries with a normal 12v car charger.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Working Relay Configuration" src="https://blog.s3nt.net/images/quadbike/relay_configuration.jpg"&gt;
As mentioned earlier these relays have multiple poles so i only need 4 (instead of 8).&lt;/p&gt;
&lt;p&gt;&lt;img alt="Test run" src="https://blog.s3nt.net/images/quadbike/Test_drive.jpg"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Test run seat" src="https://blog.s3nt.net/images/quadbike/test_drive_seat.jpg"&gt;
Went out for a drive and it works great!!&lt;/p&gt;
&lt;h2&gt;&lt;a href="https://blog.s3nt.net/quadbike-project-part-02.html"&gt;Part 2 Here&lt;/a&gt;&lt;/h2&gt;</content><category term="Projects"></category><category term="quadbike"></category><category term="engineering"></category><category term="electric"></category></entry></feed>