I recently put together what is basically a small UPS. It’s simple, made up of three diodes and some resistors, and lets you trickle charge a battery while power something and then seamlessly switch to the battery if the power source goes out.
This was actually built just for charging a small lithium iron phosphate (LiFEPO4) battery from a car cigarette lighter plug while power something, but it could be used for a lot of things. Here’s the schematic:
Basically, current can flow from the input to the output (Vin to Vo) through D1, or from the battery to the output through D2. If power is present, the battery can be charged through D3 and R1 – R1 sets the current, based on the voltage difference between the source and the battery, and the forward drop in D3.
This type of circuit is great because it’s simple, and it accomplishes a lot of what you’d like: it lets a source power something and trickle charge a battery, and switches the load to the battery if the source drops. It’s passive, and should just work. On the other hand, the battery is being passively charged, and it kind of relies on the voltage of the source to regulate it. There’s also the diode drops, which for a Schottky diode is around 0.4 V. For a normal silicon diode, it would be higher, around 0.7 V.
You could improve this with an ideal diode circuit, where you could basically control a MOSFET in place of each diode to turn on and off when the diode would. This is more complex, but you almost eliminate the diode drop. If you needed something like this to handle more than a few amps, that’s probably not a bad idea.
Another option, and probably the ideal one, is to use a power converter, at least to charge the battery. A non-inverting buck-boost converter would do this, and allow you to control the charging current regardless of the voltage of the source and B1. You could have it do a proper charge of the battery, bulk/absorb/float for lead acid, or bulk/absorb for LiFEPO4 (or whatever scheme that battery chemistry calls for). A fancier converter (or converters) might supply a constant voltage to the load at the same time.
Still, for something small, the simplicity here is nice. It could work well for something like holding up a Raspberry Pi or other single board computer, for instance. One thing to note is that most diodes in a TO-220 or TO-240 or similar case often are not electrically isolated. You can get a heat sink with an electrically insulating thermal pad; I have one I garbage picked a while back.
Here is what the circuit looks like, assembled:
I put it in a heat sink and attached some leads with Anderson Powerpole connectors, like the following:
Note that I did alter the resistors to get a little more charging current. The pictures show two 2.2 ohm resistors in parallel (for 1.1 ohms), but I added two 0.9 ohm resistors in parallel as well, for about 0.32 ohms total. The diodes have about a 0.6 V drop under load, so from my car I was able to get around 1.75 amps into a LiFEPO4 battery, while the car is running. This will vary a little, and keep in mind that if your battery is at a lower state of charge you’ll get more current initially.
For whatever reason, I’ve been wanting to try an alternate way of composing this blog. Now, I’m not a frequent blogger, as you can see. I’ve daydreamed of putting more content at this site, but I tend to be slow at getting around to it. I’m not sure if switching to a different platform would make me write more, but there is peace of mind involved.
WordPress is actually pretty nice. It does a lot of things, and is pretty much a content management system (CMS), as opposed to just a blog platform. It’s probably a great choice if you need to throw something up like a personal or professional blog, website for your business, or whatever. Especially if you have something where a bunch of people will be logging in and creating content.
I continue to use it because it makes things like formatting, as well as managing and uploading images easy. That, and it’s easy to throw a new theme on the site. While those are pluses, it also does so much, and requires PHP and MariaDB (MySQL). These are pretty standard if you’re just looking for someplace to host your blog, but for a self-hoster such as myself, simplifying things is attractive.
Static site generators have become popular these days – you compose your content with a text editor using Markdown, and the generator uses a template to generate your site as a bunch of HTML files. Then you just stick them on your server by whatever means, eg rsync. I’ve looked at these, and have been toying with writing my own. My reasoning is that I would have to switch from WordPress, and while a lot of what’s available would probably work great, I might as well take this as an opportunity to give it a try. It might be fun or something.
In reality, this is at the bottom of a list of projects, but I daydream now and then. WordPress is a complex beast, but it’s easy to install and keep going, and that makes a big difference.
Actually, I have been playing with WriteFreely as well, and have set up a secondary blog with it here. It’s a single Go executable, and I wanted to mess with it because you can follow it from the Fediverse. I’m not sure this will completely replace my blogging here, but it’s something I’m trying out.
As if I needed another project, I had been tossing something around lately regarding renewable energy and the web. Low Tech Magazine, which showcases what it considers old and forgotten technology, has an edition of their website available served from a Raspberry Pi run entirely off-grid. Their setup consists of a Pi powered from a solar-charged battery, and they make it a point that depending on weather, that site may not actually be available at all.
I think that this is an interesting concept, although I’ve been tossing around the idea of taking this further. Rather than try to keep a small web server running all the time completely on solar power, what about running it only when the sun is out? In other words, whenever enough sun hits a panel to produce enough power to keep a Raspberry Pi going (about 3 watts, say). With a large panel, this means it could stay up even when it’s cloudy.
I’ve been playing with off-grid solar for years in a hobbyist capacity, and first wondered about this when seeing the green ‘charging’ light on my charge controller turn on even on a clear night with a bright moon. That is, with enough panelage, can a useful amount of power be extracted even in low light? And what ways are there to utilize solar power without trying to store it?
The system, in my mind, would be relatively simple: A photovoltaic panel, one meant for charging a 12 volt battery, would feed a Raspberry Pi via a buck converter. When there’s enough sun to keep the Pi running, it runs. When there isn’t, it shuts down. The converter would help to match the panel’s output to the Pi, supplying it with a constant 5 VDC. With a large enough panel (>20 watts?), it should be able to put out the required 3 or so watts over a range of weather conditions.
I’m wondering about some other bells and whistles, like somehow predicting when night is about to fall, and gracefully shutting down the Pi. And monitoring voltage and current as well. I may take this as an opportunity to design my own buck with some of this built in, but I think an off-the-shelf converter would work as well.
Anyways, I’m not sure when I’ll get to this, but it’s just a thought. I’m not sure how useful it will be, but it could be kind of fun.
I wish I had some progress to post about, but I will take a few moments to just talk about some scraps of things.
I’m seriously considering moving this blog to a static site, and have been looking at Hugo. I like the idea of composing posts in a text editor, and then regenerating the site when neede
d. I would probably integrate this blog (or a blog like thing) with the front page, ie have a similar layout, style, etc., and maybe add more static-type pages. I might even stop using the wiki, which was kind of my first thought of how this would go: Blog for routine or semi routine updates, wiki for more ‘permanent’ stuff, like how-to guides. I may just keep the wiki around.
I had considered writing my own static site generator, probably throwing something together in Perl. I’m not sure it’s worth doing that. One of the drivers for this was an idea I had about a system to accept comments via email, which I could integrate with my own static site generator. I may just look at doing something with Hugo for that, we’ll see.
This blog does get a decent amount of comments, but most (practically all) of them are spam. I could probably just not bother with it at all, but in the days of my whatsmykarma.com site, some legit comments actually would trickle through. I’ll have to see. I’m going to have to play with Hugo quite a bit, then look at migrating away from WordPress.
I’ve had some electrical projects in mind for a while, the first of which is a buck converter, which I’ve posted about before. One of the parts I was using (a MOSFET) doesn’t seem to be available, so I’ll probably just pick a new one. At this point I need to work on the layout, so I’ll have some KiCad work ahead. That should be fun.
The point of that is to not just design the buck converter, but also do the controls. And layout… And conceive of it as a ‘product,’ not just a circuit I put together. In other words, a box with terminals that will have usefulness.
This leads me to my other project, significantly more of which remains in my imagination right now. And that is an inverter/charger – a power inverter that can also rectify, acting as a battery charger. Kind of like a UPS, but not exactly uninterruptible. I mean, it should be, ideally, but the intent is more for seamlessly switching AC loads to another source and charging a battery, as opposed to keeping computers from going down. Think off-grid power system verses data center application. (Of course, there’s overlap in terms of the technology and applications.)
The first incarnation of this would go from 12 VDC (nominal) to 120 VRMS AC, sine wave output, at about 250 watts. There are a couple reasons for this project:
Learning, getting some experience
Usefulness, no one really makes a small inverter/charger like this, and I’ve thought it would come in handy
Progress, toward an even bigger one
Putting a design out there, there should be more practical examples of power conversion available. Maybe even an open source inverter project?
Today is the first day of spring here in the Northern Hemisphere, and it’s quite sunny out. I have about 164 watts of solar between three panels, just sitting on my deck. They are charging an old (~12 years) 49 Ah AGM battery in my garage, which still holds something of a charge but not quite what it used to.
Where I live, electricity is pretty cheap and reliable (municipal coop), and it’s bought from hydro and nuclear generation. This system has evolved over time, and it’s mostly a hobby. However, I wonder about making better use of the power I get from it.
The obvious answer is to try to grid tie these (or other) panels. That would require an appropriate inverter, plus professional installation, approval, etc. It makes sense in a lot of ways, since that way the panels get to run my entire house by virtue of tying into the main breaker panel. Not to mention that these are mismatched, and I’d need to find an inverter that could handle a conglomeration of 12 volt panels (the big one can actually be rewired for 24 volts). I’d rather not use one of the PowerJack inverters, although admittedly I haven’t looked at other grid tie inverters besides from seeing those on Youtube here and there.
I’d like to keep this system off-grid – like I said, my power is cheap, and I’m not sure a big grid-tied array would make sense just from that standpoint. But honestly, I love messing with a small independent system, and it has a few advantages:
Obviously, it’s a source of backup power, and it’s pretty convenient for lighting and phone charging. Power outages aren’t frequent enough that I’m thinking about getting a generator to keep the fridge going, but just having a little bit of reserve is nice.
It’s a source of DC power. I have an amateur radio license, and most ham gear runs from 12 VDC. This is a little tricky since the system is in the garage, but I will get to this.
It’s a way to experiment with… Off-grid systems! Other projects I’ve had kicking around in the back of my head for years directly apply here, and so it makes sense to have an actual application for them. Examples include various DC-DC converter ideas, as well as a DC-AC inverter.
I’ve been thinking about how to upgrade this system. Like I said the battery is old, but it works well enough as a buffer that it’s not completely useless. The charge controller I have is a Morningstar ProStar 30, which is PWM. I could enter the 21st century and get an MPPT controller, and squeeze out an extra amp or so into the battery. I did get a 300 watt true sine wave inverter (the modified sine wave one I had was the victim of a flood), which is nice, but this will eventually be replaced by a homebrew solution.
Of course, this is a lead acid battery, and I’ve also been looking at LiFePO4 as well. This technology is intriguing, given that while it’s more expensive up front it lasts longer in terms of deep cycles. (Lead acid, even deep cycle, lasts longer with shallower cycles.) That said, while I haven’t done an in-depth analysis, it seems that if you’re going to lead a battery float most of the time like in a UPS, lead acid might still be the way to go cost-wise. This of course depends on the quality of the charger, for instance I wouldn’t trust a cheap UPS unit to be a shining example of lead acid charging.
All this aside, something I’ve thought of quite a bit is the idea of siphoning excess power off to do something useful. If I’m not going to grid tie, then I need to get a little creative. The idea is to minimize actual cycling, so ideally the load here would be something that could be served during the day when there’s sun.
I should take a moment to note that wiring your home for low voltage DC isn’t always the greatest idea. It sounds great when you think of devices running from 12 or 5 VDC anyways, by means of a wall cube or a brick, and that you could avoid using an inverter to do an extra conversion step. (Kind of two steps, when you realize that with a low voltage system, the inverter needs to step battery voltage up to a high enough DC voltage to make the 120 VRMS sine wave, or whatever it would be in your area.)
Contrary to what some think, AC doesn’t inherently travel over long distances better. In fact, it incurs reactive losses, since by nature the voltage and current are changing. But sending a lot of power over long distances does require high voltage, since that means less current for a given amount of power. AC makes this easy by means of a transformer, basically wire wrapped around an iron core. Pretty simple, for certain values of simple.
Thanks to modern power electronics, you can of course step DC up and down too. In fact, a lot of household devices do this, and rectify DC and use a switching power supply to get a lower voltage. It will probably still end up using a transformer and pulse the DC into it, but you can do that at a high frequency which means that the magnetics can be smaller. A transformer for, say, 20 kHz can be smaller than one for 60 Hz. However, this all requires more supporting circuitry – power transistors to do the switching, capacitors, inductors, and transformers, some kind of controller, etc. High voltage DC is used for transmission, since you can avoid reactive losses, but having to address some of this means that it’s used where the expenses of the transmission line would outweigh the cost of the added rectifier/inverter station.
There’s another issue as well. The reactive losses I mentioned essentially resist changes to the flow of current, which obviously is an impediment to AC. But with DC, it’s a different kind of impediment. While they will resist the current ramping up, they can also resist ramping it down. If you have a fault of some sort, the inductance in a wire will try to keep the current flowing. It does this by jacking the voltage up.
This is something you exploit in, say, a buck or boost converter, where you switch a power source into an inductor. The inductor raises or lowers the voltage using the energy it stores in its magnetic field. However, while an inductor is a part you might design into a circuit, a length of wire is also an inductor. If you want to stop current from flowing in a DC circuit, you need to respect that.
Practically, this means that you need DC-rated switches, connectors, and overcurrent protection. This exists, but it’s not as common as what you can get at say Home Depot. (Actually, Square D QO breakers do have a DC rating, I believe. Double check this.) And if you’re using, say, 12 or 24 VDC, you need bigger wire – at 12 volts, for instance, a 100 watt load is about 8.3 A. This means you need to make sure you have solid connections, as pushing high current through a bad connection can cause it to heat up. And then unless you use huge wire, you have to deal with voltage drop.
Of course, high(er) voltage DC is one possibility. Off-grid solar systems typically go up to 48 VDC nominal, which is easier to deal with. You could keep throwing 12 volt batteries in series and end up with 120 VDC, but that kind of compounds the problems I mentioned earlier – now you have a high voltage which can push even more current through a given resistance, so you have that plus the effect of the wiring inductance in the event of a fault. 120 VDC is used in some applications, and it’s not as if it’s impossible to work with, but I wouldn’t just plug my home wiring into it unmodified.
Where to Use DC
Maybe you’re willing to take on the engineering project of wiring a house for DC, low or high voltage, and spend the money on huge wire and appropriately-rated devices. Most likely, though, using standard off-the-shelf parts and readily-available expertise for AC wiring is the way to go. That said, it’s worth considering using DC in certain cases, in my opinion.
A tiny system, maybe a portable one, where you want to run a couple lights and charge your phone. This might be something that fits into a backpack. Maybe it’s just a battery and a cable with a plug of some sort.
Something like a small cabin, with a short wire run to the loads. Maybe the battery is close to say a water pump, a light fixture, etc.
A system which isn’t too far from loads, but most everything just runs on DC anyways. (I’ll get into this one more soon.) An example is a ham radio setup, although this could be debatable. It might make sense to simply use an inverter and have that drive a benchtop supply to run your shack.
A DC light fixture for the room where the rest of your system is. That way if your inverter goes down, you can troubleshoot it.
The third point is something I’ve thought about – my system is in my garage, but I have ham radio gear in the second floor of my house. Additionally, I have networking gear in the basement, much of which could run off of 12 VDC. So while I wouldn’t want to rewire my house to swap too many circuits to 12 volts, how could I bring some power from place to place, and selectively siphon off excess from the solar?
Low-Power DC Transmission
So now I’m going to go against my own advice, and try to move DC to a different area of my house. 🙂 To do this, I’ve been kicking around a DC-DC converter, really a buck converter, that would work bidirectionally. That’s for flexibility, so that I can use the same one in two places.
So it might go like this: Step 12 VDC from my battery in the garage to say 36 VDC, and then run that into my basement. Use another converter in reverse to bring it back down to 12 VDC. That means a three-fold reduction in current. It also means needing to use proper fusing, of course. But it would also be non-permanent and easily undoable.
Actually, the main reason for this is to design and build the converter, to prop my own skills. There’s designing it, laying it out on a PCB, and doing the controls for it (microcontroller project!). And I’m interested in the idea of controlling this to, for instance, run in parallel with a standard power brick supplying an industrial PC I’m using as a server, and basically take load off the grid. So it’s kind of like a grid-tie inverter, without the grid-tie.
Obviously, this may not be the most practical thing for most people, I just happen to be the type of weirdo who thinks it might be fun. I will post more as I explore it.
George is an indoor creature, but he used to be a stray. Now that it’s sunny he has spring fever, and he’s tried to escape once or twice. I won’t let him, and he usually does okay staying inside, but I do pick him up now and then and walk him around outside. I also leave the door open to the screen so he can sit and listen to the birds and sniff.
I don’t need to tell you all that it’s been a hell of a year this past year. All I will say is that I’ve had projects that I’ve meant to document, and other content that I’ve wanted to generate for this site, that I’ve been putting off for one reason or another. At leas spammers have found this place, so it’s not completely lonely.
I set this up with a fresh new WordPress blog, since that’s what I’ve used in the past. WordPress is nice, but it’s a little clunky for a single person blogging. It does make some thing easier for someone who’s not primarily a web developer such as myself, but I’ve considered leaving it for something else.
Static site generators have been kind of interesting to me, since the server just grabbing and sending a bunch of static files has a nice simplicity to it. I can compose in just about any text editor too, which is neat, and while WordPress’s editor is very capable, it’s kind of clunky. In fact, it’s kind of laggy to type in. For the most part, typing in a text editor would probably be more pleasant. But, it’s something to look into, and decide what to use, how to lay the site out, etc.
That said, WordPress itself is powerful, and a great choice for a lot of things. For someone who doesn’t want to mess with setting a site up in too much depth it can be a good move.
I’ve been slowly chipping away at a project to build a buck DC-DC converter, to step between common lead acid battery voltages (12, 24, 36 VDC). Mainly, the goal is just to do it – to gain experience with designing it, laying out the PCB, writing firmware (controlling with a microcontroller!), etc. But I intend to make it part of something bigger.
I had in mind using this converter (and clones of it, when I get it working) to kind of create a DC microgrid – stepping voltage up from one battery, and moving it to a different part of my house to power things or charge another battery. In fact, battery-to-battery charging kind of set this off: In a power failure, I could leave one in my car, step 12 VDC to 36 VDC for a longer wire run, and then back down to 12 VDC in my garage… But with logic to charge a 12 V battery.
Of course, you have to be careful about leaving the car on/draining the battery, and it’s probably not the most efficient use of a car, but for the rare occasion when the power goes out and there’s not enough sun for solar, and I’m running low on power, I think it has merit.
Beyond that, I’d like to explore using this as a sort of maximum power point tracking (MPPT) controller, either from solar panels into a battery, or solar directly into the microgrid. Off-grid solar with no (or with a minimal) battery is kind of an interesting idea to me, and with the right controls it may have potential.
This is a related, but distinct project from the above: a power inverter, to converter 12 VDC (at first) to 120 VAC, with a sine wave output. Not only that, but to go the other way, and rectify it as well to act as a battery charger. This is something I’ve wanted to do for a while, but have mostly just been thinking about aside from the occasional simulation.
Chick Corea passed away this passed week. I don’t write about music much online, but I am a musician, and am a big fan of his. I’ve seen him live several times, in different configurations, and while up there in age I always imagined he still had years left in him. He will be missed, but his music isn’t going anywhere.
I recently decided to try Linux Mint 19.3 (Cinnamon) on an old Lenovo laptop, a G530 I’ve writtenabout previously. The install went smoothly, but upon completion, it turned out that I had no network access whatsoever – neither wired nor wireless. The wireless is a Broadcom chip, so I kind of expected that. But the wired should have been supported.
Here’s the output of lspci | grep -i net:
04:00.0 Network controller: Broadcom Inc. and subsidiaries BCM4312 802.11b/g LP-PHY (rev 01)
07:00.0 Ethernet controller: Broadcom Inc. and subsidiaries NetLink BCM5906M Fast Ethernet PCI Express (rev 02)
Even with a wired connection plugged in, it would not show up in the NetworkManger window. I even tried creating a new connection, but this did not help. After running ifconfig, I found that the interface was in fact picked up. I was actually able to bring it up like this:
sudo dhclient enp7s0
In the above, enp7s0 is just my wired interface. Running ifconfig again I could see that it now had an IP, and I was able to ping other hosts, run updates, and even use the Driver Manager to install drivers for the wireless card, which promptly started working. For whatever reason, NetworkManager was not configuring the wired connection.
It turns out that during install, this interface was added to /etc/network/interfaces, which makes NetworkManager ignore it. All I had to do was modify this file as follows:
# interfaces(5) file used by ifup(8) and ifdown(8)
iface lo inet loopback
# These next two lines refer to the wired network card. They
# should be commented out.
#iface enp7s0 inet manual
Then, I was able to run sudo systemctl restart NetworkManager and the connection started showing up in the system tray.
This is a little annoying, and I would think it’s something that could have been picked up during install, but at least it’s easy enough to fix. This is my first real experience working with Mint, and overall it seems very polished, this issue aside.
This is my second (I think) serious attempt at a blog. Prior to this site I used whatsmykarma.com, a domain I registered way back in high school after taking a world religions course. I hate to say that my motivation for choosing that may have been little more than my own amusement, but I held onto the domain and used it for years, with various attempts at a personal site.
At some point I discovered WordPress, and shifted toward that and away from static HTML pages. My approach to the site was that in working on things – projects, or just fixing things, or whatever – I come across different nuggets of knowledge that are good to save. So, unless there’s some pressing reason not to, why not share them? That’s still my goal here. And while I will take another stab at maintaining a blog, I’ve also set up a wiki. I think it represents a good compromise between the automation of a content management system and a free-form cluster of web pages. At least, we shall see. I envision certain subjects having both a blog post and a wiki page. Maybe several of each.
So what can you expect? I’m not sure exactly, but a few things come to mind:
Various computer projects. As you might guess from the domain name, I have dealt with an assortment of Linux- and Unix-related projects, which I may document here.
Various electronics project. Despite the first point, I actually work as an electrical engineer, with a focus on power electronics. I have different projects in the works, things I would have loved to peruse when I was in school and just younger and curious about this field.
Anything helpful I come across. If I solve some problem, I may very well post about it here, either to remind myself and/or in the hopes that it helps someone else.
Musings. The internet is full of opinions on countless things, and I don’t know if there’s really a hole I need to be filling here. I like to avoid politics and religion. I can’t guarantee I’ll never post about those subjects here, but who knows.