Friday, January 1, 2016

Polishing the turd

After some looking at the datasheets and doing some number crunching, I came to the conclusion that the inductance of the buck regulator is too small, not too large...
Measuring the size and winding of the original one, inductance calculators gave an estimate of about 300μH, which is reasonably close to 330μH that it probably was.According to the datasheet, for 12V input, 5V output at 0.45A, I should be using a 470μH inductor. So I dug through my junk pile, found a T106 size iron powder core that was green with one side blue, meaning it has a permiability of 75 and is good to about 1MHz.
"Ring core calculator" (freeware program) said I need 70 turns (243cm of wire), couldn't find what wire I should use, so I just grabbed the first reel I came across, 0.255mm diameter which should be sufficient. Half an hour of winding later, I had in inductor that replaced the original one, only downside is that it weighs 36g instead of the 27g of the original one...the core is ridiculously large for such low current, but I don't have anything smaller that can fit enough turns for 470μH.

It's quite interesting that with switchmode regulators, drawing less current means you need more inductance to function properly, and vice versa for larger currents, where the core size is predominately dictated by wire thickness, as you need just a couple of turns. (but you have to be able to physically stuff it in/on the core)

For 5V out... © ON Semiconductor
The number is inductance in μH, the letter has to do with current rating.

TL:DR - input power is now 2,81W (instead of 3W), making n=76,6%, so - yeah, improvement, but nothing to receive a prize for...

Thursday, December 31, 2015

FPV for the 21st century

Saw a couple (of dozens...) of youtube videos with people mounting FPV to various RC things. The videos from cameras themselves looked fantastic, but to transmit the video feed to the pilot, an analog link is traditionally used. While the transmitters and receivers are small, relatively cheap and yet use fancy modern stuff like digitally controlled PLL tuning, it's still analog video, even at perfect conditions you have 576 visible lines at most, a far cry from 720p or 1080p we are used to in digital video that has been around for almost a decade now.
There are a few working attempts at transmitting amateur video over DVB-T, but the problem is that the cheapest variant (to this day) requires a modulator that costs $170-$230, not very cheap. Does not include the cost of any other vital part (camera, RasPi...)
Others that I saw use software radio, this particular one a BladeRF ($420), and I would guess that it should be possible to use HackRF (~$300, depending where you buy it from) or the HackRF Blue ($215, or $150 for a "factory second" version), which is a cost-optimised version of the HackRF. One more that I remeber used an URSP 1 (>$700, the newer versions cost even more).
All of the software radio versions however require a fair bit of floating-point maths to be done, way more then a measly Raspberry Pi could do, so they are not practical as FPV transmitters.

So, not being happy with the analog quality and the pricy-ness of the digital solutions, I've been putting FPV off for over 2 years now.
Recently I noticed Wifibroadcast, which simply put uses "monitor mode" to force certain wifi chipsets (only some can do this!) to completely change the way the protocol works, which allows not only to receive mangled packets (under normal operation wifi discards packets whose CRC does not match), but to also transmit modified packets. One other important feature of Wifibroadcast is that it's one way, meaning that the transmitter does not need to receive any conformation from the receiver (again, under normal wifi operation, the transmitter keeps re-transmitting a packet until it gets an ACK from the receiver or times out and quits trying). The combination of one-way transmitting and ability to receive mangled packets means that with degrading conditions (like the transmitter getting too far) the link fails "gracefully", not instantly like normal wifi would.

So, (my) shopping list:

