Arduino and relay, or driving 220V devices with Arduino

To move something in the real world, more volts and amperes are needed than Arduino can put out bu itself. Relay to the rescue.
A relay is an electrically operated switch. Very nice description by http://en.wikipedia.org/wiki/Relay
Unfortunately, connecting a relay directly to Arduino is not possible or at least not feasible.
Relays usually need more than 40mA at 5V to operate. And that is the maximum, Arduino can supply. So more electronic components are needed.
At least three good stories, implementing almost the same schematics are http://www.glacialwanderer.com/hobbyrobotics/?p=9,

Arduino and DS18B20 - 1-wire digital thermometer

Finally got this DS18B20 working. Actually three of them. And in two modes. Parasite power mode and main mode.
A 4.7K ohm resistor is the key.

Starting with the main mode, three wires are needed, as this sensor has three pins.
Datasheet is here http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf.
Connection is almost simple.
Pin 1 to Arduino ground
Pin 2 to Arduino digital input
Pin 3 to Arduino 5V
And a 4.7K resistor between pin 2 and pin 3

Works with three wires, as seen on the followind illustration.

Arduino, LED-s, LM35 and DS18B20 or temperature sensors.

Checked out my local electronics store http://www.oomipood.ee yesterday and got some stuff.

First, a breadboard and some wires. Also got me a soldering iron. Those are just for testing. At least I do not have to twist wires together now.

Then I thought, LED-s are cool for something, right? There is a nice site http://www.ladyada.net/learn/arduino/lesson3.html. So I did get 10 1/4W 1K ohm resistors, and some leds, specifically 2 red, 2 blue and 2 green. 3mm and somewhere near 2000-4000 mcd.

First Steps

Looking around, I decided to get one plain Arduino Duemilanove. Luckily a local dealer is near so I did place an order on it at 15:48 and made a bank transfer. At 17:03, less than 1.5 hours later I got an e-mail stating that I can get my hands on it around 19 o'clock. After a quick call, I got confirmation, that my transfer had gone through and couple of hours and a small trip later I was a enthusiastic owner of an Arduino Duemilanove.

Great thanks for http://ittgroup.ee/ and Zazou in particular.

Why Arduino

Why start playing with Arduino?

For a long time I was looking for a way to get temperature readings from outside of computer case and draw graphs of them. Specially with linux. There are a lot of ready to use temperature readers, but all of them have some flaws.

Fast way to create or assemble mdadm devices

Booting from cd and no /dev/md devices?

First, correct kernel modules are needed.
modprobe raid1
If configuration uses different raid, then a different raid module should be loaded. Be it a raid 0,5,6 or whatever.

Devices can be made then

mknod /dev/md0 b 9 0
mknod /dev/md1 b 9 1

and so on. As many of them as needed.
From this point on door is open for mdadm create,assemble or whatever is needed.

Creating a device goes like this:
mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda2 /dev/sdc2

Postfix, MySQL lookups and Temporary lookup failure

After setting up postfix to use mysql as lookup backend for alias or virtual or whatever table, everything seems ok. Mails are delivered.
But sometimes strange "Postfix SMTP server: errors from " e-mails are received. Usually more than one in the same second, then there can be no errors for days or weeks. Then they appear again. There is a "Temporary lookup failure" or "queue file write error" cited in those error e-mails but everything seems to work ok again. Even those e-mails that get error on first try get delivered on second try some minutes later.

One thing to look out for is

Squid: WARNING! Your cache is running out of filedescriptors

Sometimes squid stops working and "WARNING! Your cache is running out of filedescriptors" is logged in cache.log. Restart usually resolves that problem. Temporarily though.
This article is based on http://www.cyberciti.biz/faq/squid-proxy-server-running-out-filedescript... adding some Gentoo specific bits.

Squid, as a web cache should, holds a lot of files from internet on a local hard disk. It means that a lot of files are open at the same time. On busy servers this amount grows till the limit imposed by the operating system. Then no more files can be opened and squid seemingly dies.

LDAP from command line

Using LDAP from command line can be quite man (or info) expensive.

Usually LDAP is used for samba authentication, so it is set up something like this:

domain example.com is described in LDAP as base dn:
"dc=example,dc=com"

also two OU-s are usually present:
ou=groups for all groups and
ou=users for all users.
All this is case insensitive.

Selecting all groups from LDAP is done using ldapsearch.
ldapsearch -x -b "ou=groups,dc=example,dc=com" -h LDAP_host

This lists all groups.

Multiple internet connections in one box

Sometimes it is needed to have multiple internet connections in one Linux box. To distinguish it from a more common scenario - it means that multiple default routes are specified.
Multiple default routes is a bit of a dilemma - default route is loosely defined as 'if everything else fails send packets there'. By definition there can not be two or more last resort options.
One of those internet connections therefore should be designed as default, and configured normally, giving it IP address, default gateway and so on.
The rest should have its IP addresses configured.

Syndicate content