Categoriearchief: Projecten

RPi Zero: combined power and ethernet connection

The Raspberry Pi Zero (RPi-0) is a wonderfully small PC-board with a lot of  functionality but without an internet connection, either wireless or ethernet. For many stand-alone applications, such as a surveillance camera, a power connection and an internet connection are sufficient. Of course one could use a wireless connection (WiFi) but these are not that reliable and often temporarily drop connection. Therefore an ethernet connection is preferred. The wiring to the RPi-0 would then involve two items: power cable through one micro-USB port and the internet connection using the other micro-USB port. Both a WiFi-connection or an ethernet connection require a relatively bulky piece of hardware: the beauty of a tiny processor with camera is lost!

But in many applications, USB-cables are used both for power and communication. So, if one uses a standard micro-USB (B male) to a standard male USB A cable all further gadgets can be in another place, for instance in house. Cable lengths can be 3 meters and maybe more! At the other side one has to split to ethernet and power or to USB and power. For the latter, splitter cables are available. For the first I used a standard ethernet to USB converter and added a power cable and a female USB A connector, see above. The latter connects through the cable to the RPi-0 and the other to a power supply. For the power connection I could also use a USB connector but that would be confusing.

The USB to ethernet converter needs some rewiring, see below. The USB cable has been removed and replaced by a cable with the USB female connection. The wire colors are not always following convention, so testing the cable with a multimeter is advised.  The power cable was connected in parallel, the connector is a standard power cable as used on the better wall plug power supplies. Note that at least 2 Amperes are required to run the RPi-0 reliably.

The cabling is already in use with a home-made surveillance camera and runs uninterrupted for over a month now.

Doorgangsmelder serredeur

Het was al gemeld bij de vervanging van de deurbel dat er ook een doorgangsmelder bij de serredeur nodig was. Het heeft even geduurd, maar die is er nu ook. Op de bel in de werkkamer klinkt nu een gong als aan de voordeur wordt gebeld en klinkt gefluit van vogeltjes als er iemand door de serredeur gaat. Ook gaat de flitser af maar die zie ik alleen als het schemert of donker is.

Er zijn verschillende vormen van doorgangsmelders in omloop maar voor de toepassing bij de serredeur wilde ik liefst zo min mogelijk bedrading. Dat sluit de meeste zelfbouwpakketten uit, want die bestaan uit een losse zender en ontvanger. Ik heb nog wel wat geëxperimenteerd met spiegeltjes en reflectoren maar dat werd niet echt een  bevredigende oplossing. Een veel elegantere oplossing zou een van de reflectielichtsluizen van Contrinex zijn, zoals de LRS-1180-304. Met een schakelafstand tot 2 meter zou de breedte van de deur makkelijk te overbruggen zijn. Alleen de prijs stond me wat tegen. Toen ben ik wat gaan zoeken op marktplaats.nl en op ebay.nl en daar vond ik wat ik zocht tegen een redelijker prijs, ongeveer 25 euro. Ik kon zelfs een exemplaar bemachtigen met nog een kabel er aan uit een sloopproject. Als ik wat meer geduld had geoefend dan had ik nog wel goedkoper uit kunnen zijn.

De drukknopzender van KlikaanKlikuit zoals ik die ook voor de voordeurbel gebruikte kon hier goed op worden aangesloten. In feite kon ik met een kleine voeding van 12 Volt (300 mA) zowel de reflectielichtsluis als de zender voeden. Ook de bedrading is relatief simpel. Alle voedingsaansluitingen worden gekoppeld zoals gewoon. De schakeluitgang van de reflectielichtsluis – een pnp-transistor naar de +12 Volt – kan direct aan de schakelingang van de drukknopzender worden verbonden.

2016-11-19-13-56-43-2Een houten sigarendoosje past wel in de kast naast de serredeur en daar heb ik dus het zaakje gemonteerd. Op bovenstaande foto zie je duidelijk rechtsboven de reflectielichtsluis, rechts de aansluiting op de netvoeding en rechtsonder de printplaat van de drukknopzender. Het kastje van de drukknopzender was iets te groot, dus die heb ik er uit gelaten. Een klein stukje dubbelzijdig plakband  voorkomt dat het doosje per ongeluk kan verschuiven. Dekseltje dicht en het geheel kan zijn werk doen.

Water pressure sensor for Raspberry Pi

