Posts tagged ·

electronics

·...

DC-to-DC converters

Comments Off

There are a number of different DC-to-DC converters out there, used to convert between different voltage levels. Ranging from the small but inefficient linear regulators to switched-mode converters like the buck converter that can achieve 95% or even higher efficiency. Among the switched-mode converters there are quite a few variations based on different but often similar circuit topologies: The buck converter is a step-down converter, and as the name suggest its output voltage will be reduced from its input. A boost (step-up) converter has similar design, but will do the opposite. A buck-boost converter combines the two so output voltage can be converted from both higher and lower input voltage. However, the traditional buck-boost converter inverts the polarity, so that the output voltage is of the opposite polarity than its input. A single-ended primary-inductor converter (SEPIC) (aka. buck-boost SEPIC) solves that problem, and delivers fixed non-inverted output throughout the range of its input voltage.

If this is all a bit confusing, have a look at Julian Ilett’s excellent YouTube videos and reviews: He covers the SEPIC buck boost converter, and shows how it seamlessly goes from 0.5 to 30 V out on a 9V battery. He shows how a 400W boost converter can drive a 100W LED pad, and he has a review of several different buck converters, in fact several reviews. He also has many interesting videos on driving different LED boards, including 50W and 30W RGB. You’ll really have to watch all his 140 videos!

When it comes to buying these, DealExtreme of course has a lot on offer, but here it seems like eBay has a bigger variety across its different sellers. I’ve already ordered this one, and expect to get more in the future. In particular, one of the variations on the ZXY6005 (D) power supply looks like a must-have in a hobby workshop.

Comments Off

Soil Moisture Sensor

Comments Off

Over at gardenbot.org Andrew Frueh has an interesting article on a DIY soil moister sensor. It is simply two large nails with wires attached. By measuring the resistance of the soil between the nails, he gets a crude measurement of how wet the soil is. The more water, the lower resistance. He points to a few problems with this approach, including temperature affecting the resistance, as well as salinity and pH levels playing a role. Furthermore, electrolysis and corrosion is a problem over time. Frueh has improved on the basic circuit by using a H-bridge to alternate the direction of the current for the readings. That way, the nails last longer.

A different approach to measuring soil moisture, is to measure the dielectric constant. An example of such a sensor is the commercial product VG400 from Vegetronix. It sells for $37, so it doesn’t scale to use it for many plants the same way as two nails does. The method is interesting though, with more basic information in this University of Cambridge module.

Comments Off

Adafruit order

Comments Off

Some items ordered from Adafruit a while back.

  • BeagleBone Black
  • GPIO Extender Cable for Raspberry Pi – 12″ long
  • MCP23017 – i2c 16 input/output port expander
  • MCP23008 – i2c 8 input/output port expander
  • Plastic Water Solenoid Valve – 12V – 1/2″ Nominal
  • Liquid Flow Meter – Plastic 1/2″ NPT Threaded
Comments Off

Tayda Electronics Order

1 comment

I previously wrote about Tayda Electronics, and their amazing prices on basic components. Just to try, I put in a small order, and it arrived by air less than two weeks later. The fact that you can order single components for the price of $0.01 is pretty amazing. Furthermore, they take the time and effort to put each type of item in its own little bag with a clear label. (As opposed to DealExtreme, which tend to lump things together and unlabelled.)

Mostly for my own reference, here’s the things I picked up. Some basic stuff, but most interesting was the MAX7219 LED segment driver for only $1.25. I’ll be using that in a project to control 64 LEDs, and hope to write about that shortly.

MAX7219 7 Segment + Dot Point -  Common Cathode serially interfaced display driver PDIP-24 LED 10mm Green Water Clear Ultra Bright - $0.10 LED 10mm Yellow Water Clear Ultra Bright - $0.10 LED 10mm Blue Water Clear Ultra Bright - $0.10 24 pin DIP IC Sockets Adaptor Solder Type - $0.08 0.1uF 50V 105C Radial Electrolytic Capacitor 5x11mm - $0.02 10uF 25V 105C Radial Electrolytic Capacitor 5x11mm - $0.02 Fuse Holder with Cover 5x20mm M205 PCB 15A - $0.16 Photo Conductive Cell Resistor LDR 650nm RADIAL KE-10720 - $0.24 40 Pin 2.54 mm Single Row Female Pin Header - $0.24 22pF 50V Ceramic Disc Capacitor - $0.01 10K OHM 1/4W 5% Carbon Film Resistor - $0.01 RGB LED 5mm Common Cathode - $0.27

