All posts by Simon

Automated Basement Ventilation: keeping it dry

Basements in older German houses are usually pretty humid and cold, and there are various rules about the proper ventilation. You are supposed to open the window in the early morning, let some dry air in, but during the day, especially in summer, it must be closed. Summer air contains a lot of moisture, because the quantity of water that air can absorb strongly depends on the temperature, the so-called saturation vapor pressure of water. When such moist warm air enters the basement, it will cool down and water will precipitate on the walls. Not good. For me, this is all a bit inconvenient because rather than potatoes I store a lot of electronic parts in the basement, and I want to keep all as dry as possible. So I decided some month ago to set up a little system: (1) a window fan, (2) two humidity/temperature sensors, (3) an ESP32 to control the fan. As sensors, I use the ubiquitous AM2302, because it is easy to read and accurate enough.

For the fan, a KVVR K011301 Model, about 200 m3/h, it also has a feature to close the opening when the fan is off, so that no air can enter the basement when the fan is not running. In principle, you can also use two fans, one to supply air to the basement, and one to extract it, but for me, it works just fine with one fan to extract the air.

A little contraption made to fit the fan to the window. It is all reversible, so if I don’t like to use the fan any more, I can just fit the old window again.

A little control box was quickly made, with an ESP32 module, and a small transformer, a 5 V voltage regulator (be aware that the ESP32 needs pretty high peak current, several hundred mA in WiFi mode! So I needed to add some rather beefy capacitors. Next time I should use a larger transformer…

The key part is the calculation of the absolute moisture level. This is done by regularly (like, every minute) measuring the temperature and relative moisture level inside the basement, and outside, at a protected spot. Then calculate the saturation vapor pressure (which is a formula you can find in textbooks), and multiply with the relative moisture (in percent). This will give you a value that corresponds to the absolute water content (scaling to grams per m3, or similar, but I just use the hPa value, water partial pressure in air). If the water content outside is lower than inside, in absolute terms, I have the controller switch on the fan. There is some hysteresis to avoid all too frequent switching.

A nice box contains all the circuitry, and it can be accessed via a web interface, pretty handy. I also have a server poll the values every few minutes, to prepare some nice diagrams and to check if the system works as designed.

Indeed, it works brilliantly for several months, but then the AM2302 suddenly failed. It would read back the correct temperature, but the moisture value was stuck at 99%. Not good. I tried to clean the sensor, but to no avail. Also, this is the inner sensor, not exposed to the elements or anything. A is outside, B is inside.

So for the time being, I replaced it with a new AM2302, and hope it is just a freak defect and not a general limitation of these sensors — if it is, I will replace the AMS2302 by Bosch BME180 sensor.

This diagram shows the absolute humidity delta, outside minus inside, so if the outside is dryer than inside (for example, outside 10 hPa water, inside 12 hPa, the value will be negative, and the fan will switch on accordingly.

For now, in June, it is all working well, and the basement is indeed much drier than last year, and I don’t need to worry at all about closing and opening windows.

In this region, it seems that at least every few days there is reasonably dry weather for several hours, and the system uses these hours well to ventilate the basement thoroughly. Sure if you have rainy season in your country, this control won’t help, but it all the more moderate climates it seems to be a nice gadget to have.

Workshop Upgrade: Laser cutter and engraver SCULPFUN S9

There are various laser engravers or cutters available in the market, so it is hard to make a choice. Finally I got a Sculpfun S9, which appears to be well-regarded in the community as a cost-effective and capable machine. I was also looking for something that is easily serviceable, not using custom controls or special motors – the Sculpfun S9 is built from all relatively standard components so it can have a very long service life even if I eventually need to fix the electronics or replace the controls altogether.

The machine ships as a kit, but there are good instructions for assembly, step-by-step, even the screws packaged for each step in a separate bag.

The machine is fairly portable, so you can also set it on the surface of large panels to do local engraving or similar.

Some first tests, works very well indeed! Just the smell of burned wood and plastic – it is really not a machine for an apartment, and the laser also seems no toy for kids. It is fairly strong and can be dangerous. This laser has a very sharp (maybe 0.1~0.2 mm beam) that cuts through several mm material in a single cut. No good idea to get your fingers in the way.

You can also cut foil. Maybe better to use a knife cutter (because of the smell and vapors), but for some once-off jobs, it is easy to use and also cuts uneven old foil very well in my test. Better use some magnets to push the foil down on a piece of sheet metal.

The main application that I am looking for is to cut custom seals from plain seal stock. The machine cuts well through 1 mm Elring Abil plate, and similar materials. Even thin rings can be cut, no problem (very hard to cut with a cutter knife or punch).

Next step will be to get the machine properly installed. This means, adding an air nozzle to assist with cutting (made from brass), a machine table, and an enclosure with exhaust fan to get rid of the toxic vapors.

The nozzle is made from a piece of brass (several of these pieces purchased at a scrap yard 25 years ago when I was still a kid).

The nozzle has a side inlet, and is designed for about 20 L/min with 1.5 mm diameter, so we are looking at 150~250 m/s linear velocity at the nozzle outlet.

The gas is fed through a 4 mm PU pneumatic tube.

To measure the air flow, we are using a very cheap Chinese gas flow meter. This has a needle valve, but it is not working well – the needle valve puts a spin on the gas, and the indication is incorrect (the sphere starts oscillating and spinning), so I use a separate needle valve (FESTO GR-QS-8) in the supply pipe.

The flow meters comes with flimsy plastic connectors, and these have 5/16″ UNF (24 TPI) tread… not a very common part in Germany to get a transition from 8 mm pneumatic tubing to 5/16″ UNF…

Fortunately, found a suitable thread cutter in my tool selection, so an adapter was made quite easily (from 5/15″ UNF to 1/4″ NPT, then us a 1/4″ NPT to 8 mm push-in tube connector).

The next step has been to make a suitable table, sure you can put the laser machine on some ordinary table, but it has quite some speed and movement and even relatively stable tables will be moving and there is some impairment of precision. So I wanted to give this machine a stable basis that doesn’t shape. It is all welded construction from about 1.5″ square steel pipe. The top is 18 mm waterproof plywood. There will be a piece of zinc-plated sheet metal on top, also to use magnets, and a open cutter support plate on top in case of heavy cuts.

To fabricate such a table, after the welding is done, grind off the scale (this is just plain steel), clean with acetone, and then roll-on some primer paint.

Finally, painted in a blue-gray color, and with the top plate mounted.

Next step, fabrication of an enclosure with a movable cover. All made from 15×15 mm (about 3/4″) square tube, all TIG welded…. looks easier as it is with all the parts and angles.

There will be two large windows, 40×60 cm, to observe the process. I selected GS-1C33-GT Plexiglas (acrylic glas) which is nicely transparent for visible light, but blue light of the laser can’t pass at all.

This is also confirmed by the spectrum, the laser is emitting at about 452 nm.

After some hours of work, the enclosure is ready for painting. It opens nicely and smoothly, also because of a gas spring (200 N, 535 mm total length, 220 mm travel).

It is one of the few occasions that I have use gas loaded springs in my design but it is working well. Just the design calculation is complicated and probably it is always a bit of experimentation to find the right gas spring size and force. But this time, successful at the first attempt. My recommendation, to rather use a slightly stronger spring (say, 200 N if 150 N is calculated) to allow for aging of the spring or other design uncertainties.

Workshop Upgrade: 3D Printer

Finally, I had to opportunity to acquire a long desired tool, a 3D printer. In recent years these have become fairly affordable, and also easy to use. So it is on longer needed to spend days with optimizing various settings. I am planning to print mostly in durable parts, so I am targeting PETG and ABS rather than PLA plastic materials. Mostly planning to use it for spare parts, or mold patters for aluminum casting.

The machine, it is an Artillery Sidewinder X2, a great product, all nicely arranged in a box.

It didn’t take long to set it up, maybe one hour, and then you can use the well known software packages to run the machine. I am using Freecad for modeling and Cura for processing.

All worked fine already for the first part… great!

A cylinder, and a space shuttle. All fairly robust.

So far, I can only praise the machine, it is working fast and precisely. Just printing low cost PETG material. Key point is to keep the bed rather hot to keep the parts sticking, and then just remove them after cool-down with no effort.

Cheap personal scales: turned into parcel scales with USB interface

With many parcels being shipped, and for some other projects including measuring the contents and consumption of LPG gas cyliners, other gas cylinders, chemical tanks etc, I always wanted a slim and stable balance, at low cost. Sure we can fabricate one from steel plates and load cells, at considerable cost. But why not try with a personal scales, and convert it to some usable tool. This scales from local LIDL supermarket comes for EUR 8.99 in the shop, 10 dollars.

It is very slim and stable, basically a piece of hardened glass, with 4 load cells. There are 2 thin-walled stainless tubes to carry the wires to the main processor.

That’s the type, just for reference:

The load cells are the typical 3-wire elements (two load elements inside, red is the center).

The main disadvantage of these balances is (in addition to the absence of an interface) the absence of a continuous reading, in contrast to a good old analog balance it only shows one weight once, when you step on it. For various uses, I rather need a balance that continuously shows the weight, and can transfer it to a host for data analysis.

The load cells rest on certain plastic parts that are glued to the glass plate.

We need to cut a little modification on the milling machine, to make space for a small AVR controller board, and the USB (micro-USB) plug. There is no need to batteries any more, it will all be powered by USB.

For the load cell interface, the 4 load cells need to be wired up in a bridge (not important in which order of the load cells, but always white-while black-black, and alternating red wired for drive and signal inputs.

So we use a very common HX711 driver, it seems to work well with these load cells. I still had a board with higher data output rate (can be changed by floating a pin on the HX711), but you may select the data rate as you like. The HX711 is continuously active, and sending data to the host though a USB serial chip, CH340.

The internals, a arduino nano fake board (not running arduino code, but just some plain avr-gcc code), and the HX711 all wired up, we just need some hot glue to keep it together.

All ready to be put back together. Watch the wires, these are very thin.

The USB port, it all looks as if it had never been without.

The receiver side, the balance digital converted value is directly transmitted to the host, so all the conversion to kg and zero correction is done by the host, including smoothing.

It is just a simple software, I programmed it using wxWidgets, but you can use any software that can handle USB/RS-232 communication and read serial ports, including Python, etc.

One bug with Windows – because of the continuous data stream over serial, Windows 7 seems to believe the balance is a serial mouse, and starts randomly moving the mouse pointer. With the little code below, this can be disabled and avoided. Probably need to add some waiting time before transmission starts in the AVR code.

If you need any of the code or further instructions, just let me know!

For calibration, a good hint, you can use milk packages (UHT milk), one pack is about 1060 g with very little variance, and it can easily be stacked up.
The Zero-Point seems to be very stable, I tested it after 90 kg load changes and so on, and it is not moving by 10 g.

CNC Lathe Signal Conditioning: fighting the noise

For the control of my CNC lathe, I need to read the spindle encoder (index and rotation signal), and two glass scales. These encoders all provide TTL level signals, and so far it worked well, but there are cases were electric noise of the switching motor or other equipment in the workshop. So finally I decided to put a bit more effort and upgrade the interface.

So far, it is just a cable that connects the three sources (spindle-index, x, z) to a parallel port input (a PCI card).

For signal conditioning, the input signals are filtered with a 4n7 capacitor+330 R, followed by a 74LS14 inverter schmitt trigger.

Everything on a little PCB, and put in dust-proof case so that it will work in the dusty workshop.

Finally, put it to a test and it worked “out-of-the-box”.

A simple schematic:

Electronic Master Clock: a huge train station clock is ticking again

Recently, I have been asked how an old slave clock could be controlled, it was saved from being scrapped, when a local train station closed down. It is really big and heavy. Eventually, I checked it out and it can be operated from 12 V, 24 V, or higher voltages by adding a resistor. We decided to operate it on 12 V, simply because one of the slides (this is two-sided slave clock) had already been set to this value.

In order to control the slave clock, we have to send a 1~2 second long voltage pulse, every minute, in alternating polarity. Then the minute hand will advance minute by minute. There is no second hand on this slave clock.

The control board is fairly simple, to test it all out, I soldered it on a piece of prototype board. Main control is by an ATMEGA8 microcontroller. This is using its own clock, from a Kyocera HC1 crystal oscillator to derive a 1 minute time interval, and and auxiliary 1 second output, for calibration purposes.

ï¼´he actual adjustment of the clock is done in software, because the oscillator is pretty stable, and this is just a test circuit. If the slave clock will be a minute off, or two, nobody will mind.

The clock drive is completely separate from the controller, isolated by optocouplers. I used a small transformer, with dual 12 V output (because it is small current only, the output voltage is high enough, but you may use a 15 V transformer if it is handy).

Seems we are about 25 ppm out. After correction, the clock was running well within 1 ppm, fractions of a second per day.

To make the contraption a safe and useful thing, I put it in a little box, with some cables and feed-throughs.
Now it is up for some long term test, let’s see if it needs any modification.

SMEG CS19ID-6 Range: another defect

It seems my SMEG kitchen range is getting older… at least it is again showing some issues. The right hand side front induction field is sometimes coming on, intermittently, only to shut off quickly again. Normal operation is no problem, but when it is switched off, it doesn’t remain fully switched off all the time. Could be dangerous if some pot is left on the induction field, and the range decides to switch it on by itself… a praise to all the old-fashioned switches that completely took power off the appliance.

First we need to find out the source of the issue, is the it controls electronics, or the switch? To test, I opened up the front panel (easy enough, it is just 8 screws…), and switched the cables going to two of the front panel switches. And, as it turns out, the issue also switched. So it is probably a defective switch rather than any issue with the electronics. That’s good news.

For about 35 EUR, I got a new switch, as it turns out, it is no switch put a potentiometer…

… and a quick exchange fixed the issue. Now let’s do some study of the old part.

Made by printing some conductive composite on a circuit board. Looking good. I can’t see any issue with it even under the microscope. Maybe just some contact issue, the contacts also don’t look clean.

So I will clean it all up thoroughly, bent the contacts a bit to give it slightly more force, and keep it as a spare.

These potentiometers aren’t cheap, at least the use good engineering plastics for it, like, glass fiber reinforced materials.

Siemens Master Clock: Revision 2

This clock has now been in my possession for close to 10 years, it is a Siemens master clock with 3/4 invar pendulum. It is a nice clock, but also needs some repairs at times, especially, the contact wear out or get dirty over time so every two or three year it needs adjustment, cleaning and so on. Another issue is the noise every minute, which is caused by an electromagnet driving the winding mechanism.

There are many contacts and all these need to work, also the main gear of the second hand is triggering a contact, which is known to have an adverse effect on the clock stability, by putting extra load (losses) on the pendulum.

So, we have to re-configure the winding mechanism, and I decided to use a maintenance-free stepper driver. Like those used in old floppy disk drivers.

Only needed to fabricate a metal bracket to mount it to the clockworks. Needless to say, no modification of the clock has been made, I just made use of the existing holes and screws.

To indicate the fully-wound position of the clock, there is normally another set of two contacts that stop the magnet from further winding up the clock. However, also these need some cleaning and adjustment at times, so I replaced them with a inductive proximity sensor.

The sensor has a M8x1 thread, so a mounting bracket can be easily fabricated from some brass.

To control the stepper motor, the winding mechanism, and the second’s pick up (a simple light gate with some comparator circuit), a electronics board is in place, using an ESP32 microcontroller that include a WLAN interface.

The circuit is fairly straightforward. The stepper is driven by a 4-phase uni-polar driver, which has some resistors and diodes, and current switched by darlington transistors. The current per phase is roughly 120 mA, and only one phase active per step, operating in full-step mode with 200 steps/rev. Timing is roughly 10 ms per step.

Power is obtained from 9 VAC power, but the circuit will accept DC or AC, any polarity. A DS18B20 is used for temperature sensing. I am thinking about adding a BMP180 barometric sensor to the circuit, but now that everything is running nicely, I don’t want to disturb the clock. In any case, the circuit is connected to the clock by a 15-pin SUB-D plug, so it can be removed from the clock without removing the dials or anything else.

So I can run a small web interface which is polled every 10 minutes by my main server, to get the current time deviation of the clock, and its temperature.

The adjustments were very easy, and it only took a day to get the clock working to within 1 sec/day deviation. Let’s see if there is some drift developing over time.

The software gave me quite a hard time initially, because the motor control is interacting with the pick up of the pendulum (the light gate signal wire and the motor wires with inductive currents all installed parallel and powered from the same supply, so there were some false counts. Now the timing is such that the winding happens in the dead time, i.e., after a “tick” of the pendulum, and well within the time to the next “tick” (tick-tock-tick-tock spaced 0.75 seconds, so it is 40 ticks per minute for the 3/4 pendulum). That solved the false-count issues altogether, and still I am using a filter algorithm to reconstruct the action pendulum motions perfectly fine, even if one tick would be missed, etc.

A Japanese hot pot: A hot spring without a hot spring

One of the most famous features of Japan is the availability of hot spring all around the country. If this is an advantage or disadvantage of my new living place in Germany remains yet to be seen, because the hot water close to the surface normally comes along with other earth activity including volcanos and earthquakes… Anyway, I have no source of hot water here other than by gas heating, so at least I wanted to have an outdoor bath resembling Japanese style.

The pot is handmade from high alumina clay, fired at about 1350°C, and shipped from famous Jingdezhen, Jiangxi China, within about 8 weeks. It is a heavy pot, about 350 kg. It resembles the Japanese made bath pots 1:1 but the price is much more competitive and a certain Ms. Wei of the pot company knows how to deal with foreign customers and can manage export of such items as a routine business… Transportation fees in Germany and customs duties, taxes turned out to be more costly than the pot itself.

The essential elements are, (1) the pot, (2) the piping system all made from DN40 glue-fitting PVC-U pipe, (3) a circulation pump (180 Watts, Wiltec 51554, including a filter/strainer), (4) a gas heater (fired by Propan), (5) hot water supply pipe – this is constructed such that it can be drained easily in winter after each use, so it is possible to have a bath also in freezing conditions, made from 18 mm copper pipe and fed by the main hot water system of the house (using natural gas), (6) a regulator system to keep stable temperature.

The water heater has a safety system to switch off the heater after 20 minutes of use, and it has a built-in electric ignition system powered by 2 batteries, 1.5 Volts each. In order to achieve temperature regulation without interfering with the internal circuit of the gas heater, I just switch on and off the 3 V power to the heater.

Normally the heater is only used to keep the water at constant temperature of about 42°C (Japanese baths are really hot…), which takes less than 20 min on-time, anyway, I decided to add a timer circuit that interrupts the heater ever 15 minutes for 30 seconds. So essentially, it can continuously heat the bath even when filling in cold water. Normally the bath is started with reasonably hot water from the house main supply.

Unfortunately, the ignition system by high voltage causes the regulator to hang up. The high voltage sparks change the ground potential it seems, and even some attempts with protection and clean-up circuits (low pass filters) had no permanent effect, when powered from a single supply that is split to 12 V the regulator/timer, and 3 V for the heater. So I now powder the unit from two completely separate powder adapters, and two completely separated circuits, isolated by mechanical relay.

The voltage regulator for 3 V is a simple LM317 circuit, with some more capacitors and features to protect it from any surge voltages.

The temperature regulator and timer, sure you could build it yourself with some microcontroller, display, etc, but no need as the complete module is available for less than 3 EUR mail-order.

The water circuit has the circulation pump. Note that not all the water is passing through the heat, only a certain portion, and pressure is generated by an orifice in parallel with the heater. Temperature sensing is done in the circulation loop. In winter the circulation system can be completely drained and switched-off by appropriate ball valves. So you can still have a bath, but you just can’t heat it by the circulation system (rather need to add more hot water, or just limit the bath to 1 hour or so).

The heat loss seems to be about 1 kW, so we need to run the heater that is using about 1.2-1.4 kg of propane per hour of operation only for some minutes at a time (1 kg propane has about 14 kWh of energy, and we may assume an efficiency of 0.7). Experience shows that is this correct, the heater may switch on every 15-20 minutes of so for about 3 minutes.

Now the system is completely automatic. In normal usage there is no need to adjust any regulators. Just fill in water and switch the bath main switch to “ON”.

Lastly, the water is not just plain tap water but sure enough I am adding bath salts composed such that they resemble my favorite Yamaguchi prefecture hot spring pretty well!

Olympia CD401 Tischrechner: a magnetic keyboard

This marvelous CD401 Nixie-Tube calculator came to me in pristine condition, from a friend, and including all the accessories and even the original power cord. Just that it has some small defects. Numbers 2 and 7 didn’t work, and some of the keys have mechanical issues. Noteworthy, this little calculator came from Japan, despite being branded Olympia (which is a German company no longer in existence), an made by Matsushita Electrics, also known as Panasonic, in the early 70s. It cost close to 1000 Deutschmarks, may be equivalent to a two week’s salary of an engineer at the time…

Someone had apparently tried to fix it before, using inappropriate tools and scratching some internals, and not taking care of proper alignment of the parts.

The non-reactive “2” could easily be traced by a continuity tester, a bad circuit trace (the grease seems to be slightly acidic and has some greenish discoloration in places – copper corrosion).

The trace would be easily fixed with a short wire and some solder. The other defect – maybe introduced by the earlier repair attempts, a broken reed switch. The keyboard as such is a remarkedly complex setup – each key has several metal and plastic parts, and a magnet that operates a reed switch. Clearly, this had been built to a certain standard of longevity at the time, an engineering tool rather than a “pocket calculator”.

I keep a box of reed switches as spares, so luckly found one that is a pretty exact fit of the original.

Some careful re-assembly, some cleaning of old grease, and the instrument can go for a test. Note that there is exposed mains voltage around the transformer – why didn’t they put some cover?? It is right open and exposed and will give you an electric shock when you touch it…

That’t finally the machine all fixed and in best working order, probably soon it will be 50 years old.