A project to update BattMan II with a Raspberry Pi.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
gerbertop.pngRender of final PCB topPortable Network Graphics (PNG) - 101.12 kB - 02/22/2017 at 03:57 |
|
|
gerberbottom.pngRender of final PCB bottomPortable Network Graphics (PNG) - 66.73 kB - 02/22/2017 at 03:57 |
|
|
battmanpi-F_Cu.pdfPCB draftAdobe Portable Document Format - 40.68 kB - 01/08/2017 at 10:36 |
|
|
battmanpi-B_Cu.pdfPCB draftAdobe Portable Document Format - 69.64 kB - 01/08/2017 at 10:36 |
|
|
battmanpi-F_SilkS.pdfPCB draftAdobe Portable Document Format - 28.21 kB - 01/08/2017 at 10:36 |
|
|
The heatsink I attached for testing was a bit cumbersome, and was supported by the leads of the TO-220 transistor package and a bit of Blu-Tak.
To make things a little more sturdy I made a bracket from 3 mm thick aluminium angle. This will attach to the PCB mounting holes using M2.5 screws. On the back of the bracket I will attach three small heatsinks to increase the mass and surface area. On the front the transistor will be attached with a standard isolating kit. The fan will be attached with screws through the vanes of the small heatsinks. I drew a sketch on some scrap paper then I decided to make a nice drawing with QCad.
Everything seems to be working! I have to get a more accurate multimeter to check my calibration, but the hardware and software appear to work together after squashing only a couple of minor bugs.
I don't have all the facilities I need yet, but I have started assembling a PCB for testing. I'll assemble a section of the circuit and do some basic tests before assembling the next one. First I'll test the 5V supply, then the relays, then the current drive and finally the DAC.
I used hackvana.com to manufacture my PCB design and they arrived yesterday. Excellent service, good price, and very quick. I am travelling right now, so I haven't seen the boards (and I can't assemble one) but I am sure they'll be fine.
I added a rendered image of the final PCB. It is ready to send to dirtypcbs.com for manufacturing. I tweaked things a bit to remove three vias, and thicken some ground traces (most of them are attached to the GND flood fill, so there's plenty of copper there).
I won't choose expedited shipping as I will be travelling and can't do anything with them for a while.
I've had the "final" layout for this project ready for a while. I've been fiddling with it so that it "looks nice" as well as being electrically correct. All component outlines are 0.2mm lines. Text is 1mm high and 0.15mm lines. All component holes are 0.6, 0.8 or 1.4mm. Hi-current traces are 1.5mm wide. Normal traces are 0.3mm wide, except the 5V traces which are 0.5mm wide. That should leave enough headroom for expected currents. I am not including the EEPROM that is required for the complete Pi HAT specification, I am just using the same outline and dimensions.
I am doing the layout with KiCad, which is a great program, but all of the symbols and footprints came from different places, plus I had to draw some of my own. Next time I will create library specifically for the project and copy all the devices I use into there and normalise the line thicknesses, text, and drill holes as I do it.
The board has not changed significantly since the first draft, so it's ready to send to dirtypcbs.com for manufacturing. Unfortunately the HAT boards are slightly bigger than the smallest (cheapest) size of 5x5cm. However, the next size up, 10x10cm is still a good price. I could add some smaller boards to fill up the remaining space, but I'm not going to. After submission it will take about 8 weeks to receive the boards, which is fine as I will be travelling. That means I also won't be working on the software either.
This evening I fixed the problem with AutoCycle. In the original code a graph object is created and deleted as required. In my code I created a single graph object and reused it. Since I copied the structure of the rest of the code this caused problems depending on the order in which routines were called. So now I create and delete a graph object at the same points as the original code. Basically the code is done. I can't do any more until I build the hardware, at which point more bugs will surface, but it means everything can be tested fully.
This evening I implemented the charge and discharge functions, and the autocycle function. The autocycle doesn't work yet, but charge and discharge work on their own. I decided not to use TKinter's after() function as it's not quite what I want. Instead I am using update() which does what I want. Its use is frowned-upon however, so I hope it won't bite me in the future. The next step is to build the hardware, which requires making a PCB, assembling it, and testing it in conjunction with the software. I can do a little more software testing without the hardware, but this is a system and really needs both parts for proper testing and verification. I'll be travelling again soon, so probably won't do much for a couple of months. Anyone else who'd like to try- please go ahead. Pull requests are welcome.
The impedance measurement function is implemented. This can be used as a standalone measurement, but it is also a requirement for the charge and discharge functions. It's basically a verbatim copy of the C++ code. It runs, but I don't have the hardware yet to test it with.
Next will probably be the discharge function, then charge, then autocycle.
I uploaded the first rough draft of the code to GitHub yesterday. It contains the basic framework for everything, but the bulk of the functions in the main core are missing.
Items present:
One function is implemented, and that is the voltage measurement function. If no hardware is present it will record 0V forever.
To integrate the long-running data collection tasks with the TKinter main loop I am using after() to schedule the next step of the data collection. In the more complex routines I will implement a state machine, so that each time after() is executed the process will move on to the next state.
Create an account to leave a comment. Already have an account? Log In.
Yes, the original code turns the load current to zero before turning the relay on or off, so my code does the same.
I see several weaknesses in the design:
Your R2R DAC has 12bit of resolution. For it to have 12bit of precision, your resistors need a 0,025% accuracy. These would be very expensive and you probably did not use them. It would be nuch better to use a µC with an ADC or just an SPI ADC connected to the Raspberry Pi.
The 4bit DAC is OK.
Using a linear regulator from 24V to 5V wastes quite some power. At least it would be good to drive the relay coils from the input voltage by using 24V relays. They have much higher resistance and need lower current. You also could omit K1 completely: Insert a resistor in series with the base connection of Q3 and use Q1 to shunt out its base current. Or just rely on switching D0 to D3 "low" to turn off the current.
Become a member to follow this project and never miss any updates
Thank you for your comments. The circuit design is not mine, it is the original BattMan II circuit. I could have changed the circuit significantly, however several of them have been built, and I believe they work well. I wanted to build a BattMan II for myself, but of course LPT ports are in short supply, hence this rework.
I suggest you read the original BattMan II project page to see why certain design choices were made. I didn't want to change anything as I wanted it to work as the original did.
The 5V regulator is indeed wasteful. I have included an option to power the logic from the Pi 5V output.
The 24V supply voltage is nominal, and will depend on what PSU is available, and what cells are intended to be charged. Since the PSU voltage will differ for different builders the relays can't be driven directly from it (although in practice there is a lot of headroom).
Finally, I agree that turning off the load transistor could remove the need for the second relay, but it's safer and more practical to include it. I'll look at the software and check that it turns off the transistor before turning the relay on or off, to reduce arcing. If it doesn't I'll add it.
Thank you for taking the time to write, I really appreciate it.