3x3x3 LED cube with fewer wires

Comments Off

A few weeks ago, I mentioned that it would be possible to optimize the number of wires and components needed for a 3x3x3 single colour LED cube by using “the 9th bit” (the output pin, intended for daisy chaining) on a 8 bit serial in / parallel out shift register. Other examples of the 33 cube I’ve seen are simply pulling 12 wires (9 LEDs on each layer, and 3 layers) back to the Arudino. At that scale, it is of course feasible, but still, when it’s possible to get by with half, why not? So I put together a small 33 cube doing just that.

Previously, I made the claim that the 8 bit shift register retains 17 bits of data. I’ll have to revise that down, to 16.5 bit. It is possible, as already mentioned, to use the output pin as a 9th visible output, as seen in the images and code below. However, the value of the output pin is shared with the 8th element of internal register, thus 17 distinct bits are not realised. It becomes more clear when considering the timing diagram of the of 595. Below is an extract and cut-out from the Texas Instruments data sheet [PDF].

The diagram above is truncated both in the horizontal and vertical axis, to highlight the last cycles, when the output pin, denoted QH’ in the digram, gets its value. As can be seen, when the 7th pin, or QG, is shifted up one (the first red line, when RCLK goes from high to low), QH’ gets that bit set as well. Note that the internal states of the shift register is not shown here. In the next cycle, SRCLK is latched, and the internal value of the 8th pin is made visible on QH, on the yellow line. The result is, that either QG + QH’ are on at the same time, or QH + QH’. This was frustratingly easy to reproduce in code, but not what I wanted.

To control all the nine LEDs of a layer independently, I had to set the output pin after the other eight pins were latched. However, if cycling quickly, it would then not get enough time on, and thus would look very dim. The final trick was to insert a short delay after all pins were set correctly, as seen in the code and discussion on timing below.

For the construction of the cube, I used LEDs from a 100-pack for $4.30 from DealExtreme, soldered onto a small 4x6cm (14×20 points) PCB. Following “fruitkid101″ video instructions, I drilled holes for a template in a piece of wood. As it was all by hand, it turned out a bit skewed, but for this small project I found it didn’t matter so much. Next time I’ll be a bit more precise. Soldering the legs together turned out be easy. I made the spacing between the LEDs small enough for one cathode leg to reach across its two neighbours, which meant that I only had to bend the ones in the corner. I soldered the corners first, and then the ones in between, finishing off with the centre LED. Positioning the anode legs between the layers was a bit more tricky, but with a double bend, as seen in the picture below, it was easy to make the leg from the layer beneath stay close enough to solder to its upstairs neighbour. Since the joints were for both the electrical contact, as well as the structural, I applied quite a bit of solder.

The interface to the Arduino is through the three direct pins which controls the sinks for each layer, and three pins for data, clock and latch of the shift register. The overview can be seen in this picture, and below. The small breadboard with the shift register also contains a 100 Ohm resistor for each pin, including the output pin.


As mentioned above, part of the motivation for this project was to control the cube with fewer pins, and use the output pin of a shift register for the 9th LED. That led to another interesting revelation in the code, and how to control brightness. As seen in the snippet below, which includes the display() method and the external fields used, the first inner for-loop for the shift register is all normal. It shifts the first 8 bits, with Most Significant Bit in the 8th element (index 7) of the display buffer buf[]. Surrounding that for-loop is the latch, however, notice that on the first line of the outer for-loop, the layer pin is set HIGH, which means, it is turned off. Before the layer we operate is turned on, the output pin is set to the value of buf[8] (and equivalent for higher layers). This is done within the second inner for-loop, inside the if-block. Strictly speaking, the if was not necessary; it would have been fine to shift out the extra bits every time.