A pressure sensor is a necessary part of any pressurized liquid system such as a solar boiler, the central heating system in a house and even a car. In all these systems it serves as a monitor on the well being of the system, in particular whether the liquid is still inside or whether there is a leak. Typically, it comes in the form of a pressure gauge somewhere attached to the tubing of the system. Only very recently are there electronic readings and this is usually for a central heating system. But solar boilers are also useful to monitor, just because they are more exposed to extreme weather conditions, and so the idea was already for a long time to install such a device.

But which one to take? The simplest form of such a sensor is a switch that opens when the pressure is above a given minimal value. These are found in the more normal cars, only fancy cars have a more involved one that actually gives a value for the pressure. Whether oil or (cooling) water pressure sensor, both are of the membrane kind because that gives the most rugged form. They are typically provided by VDO but sometimes cheaper look-a-likes are also available. They are frequently offered at a significant discount at Ebay. The membrane separates a pre-pressurized compartment from the compartment of which the pressure has to be taken. The membrane in-between deforms with the pressure difference and this is recorded by means of a strain gauge attached to the membrane. Typically the resistance of the strain gauge varies about 20 Ω per Bar.

Such resistance values are fine for car-applications. The moving coil meter that is usually attached to it through battery power will have a relatively high current to control its position and hence it remains relatively insensitive to vibrations. But for electronic applications it is not so easy as it means high currents that are not available from the RPi or the like of credit card computers. This calls for a special solution that took some while to be found.

First the selection of the pressure sensor itself. The solar boilers do not have a lot of water in them, 5 – 10 liters typically. The solar boiler also contains a pressure vat, a pre-pressurized compartment in contact through a membrane with the system liquid. The vat does not need to be big for a solar boiler, 8 liter is the smallest I could find though. It is pre-pressurized at 0.5 Bar. The bigger ones are at 1 Bar. The function of the vat is to compensate for the volume changes of the water during heating and cooling. To do so, the pressure should go at 1 Bar for the 0.5 Bar pre-pressurized vat. It then has the range from 0.5 Bar up and down to vary the position (and shape) of the membrane while heating or cooling. So, the set value at 20 ° C is 1 Bar and during operation and during outside temperature variations it may vary between 0.5 and 1.5 Bar. The latter are extreme values but possible. The maximum pressure in the system is set by a valve at 2.5 Bar. This will only be reached for instance when the pressure vat malfunctions (leaking membrane). Summing up: a pressure sensor is needed from 0 – 2.5 Bar with a good accuracy around 1 Bar.

Other conditions on the pressure sensor? Most have one of the two strain gauge contacts grounded. This is a good idea for cars where the instrument mass can serve as conductor: it saves wiring. For a microcomputer connection it is not so smart, so try to get one with free contacts (massless) to achieve galvanic isolation. The one that would be preferred (and available) is a VDO 360-081-032-NNNC that can be obtained with various couplings depending on the threading used in your system (different values for NNN). They are not cheap, of the order of 50-100 euro, but they are not expected to break down easily. If they do, there is a guarantee. A word aside on nomenclature: one will find pressure sensors under all kinds of names (Druckgeber, sender, Druckabnemer, etc.) neither of which is particularly appropriate so be prepared to select broad keywords to locate a decently priced item.

How to interface them. Because of the low currents available and the low resistance values offered by the strain gauge, one needs an analog-to-digital converter (ADC) that is capable of converting a small voltage, say 250 mV, to a minimally 8 digit number for accuracy. Interestingly, this is what the DS2438  Smart Battery Monitor by Maxim Integrated delivers. It has two ADC inputs, one for the higher battery voltages and one for the battery current measured across a small resistor (necessarily to avoid excessive loss due to the measurement itself). The chip has 1-wire interface that combines with temperature sensors of the type DS18B20, also from Maxim Integrated. The required electronic circuitry is minimal and in actual fact only requires either a current source or a (relatively) large resistor in series with the strain gauge. In the latter case some a-linearity is introduced that, as it is monotonic, can be corrected for. Using the simplest scheme with a resistor R from the strain gauge to the supply voltage of 3.3 Volt, the resistance Rg of the strain gauge is derived from the convertage voltage V as

Rg = (V / 3.3)*R

and with the calibration curves given for the pressure sensors one can then compute the pressure.