1x Raspberry Pi Model A+ with Coupé Royale Pibow (£20.83 GBP (~$29.5) from )
1x Raspberry Pi Zero + Adaptors (£6.67 GBP (~$9.4) from
1x OV5647 Sensor camera ($15 from Ebay) *
2x TP-Link TL-WN722N ($14.5 each from Ebay)
2x microSD cards, 4GB at minimum ($3 each? from Ebay)

total: $88.9 USD

I've had the wifi adapters and SD cards for less, since I work at a computer store (employee discount :D).
*The camera has fairly crap optics, which is not very surprising since it cost less then 1/2 of what the ones with better optics do. It also is not wide-angle enough, so it's unsuitable for me (kept snagging the car on obstacles, because I couldn't see them), will probably be changing that. But it works for a proof-of-concept. There are several options for the camera, for example with and without the IR filter, the rest is all about the lens.
Since not everything arrived before Christmas (like it was supposed to...I'm looking at you Czech Post), I didn't have all the essential parts until now.
So, after a couple of zip-ties, about 50cm of kapton tape and one hour of hacking, most of which was spent troubleshooting the 5V switchmode regulator (amazing how much flustration can a forgotten resistor do...), I had this:

No officer, this totally is not a bomb, honest!
The green LED flashes when transmitting...seriously though, some might see this as a bomb :D
Pictures were shot with a crappy cell phone camera with clearly not enough light. Sorry about that.

The box from laser-cut acrylic contains the Pi A+, below it is a 3S2P lithium pack scavenged from a laptop battery (was 4S, but one pair was dead). The mess of wires on the right with the inductor and grossly oversized heatsink is an LM2575T-ADJ buck regulator providing 5V for the RasPi. Junk from a disasembled old project. I could have made it output 3.3V and feed the Pi directly (it has an internal 5V to 3.3V regulator), but I do not trust the thing enough to do that. If it goes apeshit and starts feeding more then it's supposed to, the Pi will let out the magic smoke. The 5V input on the other hand is quite idiot tolerant, as it survived 9V. (forgot to remove an original resistor from the board as I installed a new voltage divider into the feedback loop, it happened to be in the "lower" part of the divider causing it give out much more voltage).
The bare board (with the antenna) dangerously sticking out is the TL-WN722N. As mentioned in the picture caption, the thing does flash when it starts to transmit, which draws unnecessary attention and eats power (albeit not very much). The board on the copper wire with the flat-flex leading to it is the camera module. The black part is 8.5x8.5mm, really small. Might also try to change the flat-flex to normal wires to make it more flexible.

Getting it to work is stupidly simple, download both the precompiled TX and RX images from the Wifibroadcast GitHub, load the images onto the SD cards (Adafruit has a nice tutorial), plug the cards into respective Pi's, connect the camera, wifi dongles, power, monitor and off you go. If you did it right, it will be plug-and-play, don't be scared by the commandline dump on the receiver screen, you just have to wait until everything loads and starts.

The tiny thing on the drum with the cables is the Zero. Receiving wifi is on the stool down left.
Picture quality (and latency!) will depend on both the camera and monitor. Currently I'm using an LG smart TV, but that will change once the damn display finally gets here...
The picture does not do justice to the quality, even with the shitty optics the $15 camera module has, it's quite reasonable. Low light performance however is atrocious (not surprising given the size of the lens), best to this outside in daylight.
Latency is well perceptable, estimated guess is somewhere on the 500ms mark. A lot like a good IP security camera with direct cable connection. The main suspect is here the TV itself, not Wifibroadcast.
Sadly I can't record the HDMI output directly, the TV will not allow it (cause hurr durr pirates...fuck you DMCA, fuck you with a cactus) and I have nothing else that can record HDMI. Will have to see if the receiver has enough gnomes free to record the output somewhere...

When booting, the current was jumping around 100mA, once the camera kicks in (h264 encoding) and wifi starts transmitting, it jumped to 260mA (couldn't use low range, so I just round up the last decimal).
during boot, jumps between 60-150mA

Current times voltage equals power, in this case 3 watts. Considering that's with the sub-optimal regulator design (fairly low frequency and grossly oversized inductor), not too bad. I will be doing more measurements with a better regulator providing 3.3V directly.
Sadly, the Zero does not have the camera port or the connections to it on the board, which is a shame, so you have to use an A+ for the transmitter. Using the more powerful Pi versions for the transmitter is counterproductive, as the greater heard of horses also eats more (and generates more waste heat).

Obvious thing to do at 6 o'clock in the evening...

Yes, that's a zip-tie

I was kinda in a hurry to get it moving...

All it's missing is the kitchen sink...
Did just a few quick indoor tests, big surprise, a 1:10 RC car is too big for driving around a flat without wrecking it. Since it's dark, freezing and now snowing outside (and the 100cm TV is kinda hard to carry around), so I have to wait for better weather and a small display.

To come:
this (Zero has the same header, so it should work)
- some miniaturization (remove USB connectors and hardwire the wifi, use a more modern buck converter)
- weatherproofing
- lowering the power-hungriness
- dealing with the slight EMI issues (RC car and the wifi interfere with each other in various ways)
- different camera module (huge lens, maybe no IR filter for better low-light performance)


So I measured the 5V side, and the consumption is when transmitting is 2,15W, which is pretty much dead on 70% of the regulator input, so, quite a shitty buck regulator. A properly designed one should be capable of at least 85%, over 90% if done really well.
However keep in mind that these measurements do not include the absolute deviation, I'm too lazy to look it up and count it, if you're bored, I used a UT61 multimeter, current was on the 10A range.
Also there's the problem of switchmode PSUs, which notoriously confuse the fuck out of multimeters by the high frequency ripple, the UT61 is a true-RMS meter, but a cheap one, so...

Monday, September 7, 2015

Hobbyking ECO 6-10 200W & USB data

© Hobbyking

A while back, I bought this charger. May seem a little pricy, but I wanted the more powerful discharging. More on how that bites you in the ass later (fan's loud as fuck). Anyways, there was a USB port on the side, was even labeled as USB.
While as it seems that some of the Hobbyking ECO series use this connector for UART, this one is a real USB device, a CP2102 UART to USB bridge to be precise. If the PC finds a USB device once you plug it in, you have USB version. (huh, who would've thought...)
So, we have a UART bridge connected to a charger, now what.
For starters, you need the CP210x_VCP driver. (google, there's plenty links) Once that installs, you can actually connect to it with a serial monitor, that i can personally attest. However, after 30 minutes of trying different combinations of baud rates, parity, data, stop bits and hardware flow settings and still getting garbled nonsense, I gave up. There's like, only, 2240 permutations, and that's excluding the software flow control settings...oh, and 9600 baud, 8 bits, no parity and 1 stop bit does not work btw...
Turns out, there's actually custom software that can do all the work, the downside is that it's proprietary. The charger manual actually even mentions it - EAC200.
When googled, a company named Bantam keeps popping up. They even make a charger named "eStationBC610". 6-10...where have I heard that before...when in China, expect copies of everything.
Buuuut, since I'm cheap and don't feel like paying $20 for a CD and postage, I kept on searching.
As it turns out, good people still seem to exist, there's an opensource program that can do the same - DataExplorer.
DataExplorer is Java-based, there are 32bit and 64bit versions, watch out for that, the wrong one will install fine, but won't run. From what I understand, the 32 or 64 bit should be dependent on your version of Java, but from my experience of having 64bit Windows 7 Professional with both Java versions, I needed the 64bit.
Once you install everything, you have to choose the "eStationBC610", don't worry if nothing happens even if you have the charger connected, you have to start charging/discharging for it to communicate (which is weird, since the charger is sending something through the port even when idle.)

The moment you start charging, it comes to life
1 minute 20 seconds in
10 minutes 40 seconds in

I'd call that a success, free (even open source) and it works...

Tuesday, April 28, 2015

Moar pictures of the Siemens EPD-1 guts

portion of the flat flex cable
Traces from top to bottom:
Ground (to case)
Negative power (ground)
Positive power

The lower large pad is the negative battery terminal, the upper positive. This is where I connected a Li-ion cell and the unit did something.

The weird springy sheet metal clip...thing...holds this:

Absolutely no idea WTF


The center pin of this weird thing is the unknown* trace, the case is connected to ground.

Thursday, January 22, 2015

PC watercooling loop upgrade and update

Approximately 4 months have passed and I was looking for a new job again (dear ex-employer: fuck you) so I finally had time to finalize the project to what I consider version 1.0. Well, the real reason I did it was because of this:

The glue decided to take a break

The glue in top back edge of the reservoir decided to let go, forming an approx. 5cm crack, some 0.35mm wide. Small enough to not get noticed in the case and above the still waterline, so it probably was there a while since it had no reason to leak. Because of the way the system was kludged together, some time later I had to lean the case backwards a bit to keep the pump from sucking in small bubbles. (It makes noise when that happens) The result of this was that a puddle of water began to form on the top of the reservoir and started to drip down. Luckily nothing got destroyed, the PC did however crash, which was why I was examining the insides and found a puddle of water on the bottom. Not a very pleasant feeling I tell you...
Because the loop had to be drained, (top tip: if you need to drain your loop and don't want to make a mess, use a vacuum cleaner that can deal with water) I went ahead and decided to put the L fittings in.
I also took the block apart to see how it held up.

Not so well...
At least the seal worked

The block does indeed corrode, I suspect that is because the CPU heatspreader is grounded, thus there is potential between the brass fittings (which are connected to the hose braiding and that touches the case). Anyways, there is no measurable loss of material (the bottom is still almost 2.5mm thick like it was before) and judging by the amount of oxides, I will make a new block well before the old one becomes anywhere near being eaten through.
The only downside is lost cooling potential. I am running a FX-8320e and the temperature stays around 30°C at 18°C ambient temperature while idling, at full synthetic load it fairly quickly climbs to around 38°C and stays there. After terminating the load, it quickly falls back down, indicating that the block has a fair bit of heat resistance. Hopefully a new block will fix this, but overall I am very satisfied with the performance, the true test will come when summer hits and the ambient temps rise past 35°C...

After scrubbing the oxides off, I began reassembly.
These allow the L fittings to rotate without moving the threads in the plastic
In all its glory

This time, the block is sealed by air-curing neutral silicone.
Beware that not all silicones are ph neutral, most are acidic and corrode aluminium!

Block, it's hoses and pump are in

Radiator with fans (on the inside), reservoir and more hoses added

As if failing once is not enough...

I hate acrylic/CA glue as a building material. This will get replaced in the next version.

Complete with filling solution
Additions to this version include a fillport with ball valve and a T fitting at the pump. Forgot to take pictures with the graphics card inside. Some other day...

You will need these tools to complete the build

The crapload of wrenches is necessary because of the 3 different nut sizes, the universal one is needed because of limited space between some fittings where normal wrenches simply do not fit.
Next is an hex bit with holder (screws in the CPU block), the big hex key is to screw in and tighten the stationary part of the L fittings into the block (their inside is hex shaped) as there is no other way to do so.
Teflon tape is to seal the fittings in the plastic, everything else uses squishy silicone ring seals (blue box top left-ish).
Needle-nose pliers and screwdrivers to fix the heat exchanger in place, neutral silicone to seal the block itself.
Hose with screw-on L fitting, funnels, clamps and measuring cup to fill the loop. btw the coolant now contains about 10% non-toxic anti-freeze (some weird mix of various more complex alcohols, the pure form is quite sirupy) to keep algae and other crap out. Or at least dead.

Version 2.0 will feature a better block design that uses copper in reasonable amounts (thus being cheap) and most likely a graphics card cooling solution. I'm still toying with the idea of making the CPU cooling direct (water directly on the heatspreader), as it would drastically improve the thermal resistance problem and make the thing smaller.

Tuesday, October 14, 2014

PC watercooling loop

Been putting this off for a very long time (taking photos requires partial computer disassembly), so I'll just post a few previews...
Leak test

Top left - heat exchanger (mostly called "radiator" even though the primary method of heat transfer is convection into flowing air, radiation is negligible at these temperatures), the Alphacool NexXxoS Xtreme II rev2. This is the single most expensive component of the build, closely followed by the pump. At 395 x 120 x 45 mm it fits 2 120mm fans (not pictured), in my case Arctic Cooling Arctic F12 CO PWM. Fairly cheap, yet they have 2 ball bearings, PWM and decent power (for the price). 6W at full power may not seem much, but a lot of the more expensive fans are even wimpier.
I have however found out that these fans seem to stall (increasing RPM doesn't increase airflow) when running over 40% PWM, they clearly were designed for free-flow operation, not to be mounted directly on the heat exchanger. One day I might get annoyed enough about this to go crazy and buy a pair of Deltas, since they have 120mm models with PWM and guide vanes (can create more pressure, downside is noise and manufacturing cost), but at the moment I can't justify spending over $80 on 2 fans, no matter how ridiculously overpowered they are...
Middle-ish left - the CPU block.
Middle-ish right - the reservoir/expansion tank. It's made from acrylic sheet (which is probably older then I am) bonded with CA glue. In/out ports are threaded brass, the input one is a flange nut that has been sanded flat, glued with CA to wall (which already had a hole in it) and after the glue set, I secured it with an acrylic plate that had a hexagon cut into it (prevents the nut from exerting shear forces onto the glued surfaces). The output is a threaded stub and a flange nut is holding it in place. So much CA glue was used to make sure it's not going anywhere. The output also has a...thing...on the inside to keep it from picking up air, it looks like a scoop.
The tank is has a baffle in the middle, it's intended purpose is to give bubbles more time to rise to the surface and not be sucked in by the pump. Secondary and unintended effects is a nice wave indicating flow.
Upper right - An Eheim 1048 bought waaaaay back (today I would have gone for a 12V powered pump) in ~2005. While it has nice ceramic bearings - picture a white smooth ceramic shaft that goes into a smooth ceramic tube of matching diameter, almost loose fit (slides freely but no perceptible play) - it's still a synchronous motor and as such, it can (and will!) spin in either way, depending on when (AC phase) you turn it on, which means the impeller has to have straight instead of nicely curved blades and can (deliberately) freely rotate some 60° in relation to the magnet. The end result of these features is not-so-unnoticeable AC hum from the coils and if air bubbles manage to get in the pump, you get horrible rattling and clackety noises, which subside only after the air is expelled out. The pump cannot to this on it's own, so it has to be re-started, usually a couple of times. Once this is done and it's snugly fit in it's foam vibration dampener, the fans (or magnetic HDDs) are louder then the pump.
As you can probably see, I tried my best to avoid galvanic corrosion as much as possible, the only critical place is the pump output fitting, as it's made out of steel, not nickel-plated brass like the nut on pipe is. In case you are wondering why, it's a fitting made for hydraulics, nobody seems to be making a G 1/4 male to G 3/8 male fittings out of brass in this country. I have coated the inside of the fitting with a resin-based lacquer, but I fear this may not be enough.
One other possible place might be the radiator, as it's not clear what it's actually made out of, flanges seem to be brass, but the tubes are supposed to be copper. Also, they are soldered/brazed (more different metals).
We will see how it held up as I will be doing scheduled maintenance in the near future, main reason being I need to add L-fittings to nearly everything in order for it to fit in the case the way I want, not the way the minimum bend radius of the pipes will allow me. Other items to be added is a drain and fill valve, because attempting to fill (or drain) the system without them is a pain in the butt I wish to never have to experience again.

Sunday, September 21, 2014

Converting a dual rail PSU into a single rail

Needed a 12V/2A peak power supply for a TV/monitor made out of junk (more on that some other day, if I ever get myself into finishing it), but didn't have one particularly like that, nor did I want to buy a new one. When I searched the junk pile, I found one of those IDE HDD to USB converters.
Like this one
The set has been long junked, but the PSU still worked. The problem however was, that it's designed to supply 12V/2A and 5V/2A at the same time. This means that the stabilization is referenced off of both rails, and generally will not be very happy if you try to fully load just one.
In my case, the load is a LVDS panel signal converter (and a TFT  LCD panel with it's backlight module). Once everything was stable and running, the PSU could crank enough juice and keep the voltage high enough that the converter logic didn't complain. But when starting, the current draw peaked at 2A and the logic kept shutting down, because the voltage dropped below 11,5V. (Not sure why that mattered, since all of it's internal power supplies need less then that)

So, surgery time...

Red lettering notes what was added (it should be pretty obvious that a few parts have been removed prior to that).
A) is the new voltage divider, consisting of a 3k9 and 1k resistor.
B) is an additional low ESR capacitor, 1mF/25V (unncessarily too much, but it's what I had on in the junk pile)
C) is a 10µF tantalum cap, needed to keep the TL431 out of it's unstable region
D) TL431, scrapped from the same dead PSU as the cap in B)
E) a new 150Ω resistor (instead of 100Ω from previously) for the optotron (no idea what it, just assumed a 4N35 knock off, which it apparently isn't*)

*With a 3k9 and 1k resitor divider and a TL431 voltage reference (2,5V) the formula Vout=(R1/R2+1)*Vref yields should yield 12,25V.

A-PSU;B-current(x10 in mA);C-voltage;D-30A/300mV shunt;E-bigass rheostats as load (yes, a rheostat, you read that right)

Seems that the mystery optocoupler is somewhat different from a 4N35 which I assumed it would be. But we are still within margin.
The powersupply is surprisingly well built (considering that the entire set of the converter cost the equivalent of $20, with import fees, taxes and all that crap),  the main transitor is a  STP4NC60FP (not sure if real or knockoff) and the primary and secondary sides are well separated. Eve the filtration caps don't seem like the cheapest crap that's out there.
The primary side of the power supply looks very similar to this one. The secondary side (now) looks somewhat like this. The resitor divider is obviously different and there is a 10µF bipolar cap connected to the cathode and anode of the T431. If you leave this out, the TL431 will enter an unstable region (fig. 15 on page 7) and start to oscillate, since the LED in the optocoupler has capacitance.
In my case, that causes an audible whine of the power supply from no to full load, and quite notable voltage ripple (no footage, sry). With the cap it oscillates only when the load drops below approx. 120mA (even then the ripple is smaller and barely audible), which will not be a problem, since when on, the TV draws about 1A, and when on stand-by it will not mind the increased ripple.

Edit: I fucked up and read the theory wrong, the cap is supposed to be between the reference and ground (close to the anode). Once there, the PSU exhibits similar ripple behavior with the exception of audible noise - there is none whatsoever, regardless of the load.

Running with a 1A load
Relaxation oscillation with approx. 90mA load

Sorry for the crappiness of the footage (and lack of grid or frequency, the scope is from the 60s...EMP resistance comes at a cost :D), but hopefully it's clear what goes on in the power supply.