Only after every pin is set to its correct state, is the layer turned on and the LEDs lit. However, if doing this without a delay, the LEDs would seem very dim, or almost off. Even if running the display() method only takes 400 micro seconds without the delay, for a good 2500 iterations per seconds, the problem would be that the LEDs would be turned off most of the time. To fix that, the delay is inserted, which holds the LEDs for a little while per iteration over a layer. With a one millisecond delay, the full method takes 3.4 ms, and can be executed ~300 times per second or a 300 Hz refresh rate of full cube.

However, with a delay of only 1 millisecond the LEDs are still somewhat dim. The fraction of time where the LEDs are off is still significant: For each layer 400/3 = 133 µs off vs. 1000 µs on, or about 12% of the time. If the delay is increased to 2 milliseconds, that ratio goes down to 6%, and the LEDs are noticeable brighter. The refresh rate goes down to ~150 Hz, but we are still far from the 50 Hz limit which is required to avoid flickering. In fact, we can go all the way up to a 6 ms delay before the limit is near (1000 ms / 50 / 3 = ~6 ms). However, it is hard to notice a difference between 3 and 6 ms delay. It would have to be measured. The lesson learnt then, is that it is not the refresh rate which matters the most when multiplexing LEDs, but rather the ratio of time the LEDs are on. Furthermore, with a 16 MHz MCU like the ATmega328, there is plenty of room for doing other stuff, and little need for premature optimization of code.

Future work will include utilizing the Arduino timer library for controlling the display buffer. Currently, that bit of the code is rather clunky. I would also like to experiment with fading and controlled blinking. Again, the timer library will be useful, but I’d probably also use the buffer to hold an intensity value, rather than just on/off. Also, I would like to measure the brightness with the different delays discussed above. One way would be using an LDR (light dependent resistor), but I might also look at the cheap $30 lux meters from DealExtreme. Finally, I’ll of course have to make some interesting patterns and animations, which should lead to an API for some level of abstraction. There’s lots to do!


Extract from code. See the full file for further details and GPL 3 license.

// Digital output pins

const int data =  5;
const int latch = 6;
const int clock = 7;

const int layer0 =  9;
const int layer1 = 10;
const int layer2 = 11;

const int layers[3] = {layer0, layer1, layer2};

const int outputPinCount = 6;
int outputPins[outputPinCount] = {
  data, clock, latch, layer0, layer1, layer2};

// Frame buffer
const int lights = 27;
int buf[lights];


void display() {
  for(int l = 0; l < 3; l++) {
    // Turns the layer off
    digitalWrite(layers[l], HIGH);

    // Shifts out the first 8 bits
    digitalWrite(latch, LOW);
    for(int i = 0; i <= 7; i++) {
      digitalWrite(clock, LOW);
      int bit = buf[l*9 + 7-i];
      digitalWrite(data, bit);
      digitalWrite(clock, HIGH);
    }
    digitalWrite(latch, HIGH);

    // Shifts 9 more bits to set the output pin
    if (buf[l*9 + 7] != buf[l*9 + 8]) {
      digitalWrite(data, buf[l*9 + 8]);
      for(int i = 0; i <= 8; i++) {
	digitalWrite(clock, LOW);
	digitalWrite(clock, HIGH);
      }
    }

    // Turns the layer on, and hold for 3 ms
    digitalWrite(layers[l], LOW);
    delay(3);
    // Turns the layer off again
    digitalWrite(layers[l], HIGH);
  }
}


Comments Off

Tayda Electronics

Comments Off

For a long time, Sparkfun and DealExtreme, and to a lesser extent Digikey and Adafruit have been my favourite shops for electronic components. Now I might have just found a new one: Tayda Electronics.

Their prices are in a completely different range than the aforementioned shops. Basic components like resistors and capacitors are one or two cents, or sometimes even less. Typically, you’d have to buy in bulk of 100 or even 1000 to get those prices, but at Tayda, you can order a single one, if you like.