Where the temperature sensors DS18B20 are well provided with software drivers, the DS2438 unfortunately is not. The Python software that exists for the Raspberry Pi is just crappy. So I made a little C-program to take the value from the pressure transducer. Those interested can approach the author for a copy. When using programmed I/O, which is the simplest to implement, the data loss is something to worry about. But since taking a sample is so fast, there is no problem to repeat the reading procedure a few times until a sample has been successfully read. A more reliable procedure uses a UART (serial interfacing circuit) but then requires a little more hardware.

The pressure and temperature sensors are installed for a few weeks now and perform satisfactorily. I will install another one with my other solar heater system soon.

Lantaarnpaal bij bouleveldje

Midden tussen de huizenblokken waarvan onze woning deel uitmaakt ligt een speelveldje met wat attributen voor kinderen. Ook voor volwassenen is er het een en ander: twee banken en een tafel maar ook een heus jeu-de-boules-veldje.  Niet dat er veel gespeeld wordt. Voor zover ik weet eigenlijk alleen de dag volgend op het jaarlijkse buurtfeest.

IMG_20160609_120235Maar natuurlijk zouden de buurtgenoten wel vaker willen spelen, maar meestal is het dan al donker en de lantaarn bij het veldje is wat ver weg. Althans, dat was de klacht zo’n 10 jaar geleden.
Lees verder Lantaarnpaal bij bouleveldje

Deurbel vervangen

Het zal is wel in een keer goed gaan! Omdat ik slecht hoor – zeker als ik in mijn werkkamer op de eerste etage of de hobbiekamer op de tweede verdieping zit – is het nodig om mij te waarschuwen als iemand aan de deur is of als er iemand via de serredeur naar binnen loopt. Daarvoor hadden we van de firma Heidemann wat spullen: een elektronische gong voor op de eerste etage, een belknop-zender bij de voordeur en een bewegingsmelder bij de serredeur. Aanvankelijk voldeed dat prima maar af en toe – en de laatste tijd in toenemende mate – kwam er vals alarm van de detectoren.
Lees verder Deurbel vervangen

RPi repair: SD card slot

The Raspberry Pi uses as disk memory an SD card and for that purpose  has an on board SD card slot. The component is badly designed and breaks down easily as many an RPi owner has found out. It is a pity that the card holder is not more robust but on the other hand, the overall cost of the board had to be kept at a minimum.

2016-05-14 09.08.59

Anyway, the slot breaks down easily which gives rize to irratic behaviour. Lots of ideas have been posted to repair it and these range from glueing a piece of credit card on top of the card holder to replacing it by a micro SD card holder. None seemed satisfactory to me and I looked for a more robust solution.

It turns out that almost the same card holder is made by Würth Elektronik under the type name  WR-CRD. The advantage of this model is that it uses metal to force the card into position and not plastic as was the case with the previous one. The card holder is almost the same because, where the original has two switches the replacement only has the one for detecting the presence of the card. Carefully desoldering the broken card holder and – with slight bending of the contacts of the new card holder to the soldering pads before soldering will have an immediate positive result. It turns out that the other switch for detecting write-block is not necessary: the contacts can be left free (on the photo the top two small soldering pads).

This card holder now already is in function for half a year without problems. I assume it will last “forever”,  i.e. as long as the RPi itself!

Note added after repairing the second RPi. There are two issues to take care of: (1) the orientation pins on the back side – made out of plastic – should be removed so that the socket mounts flatly and (2) only the connections to the switch needs to be bent slightly to avoid short circuiting across the soldering pads.

 

LircPi : nieuw apparaat bedienen met een stokoude afstandsbediening

Introduction

The project got started after a friend remarked that he could not find  vhs-players of a particular model and brand anymore. Before, I have helped him getting such machines going again, but given their age it is not surprising that more and more of them gave up. He needed these players for his partner who is not really capable or learning how to work with other remotes. Lees verder LircPi : nieuw apparaat bedienen met een stokoude afstandsbediening

LED lamp driver with remote control

Most spotlamps to build into a ceiling are ridiculously high, 8 cm or more. The reason is that most of them are still to fit halogen lamps that require a special mirror and produce a lot of heat. LED lamps should not have this problem because they spread light better and because they are so efficient as to not produce a lot of heat. But most lamps are still high, even if these contain LEDs, probably because companies need to get rid of parts/machines first before they renovate Lees verder LED lamp driver with remote control