Other highlights include 10mm LEDs like the ones I mentioned earlier, for 10 cents each (vs. $1 or more that I paid). In fact, the specs promise 14000-16000 mcd vs. the 5000 mcs I tried. I’ve ordered a few, and will post details later. Finally, the reason I came across their site: The Maxim Max7219 LED driver for $1.25 (vs. $10 or more at Sparkfun and others). That was really great news, since the magic seems to have gone out of chip I had, but disappointingly without magic smoke.

Their minimum ordering is $5, which might actually be difficult to reach with those prices. I’ve just put an order, and they promise same they shipping and about two weeks delivery with standard mail (at only ~$2 shipping cost). Let’s see how it goes.

Comments Off

Sparkfun orders

Comments Off

Here’s a list of items I’ve ordered from Sparkfun over the years. Mostly for my own reference than anything else, and maybe not of much interest to others.

 Stepper Motor - 125 oz.in (200 steps/rev)  Stepper Motor - 68 oz.in (400 steps/rev)  Hook-up Wire - Red  Liquid Pump - 350GPH (12v)  Arduino Uno - R3 Nut - Nylon (4-40 Stackable 10-Pin Header AVR 8 Pin 10MHz 1K 4A/D - ATtiny13 10 segment LED gauge bar P-Channel MOSFET 60V 27A N-Channel MOSFET 60V 30A Jumper Wire - 0.1 4-pin Voltage Regulator - 5V Electrolytic Decoupling Capacitors - 100uF/25V JST Right-Angle Connector - Through-Hole 2-Pin JST Right Angle Connector 5 x Rectifier 1N4007 3 X Transistors - NPN 2N3904 3 X Transistors - PNP 2N3906  XT60 Connectors - Male/Female Pair JST RCY Connector - Male/Female Set (2-pin) Resistor Kit - 1/4W (500 total) RF Link Transmitter / 434 MHz RF Link Receiver / 434 MHz  BigTime Watch Kit  Capacitor Ceramic 22pF  Tweezers - Straight (ESD Safe)  Crystal 16MHz  Ceramic Resonator 16MHz  AVR 28 Pin 20MHz 32K 6A/D - ATMega328  ATmega328 with Arduino Optiboot (Uno)  STK500 Compatible USB Programmer  Miga NanoMuscle  Ribbon Cable - 6 wire (15ft)  PIR Motion Sensor  Stepper Motor with Cable  Hook-up Wire - Red  Light Pipe - Clear Core (6mm  Light Pipe - White Core (6mm  Light Pipe - White Core (3.5mm  I2C EEPROM - 256kbit  Heat Shrink Kit  Hook-up Wire - Yellow  Ribbon Cable - 10 wire (3ft)  Ribbon Cable - 6 wire (3ft)  Hemostats - Straight  Solder Wick #2 5ft. - Generic  6 Pin Right Angle Female Header  Hook-up Wire - Black  XBee Explorer Dongle  RFM22B-S2 RF Transceiver Breakout Board  RF Link Receiver - 4800bps (434MHz)  RF Link Transmitter - 434MHz  EasyDriver Stepper Motor Driver  Small Stepper Motor  Temperature Sensor - LM335A  IC Hook with Pigtail  555 Timer  XBee 1mW Chip Antenna - Series 1  Infrared Emitters and Detectors  Open Logic Sniffer - Probe Cable Kit  IC Hook to IC Hook Cables  IR Receiver Breakout DIP Sockets Solder Tail - 28-Pin 0.3 DIP Switch - 8 Position Hook-up Wire - White 74HC238 - 3 to 8 Line Decoder LED Display Driver (8-Digit) - MAX7219CNG Jumper Wire - Female to Female Connector 2x5 Pin IDC Ribbon Cable AVR Programming Cable Jumper Wire Kit Jumper Wires Premium 6 Button Pad 4x4 - LED Compatible LED Matrix - Serial Interface - Red/Green/Blue Arduino Mega Arduino Main Board Button Pad Controller SPI Super Bright LED - White - 1pcs Super Bright LED - Yellow - 1pcs Super Bright LED - Green - 1pcs Infrared LED - 950nm Triple Output LED RGB - Diffused - 100pcs Super Bright LED - Red - 1pcs Infrared LED - 850nm Super Bright LED - Blue - 1pcs XBee Explorer Regulated

Comments Off

Large bright 10 mm LED

1 comment

Earlier this year, I found some uncommon LEDs at Clas Ohlson: Large bright 10mm LEDs (note that the link takes you to selection of different kinds; I got the “ultra white”). As seen from the pictures below, it is unusually large, compared to the 5mm LEDs which are most common. At 5000 mcd it is also very bright, and can easily be used as a flash light. Its forward voltage is 3.2 V, so with three AA batteries and a ~68 Ohm resistor, you’re all set.

I used a macro lens to take some of the pictures, and I found this one particularly interesting (make sure you zoom in 1:1). You can very clearly see the wire bond between the anvil and post. With most LEDs, this is usually too small to get a glimpse of. In this picture, you can get an idea of its cone. Like most LEDs, it is very directional, and thus flash-light idea.

8 bits shift register – 17 bits of data

1 comment

Although the serial-in, parallel-out shift register, aka. SN74AHC595, SN74AHC594 or just “595″ / “594″, is an easy component to hook up and use, it might not be immediately obvious what’s going on inside the chip. At least it was not to me. Therefore I found Mike Szczys’s demonstration very enlightening. He shows how to drive the shift register manually, all without any micro-controller. The functional pins of the register is hooked up to buttons, so he can slowly go through the sequence of setting the data bit, clocking or shifting that onto the register, and then closing the latch to show the result on a line of LEDs.

Combined with the data sheet for the 595, it becomes more clear how the chip works: There are two separate registers on the chip; the visible storage register, and the internal shift register. When the latch (aka. “RCLK”, or “ST_CP”) goes high, the bits from the shift register is copied over to the storage register, and becomes visible on the external pins.

So that makes for 16 potentially different bits of information. However, as the title suggest, there’s one more available: It’s the output pin, typically used to daisy chain multiple shift register chips together. Even though it is part of the internal shift register, which thus consists of 9 bits, it is externally visible, and retains its state after the latch is closed. The drawing below shows this, with nine yellow external dots indicating visible bits, and eight blue dots indicating internal bits, for a total of 17 bits.

In the figure I’ve marked the QH’ as externally visible, even though it is part of the internal shift register. There probably aren’t many applications in which you’d use that as an active output, but one that comes to mind is a 3x3x3 LED cube. In a typical setup, you’d have three layers of 9 LEDs, for 12 wires altogether. Instead of controlling each LED in a layer individually, you could use a shift register, however you’d be one pin short (or 7 pins wasted if using two chips). So why not use the output pin for the 9th LED?

The programming would work as normally when addressing a shift register, but instead of shifting out 8 bits, you’d shift 9. The only problem would be that the 9th LED connected to the output pin would see the previous bits flying past as new bits are shifted onto the register. This might not be a big problem, as cycling the layers will probably be too fast to notice. If it is an issue, one could just disable all layers while bits are shifted out, and turn on only the relevant layer when done. I think this is a small experiment I’ll have to make, so stay tuned.

8 bits Shift Register – 74HC595

Comments Off

On the heals of the success with the Arduino kit last week, I went ahead and bought some extra parts: a 74HC595, 8 bits Shift Register, some red/green/orange LEDS (TLUV5300), and a bigger bread board. I also got some resistors, however, the proved to be wrong. The guy in the shop suggested 15 Ohm for 5 V, however, all the LED resistor calculators I looked at suggested 100-120 Ohm, I I’ll get some new ones tomorrow.

So for the application. Not very fancy so far, but great fun to see the register chip working so easily. Based on this code example by Carlyn Maw and Tom Igoe, and the tutorial at SparkFun (for their 74HC595 offering), I hacked away and came up with a "binary counter" of sorts. Here’s some pictures, and the code that went with it. I modified the example to use the shiftOut Arduino library function.

On the breadboard, yellow is +5V, and brown in ground. The extra breakaway at row 25 does nothing but support the 4 wire sound cable I used hook up to the Arduino. From left to right, Arduino to 74HC595: 12 -> SH_CP (clock), 11 -> ST_CP (latch), 9 -> DS (data). Finally, don’t be confused by the series of resistors to the right. I wanted to see the difference between 15 and 90 Ohm on one of the LEDS; it was almost not noticeable.


// Based on:
// http://arduino.cc/en/Tutorial/ShftOut13

//Pin connected to ST_CP of 74HC595
int latchPin = 11;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 9;

//holders for infromation you're going to pass to shifting function
//byte data;

void setup() {
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);

//function that blinks all the LEDs
//gets passed the number of blinks and the pause time
blinkAll(2,500); 
}

void loop() { 
for (int j = 0; j < 255; j++) {
write(j);
}

}

void write(byte data) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, data);
digitalWrite(latchPin, HIGH);
delay(1000);
}

//blinks the whole register based on the number of times you want to 
//blink "n" and the pause between them "d"
//starts with a moment of darkness to make sure the first blink
//has its full visual effect.
void blinkAll(int n, int d) {
write(0);
for (int x = 0; x < n; x++) {
write(255);
write(0);
}
}
Comments Off

Arduino on Ubuntu 8.04

Comments Off

A few days ago I set up the Arduino development kit on Fedora 11. Here the steps for Ubuntu 8.04 follow, based on this. I was using a slightly custom setup, so the Java install is assumed, and the extra repository suggested here (Problems Ubuntu 8.04 amd64) was not added. Instead I download the packages directly. Furthermore, I wound that it was better to go for a setup in my home directory, as you frequently have to tweak libraries and other files.

Finally, this includes a new library for DHCP by Jordan Terrell.


sudo apt-get install gcc-avr avr-libc binutils-avr avrdude uisp

# Add your personal user to these groups: dialout, uucp
sudo emacs /etc/group

cd ~
mkdir arduino
cd arduino

# Download stuff for manual installation.
wget http://arduino.googlecode.com/files/arduino-0017.tgz
tar zxvf arduino-0017.tgz

wget http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip
unzip rxtx-2.2pre2-bins.zip

wget http://www.thepotterproject.net/NewSoftSerial%20JL.zip
unzip "NewSoftSerial JL.zip"

wget http://www.thepotterproject.net/Picaso.zip
unzip Picaso.zip -d Picaso

wget http://blog.jordanterrell.com/public/Arduino-DHCPv0.4.zip
unzip Arduino-DHCPv0.4.zip -d dhcp

# Use the new avrdude
cd arduino-0017/hardware/tools; rm avrdude avrdude.conf; ln -s /usr/bin/avrdude; ln -s /etc/avrdude.conf; ll; cd -

# Use the new RXTX
cd arduino-0017/lib; rm librxtxSerial.so RXTXcomm.jar; ln -s ../../rxtx-2.2pre2-bins/x86_64-unknown-linux-gnu/librxtxSerial.so; ln -s ../../rxtx-2.2pre2-bins/RXTXcomm.jar; ll; cd -

# Make NewSoftSerial, Picaso, and Dhcp libraries available
cd arduino-0017/hardware/libraries; ln -s ../../../NewSoftSerial; ln -s ../../../Picaso; ln -s ../../../dhcp; ll; cd -

That was the basic setup, which should hopefully work in most cases. However, for gcc version 4.2.2 there is a special issue with the gcc-avr package. I’ll download it and update manually.


[back in 5...]

Comments Off

Ethernet2VGA (Arduino w/ethernet -> microVGA PICASO)

2 comments

I recently bought an Arduino starter kit along with the Ethernet "shield". In addition, I got a uVGA-PICASO-MD1 Graphics Controller chip, which attaches on to the PICASO Universal Base Board. The total price was around 130 Euros. And the goal: To create a device which takes Ethernet input and gives VGA output. The use case would be typical demo or dashboard screens, which need no user interaction, and to avoid the 3GHz/4GB RAM laptop or desktop which usually drive them.

The software installation on Fedora 11, 64 bit was relatively pain less. There are a few steps to follow, and also some special tricks for 64 bit. The gist of it, went something like this:

# Install the RPMs available from Fedora repositories.
yum install java-1.6.0-openjdk avr-gcc avr-binutils avr-libc avr-libc-docs avr-gcc-c++ avrdude rxtx uisp

cd /usr/local
mkdir arduino
cd arduino

# Download stuff for manual installation.
wget http://arduino.googlecode.com/files/arduino-0017.tgz
tar zxvf arduino-0017.tgz

wget http://rxtx.qbang.org/pub/rxtx/rxtx-2.2pre2-bins.zip
unzip rxtx-2.2pre2-bins.zip

wget http://www.thepotterproject.net/NewSoftSerial%20JL.zip
unzip "NewSoftSerial JL.zip"

wget http://www.thepotterproject.net/Picaso.zip
unzip Picaso.zip -d Picaso

# Use the new avrdude
cd arduino-0017/hardware/tools; rm avrdude avrdude.conf; ln -s /usr/bin/avrdude; ln -s /etc/avrdude/avrdude.conf; ll; cd -

# Use the new RXTX
cd arduino-0017/lib; rm librxtxSerial.so RXTXcomm.jar; ln -s ../../rxtx-2.2pre2-bins/x86_64-unknown-linux-gnu/librxtxSerial.so; ln -s ../../rxtx-2.2pre2-bins/RXTXcomm.jar; ll; cd -

# Own the examples dir, for compiling as user
chown -R myuser:myuser arduino-0017/examples

# Make NewSoftSerial and Picaso libraries available
cd arduino-0017/hardware/libraries; ln -s ../../../NewSoftSerial; ln -s ../../../Picaso; ll; cd -

# Add your personal user to these groups: dialout, uucp, lock
emacs /etc/groups

And that’s that… Thanks Sebastian Tomczak for his blog entry on the same topic. And also thanks to Jonathan Laloz for "The Potter Project", where he provides the NewSoftSerial and Picaso libraries. Without them, I would have struggled a lot more. Thanks to them, I now have a working network server on the Arduino which prints the input text through the VGA chip. Using nc, it be comes a "remote screen".

nc 192.168.2.150 9090
Hello World!![ENTER]

Here’s my program as it looks tonight:

#include <Picaso.h>
#include <NewSoftSerial.h>
#include <Ethernet.h>

//Define the Picaso object
Picaso VGAOut;

// Set MAC, IP, and start server on port.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 150 };
Server server(9090);

void setup() {  
// Initialise the uVGA device, Set the resolution to 640 x 480
VGAOut.Init(); VGAOut.SetResolution(1);

// Init Ethernet shield
Ethernet.begin(mac, ip); server.begin();
}

// Blink some LEDs attached to digital pins 4 and 5
void blinkTwo() {
digitalWrite(4, ON); digitalWrite(5, ON); delay(50);
digitalWrite(4, OFF); digitalWrite(5, OFF); delay(50);
}

void loop() {
// Run the demo once, just to make sure there's something which works.
VGAOut.Demo(); VGAOut.Clear();

// Listen for incoming text over Ethernet.
Client client = server.available();
if (client) {
blinkTwo(); blinkTwo();

int x=10; int y=10;
while (client.connected()) {
if (client.available()) {
digitalWrite(5, LOW);

// Draw character by character from the input stream.
char c[2] = {(char)client.read(), '\0'};
VGAOut.DrawText(x, y, 1, c, VGAOut.GetRGB(255, 255, 255));

delay(30); digitalWrite(5, HIGH); delay(30);

// Wrap the lines. (I guess I can fit a bit more here...)
x++;
if(x > 40) { x = 0; y++; }
if(y > 40) { y = 0; }
}
}
client.stop();
} else {
// If client was connect, turn on the red light.
digitalWrite(4, OFF); digitalWrite(5, ON);
}
delay(5000);
}