Posts tagged ·

arduino

·...

Proto boards and microcontrollers – an overview

Comments Off

MAKE magazine has a nice write-up of several of the popular micro controllers, prototyping and hobby boards out there. 36 of them in total. Of course, that covers only a fraction of all the brands, models and variations. That list runs much much longer.

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

DealExtreme orders

Comments Off

Various items ordered from DealExtreme.

GH-10W 10W 430lm 9-LED Red + Blue Light Plant Grow Light Module - Silver + White (7.5~8V) Jtron 0.36 8-Channel 5V Relay Module Shield for Arduino (Works with Official Arduino Boards) JY-MCU 5V 3V IIC UART SPI Level 4-Way Converter Module Adapter HSYY01 Water Pump Motor w/ Hose - White + Silver 20906 6mm Silicone Hose - Translucent White (5.44m-Length) Aquarium Fish Tank Flexible Silicone Air Line Tube - Black (18m) E5HT Aquarium Air Tube - Transparent Blue (10m) Aquarium Fish Tank Tubing Straight Connector T Splitter for 4mm Air Line (24 PCS) E5YK Aquarium Fish Tank 1-to-6 Air Splitter - White USB Powered Flexible Neck 10-LED White Light Lamp - Blue (27cm) 4-Port High Speed USB 2.0 Hub - Black (60cm-Cable Length) Mini USB 4 Ports Hub 4-Port USB 2.0 HUB w/ Independent Switch - Black 5V 2A Universal Power Adapter Charger - Black (AC 100~240V / EU Plug / 3.5 x 1.35mm) Raspberry PI Acrylic Case - Transparent Protective Neoprene Bag Case for DSLR Camera Lens - Black (Size XL) Protective Neoprene Bag Case for DSLR Camera Lens - Black (Size L) HSYY01 Water Pump Motor w/ Hose - White + Silver W3-9 Immersible Water Pump for Miniature Garden - Off-white SZF280 PVC Mini Water Pump Motor - Beige Miniisw SW-015 1.5W Polysilicon Solar Panel - Black Miniisw SW-008 0.8W Solar Powered Battery Panel Board - Black Protective Jellyfish Pattern Silicone Back Case for LG E960 Nexus 4 - Multicolored Replacement Sound and Music Activated Spectrum VU Meter EL Visualizer - Smile Face (4*AAA) 5.5 x 2.5mm Plug AC Power Adapter - Black (AC 100~240V / EU Plug / 135cm-Cable) 1.5 5.5 x 2.5mm Plug AC Power Adapter - Black (AC 100~240V / EU Plug / 135cm-Cable) HDMI Female to Micro HDMI Male Adapter 40-Compartment Free Combination Plastic Storage Box for Hardware Tools / Gadgets - Translucent White 24-Compartment Free Combination Plastic Storage Box for Hardware Tools / Gadgets Panel Mount 10A 250V Fuse Holder - Black (5-Pack) Optical Triple Triangular Glass Prism Spectrum - White Dupont 4-Pin Female to Female Extension Wire Cable for Arduino (40cm / 10-Piece Pack) Dupont 4-Pin Male to Female Extension Wire Cable for Arduino (40cm / 10-Piece Pack) Universal DIY Bakelite Plate PCB Board - Brown (2-Piece Pack) Universal Glass Fiber PCB Board for DIY Project - Brown Prototype Universal Printed Circuit Board Breadboard - Brown (5-Piece Pack) Nano V3.0 AVR ATmega328 P-20AU Module Board + USB Cable for Arduino Nylon PP6 DC 12V 50mA Tact Switch - Black (100-Piece Pack) 1N4007 1000V 1A Unilateral Rectifier Diodes Set - Black + Silver (50 PCS) LM7805L 5V Voltage Regulator ICs (10 PCS) 2.54mm 1x40 Pin Breakaway Straight Male Header (10-Piece Pack) GP LR44 A76 1.5V Cell Button Batteries 10-Pack 5 x 20mm Glass Tube Fuse Set - Silver (100 PCS) LCD Keypad Shield for Arduino Duemilanove & LCD 1602 (Works with Official Arduino Boards) Protective Plastic Case for 3.5 635~645nm 800~1000MCD 5mm LED - Red (100-Piece Pack) 510~520nm 800~1000MCD 5mm LED - Green (100-Piece Pack) S1306 8-in-1 Gradual ABS Lens Filters + Lens Mount + Ring Set for 77mm Lens Camera - Black Unique Black 4 Series Armed Notebook - Rambo Knife (60-Page) Convenient Rectangle Sticky Note Memo Pads (4 x 100 Pieces) Stainless Steel 1/4 C2-07 Creative Inflatable Shoe Boot Support Spreader - Milk White (Pair) Double-Sided Glass Fiber Prototyping PCB Universal Board (12-Piece Pack) Double-Sided Glass Fiber Prototyping PCB Universal Board (3 x 7 / 5-Piece Pack) Prototype Universal Printed Circuit Board Breadboard - Green + Silver 3mm & 5mm Light-emitting Diode - Green + Red + Yellow (100-Piece Pack) Breadboard Jumper Wires for Electronic DIY (65-Cable Pack) 4 Channel 5V High Level Trigger Relay Module for Arduino (Works with Official Arduino Boards) 2-Channel Relay Shield Module for Arduino (Works with Official Arduino Boards) AMS1117 5V Power Supply Module Emolux 62mm Multi-Coated UV Lens Filter - Black Sound and Music Activated Multi-Mode Flashling EL Hearts T-shirt - M (3*AAA) Silica Gel Reusable Moisture-Proof Bead Desiccant - Blue Male + Female DC Power Converter Connector Adapters w/ Terminal Blocks For CCTV Camera (Pair) Universal Heavy Duty 6F22 9V Battery DSTE NB-7L Replacement 7.4V 1200mAh Battery for Canon G10 / G11 - G12 / SX30 IS - Grey 1/4 Universal Aluminum Alloy Straight Flash Bracket for Camera - Black Universal Aluminum Alloy Tripod Bracket for Speedlight / Camera- Black Universal Handheld Jar Opener White Magic Beans with Assorted Messages (10-Pack Growing Plant) Genuine Acecamp 2429 20L Outdoor Water Resistant Dry Bag - Yellow 1000mA Car Cigarette Powered USB Adapter/Charger (DC 12V/24V) DIY 433MHz Wireless Receiving Module for Arduino (Works with Official Arduino Boards) 433MHz Wireless Transmitter Module Superregeneration for Arduino DIY 16-Key AD Keypad Module - Blue 4 x 4 Matrix Switch Module - Green ES-71 II Lens Hood for Canon Mini Prototype Printed Circuit Board Breadboard for Arduino (5 PCS) Ceramic Capacitor for DIY Electronic Circuit - Red (270-Piece Pack) Solderless Breadboard with 400 Tie-Point (White) USB to RS232 Serial Port Adapter (Transparent Green) FreArduino Soil Humidity Sensor for Arduino (Works with Official Arduino Boards) Double-Sided Glass Fiber Prototyping PCB Universal Board (3 x 7 / 5-Piece Pack) DIY HR-202 Humidity Detection Sensor Module - Blue Aluminum Alloy Straight Hot Shoe Flash Bracket for Camera - Black Flash Diffuser for Canon 580 EX / EX II / YongNuo YN560 / YN565 Speedlite (3 PCS) HT RJ45 RJ11 Cable Tester Stainless Steel 1/4 Mini USB 2.4GHz 150Mbps 802.11b/g/n WiFi Wireless Network Card Adapter - Black USB 2.0 2.4GHz 802.11b/g/n 150Mbps WiFi/WLAN Wireless Network Adapter Ultra-Mini Nano USB 2.0 802.11n 150Mbps Wifi/WLAN Wireless Network Adapter 6.3V 3300uf Aluminum Motherboard Capacitors (20-Piece Pack) DIY ZIF DIP IC Socket Set - Green (8 PCS) Solder Tip Refresher 3-Pin Triode Transistor for DIY Project - Black (20 x 10-Piece Pack) Aluminum Electrolytic Capacitor for DIY Project (120-Piece Pack) DisplayPort DP Male to HDMI Female Adapter Cable - Black (15CM) Gold Plated 1080i HDMI V1.3 M-M Connection Cable (1M-Length) 11x12 132-Panel Brain Teaser Magic IQ Ball Micro USB To HDMI MHL Adapter - Black Gold Plated HDMI Male to DVI 24+1 Female Adapter 62mm Digital Camera Lens Cover Digital Camera Lens Cover/Cap with Strap for Canon (62mm) 7.4V 1200mAh Lithium Polymer Lipo Battery Pack for Lama or 4-CH R/C Helicopters HC-SR04 Ultrasonic Sensor Distance Measuring Module 4 x AA Battery Case Holder (3-Pack) Stainless Steel Triple Razor Blade Set (4-Pack) USB 2.0 Smart ID Card Reader - Silver 30cm Breadboard Wires for Electronic DIY (40-Cable Pack) Cree XR-E Q2 Emitter with Star 3W LED Emitter on Star (Multicolored RGB)

Comments Off

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

16×2 LCD and button shield

Comments Off

I recently picked up this 16×2 character LCD and button shield from DealExtreme. It is similar to the Hitachi based shields and displays sold elsewhere, but with a slightly different pin-out. It still fits right onto the Uno or Duemilanove. For only $6 it’s almost a must in any project toolkit. What’s more, it’s compatible with the LiquidCrystal Arduino library, and very easy to get started with. Just note the modified pin connections, and you’re set to go.

The sketch below will display “hello world”, a counter, and the value of the button presses on the screen. Furthermore, you can use the up and down button to adjust the back-light brightness. Just an example; I’m sure there are unlimited uses for this screen.

Please note, the button values was what I read from my shield, through the analog pin. Although it seems very consistent, other shields might give different readings. It’s probably a good idea to shift off the two least significant bits to allow for some leeway.

// Code under GPL; please see full file for details.

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
  pinMode(10, OUTPUT);  // for backlight adjustment
  
  lcd.begin(16, 2);

  lcd.print("Hello World!");
}

int button_value;

int light = 100;

void loop() {
  lcd.setCursor(0, 1);
  lcd.print(millis()/1000);
  
  button_value = analogRead(A0);
  
  if (button_value == 132)
    light = min(light + 1, 255);
    
  if (button_value == 306)
    light = max(light - 1, 0);
  
  analogWrite(10, light);  

  String tmp = " ";
  tmp += light;
  tmp += " ";
  tmp += button_value;
  tmp += "   ";  // erase previous digits

  lcd.setCursor(4, 1);  
  lcd.print(tmp);
}

Comments Off

Simple multiplexing with two shift registers

Comments Off

There are many ways to drive multiple LEDs, which in sum would require more IO pins and more current than is available on the control chip. The simplest way is perhaps multiplexing, and in this example I’ve used two 8 bits serial-in/parallel-out shift registers to achieve that. I’ll skip the theory for now, but I think the structure and layout of the LED matrix is worth highlighting.

Below the 64 LEDs are shown in a grid of 8 columns and 8 rows. To light a specific LED, there has to be a potential difference between its two pins, thus the pin connected to a column should be set HIGH, and the other row pin to LOW. To individually control all the LEDs, the active row is cycled very quickly. For each step of the cycle, the specific LEDs of that row is set, and then changed for the next row. If done quickly enough (typically at least 50 times per second; 50 Hz), it will appear as if all the LEDs are always on.

The example in the figure shows register A set to 0000 0011, for the two right-most LEDs. Register B is set to 1011 1111, thus activating the second row from the top. In theory, the settings of the two registers could have been reversed, and then the two bottom LEDs of the second column had been lit. However, since LEDs are directional, and does not let current through when the polarity is reversed, this is not possible (at least not with the simple diagram shown below).

Please note that the drawing glosses over a few details: First, the pin-placements of the chips are not as per specification; the right most pin, in case of register A and top for B, are in fact ground. Pin 0, for the first bit of the register is actually on the opposite side (which is always rather annoying and confusing). See this post for details.. Secondly, there should be an array of resistors: one between each column line and chip A (see this picture as an example). Finally, although it is possible to drive the LEDs from the Arduino, as seen in the pictures further down, external power will improve brightness, thus a set of resistors would also be required.

8x8 LED matrix with two shift registers

Once the LED side of the registers are hooked up, there are a few wires to connect to the Arudino: Each shift register needs at least its data-in, clock and latch pins connected (plus pins which need high or ground). The data pin sets the next bit to be pushed onto the register. The clock pin does one shift on its transition to HIGH. Finally, the latch pin copies the content of the internal shift register onto the externally visible storage register. See Mike Szczys’s video for details on how this works.

There are a few ways these three wires from each register can be hooked up. One way, as seen in the pictures and code below, is to connect each data, clock, and latch pin separately, for a total of six IO pins on the Arduino. It is also possible to sync the latch of both registers, thus combining both of these pins onto a single IO pin. The code below could have benefited from this optimization (see the comments in the code). Secondly, it is possible to sync both latch and clock pins of both registers, and shift out two bits in parallel. In code, this would thus only required a single for-loop, however, an extra call to digitalWrite() (for the second data bit) would be required. I’ve not measured what difference this makes, so any insight here is welcome. Finally, it would be possible to daisy chain the two shift registers together. This would only require three IO pins, however would waste a lot of time shifting redundant bits onto the second shift register.

// Code under GPL; please see full file for details.

// Digital pins for two independent shift registers.
const int dataA =  5;
const int latchA = 6;
const int clockA = 7;

const int dataB =  8;
const int latchB = 9;
const int clockB = 10;

const int outputPinCount = 6;
const int outputPins[outputPinCount] = {
  dataA, clockA, latchA, dataB, clockB, latchB};

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

void setupPins() {
  for (int i = 0; i < outputPinCount; i++) {
    pinMode(outputPins[i], OUTPUT);
  }
  clearAll();
}

void setup() {
  Serial.begin(9600);
  Serial.println("reset");

  setupPins();
  setAll(1);
}

void loop() {
  display();
}

void clearAll() {
  setAll(0);
}

void setAll(int v) {
  for (int i = 0; i < lights; i++) {
    buf[i] = v;
  }
}

void display() {
  for(int grp = 0; grp < 8; grp++) {
    digitalWrite(latchB, LOW);

    // Writes a single bit to the B register.
    // 0 means that group is active / on, 1 means off.
    // At the beginning of the loop, one 0 is shifted
    // onto the first bit, and later shifted upwards
    // as 1s turn the previous groups off.
    digitalWrite(clockB, LOW);
    digitalWrite(dataB, grp == 0 ? 0 : 1);
    digitalWrite(clockB, HIGH);
    digitalWrite(latchA, LOW);

    // Depending on the arrangement of the LEDs, and which
    // bits are conceptually most/least significant, shift in
    // increasing or reverse order.
    for(int i = 7; i > -1; i--) {
      digitalWrite(clockA, LOW);

      int bit = buf[grp * 8 + i];
      digitalWrite(dataA, bit);

      digitalWrite(clockA, HIGH);
    }

    // Here and above, both latches are set to the same
    // value at the same time, this could have been combined
    // onto the same IO pin.
    digitalWrite(latchA, HIGH);
    digitalWrite(latchB, HIGH);
  }
}

In the pictures below, the LEDs are on a single line, rather than in a grid, however, the grouping seen above still applies. Furthermore, each LED in my project is dual colour, so there only 32 of them, but still 64 pins to control. On my LED "breakout board" I've added a double set of headers for each pin on each LED, so I can easily connect them in any combination. The 8 pin jumper-wires from this post really came in handy.

For my custom dual shift register breakout board, I used this 4 x 6 cm PCB, and made the pins I needed available through headers. Please note that I made a mistake when placing the output headers, and for some reason assumed the pin on the opposite side was Q8 or QH, rather than 0 / A. On the shift register without resistors, I was able to correct this because there was room, however the other one was flush with the side, so it had to be corrected in the wiring (which makes some of the pictures below misleading). This board is somewhat similar to what you can buy pre-made from DealExtrme, however their version is using two daisy chained shift registers, and as mentioned, this will waste time when cycling the groups of LEDs.

Finally, note again that although it is possible to drive all this from the Arduino, even when powered over USB, better performance will be achieved with a higher powered external brick. Also, note that it is possible to mess up the code, so that all LEDs are turned on at the same time, and potentially draws more than 1 A. I shall not be held liable for what ever damage that might cause to hardware or people. Please see the license in the code for details.

First, some "making of" pictures, soldering all the LED pins and headers.

And here's the final product, well at least for now.

Comments Off

8-pins jumper wires

1 comment

For a somewhat long running project, I was looking for 8-pin jumper wires, and had even gotten some headers and ribbon cable to see if I could make them myself. However, with the prospect of stripping, crimping and soldering some ~200 pins, it just didn’t happen. That’s why I was happy to find these pre-made cables from emartee.com. 4-pin and 5-pin wires are common, but except for Alibaba, I’ve not found 8 pins anywhere. They are available in lengths of 20, 30 and 60 cm. Ordering from emartee was smooth, and delivery from China was less than two weeks. Their prices are maybe slightly higher than what you find elsewhere, except for said 8 pin wires…

Below are just some fun pictures, with the last one hinting at the LED matrix project. More about that later.

Nexa Home Automation – 433 MHz codes

1 comment

After successfully decoding the Everflourish home automation controls, and integrating that with a DIY Android app, I thought it was time to expand the system. I picked up a new set of switches and remote, however, this was a different brand, Swedish Nexa, and thus a slightly different code. So, time do go through the RF decoding again, and adjust my RF remote source code.

I found two people working with this system, taking different approaches to controlling it from the Arudino. The author of the arduinocoder seems to interface through the remote, while Sebastian Nilsson had success with the HomeEasy project. I was tempted to use that code, however, as I was also interested in analysing the raw data, I brought out my DIY “oscilloscope” instead.

Since this home-made RF-to-audio device is something I thought I’d use in the future as well, I took the RF receiver off the breadboard, and soldered it onto a mini PCB, as seen in the pictures above. While working with RF components, I always find myself coming back to winavr’s and Dave Houston’s blog on how to wire this together. Unfortunately, the receiver was a bit more sensitive to the voltage level than I had expected, so taking 4.5 or 6 V from my power brick did not work. Instead, I used an Arduino, or a small 5V converter.

After this was done and plugged in, I found myself in Linux audio problems. Between two HDMI video cards, one external USB audio source, and the onboard audio port, it has gotten rather difficult to find the correct knob to turn to make sure the correct input is not muted, or too low. Here I found the application pavucontrol to very useful, as it clearly displays which devices and ports are available, and which applications output sound. (yum install pavucontrol). In Audacity, the input source was simply “default”, while recording in mono.
Remember to NOT stick any home made equipment into the microphone port; use line-in instead.

Part of the wire message from one of the buttons on the remote can be seen above. Compared to the Everflourish system, it looks a bit more dragged out and the edges are not so clear cut. There’s probably a few reasons for that: The resistors I used between the RF receiver and audio line were slightly different (this time 47k and 100k, vs. 100 Ohm and 1k in the previous). Also, the power source played a small role. Finally, the message is different, and in particular, the timings of wave is shorter; see below for details.

wire_bits=`cat $file | grep label.*title | cut -d '"' -f 6 | tr -d '\n' | sed "s/\([01]\{2\}\)/\1 /g"`
data_bits=`echo $wire_bits | sed "s/01/0/g" | sed "s/10/1/g"`
data_bytes_bin=`echo $data_bits | tr -d ' ' | sed "s/\([01]\{8\}\)/\1 /g"`
data_bytes_hex=`echo $data_bytes_bin | tr ' ' '\n' | while read b; do echo "obase=16; ibase=2; $b" | bc; done | tr '\n' ' '`
echo -e " $wire_bits \n $data_bits \n $data_bytes_bin \n $data_bytes_hex"

The snippet above extracts the labels from the Audacity XML project file and groups every wire bit, so the correspond to one data bit. A 01 on the wire is a 0, and a 10 is 1. This is a typical Manchester code. Next, the data bits are grouped into bytes, and finally expressed in hex. It then becomes clear how the message is structured: The 26 first (most significant) bits are a unique “house” or “remote control” code; the last four bits are the button ID; the 27th bit is a group flag, and the following (28th) is the the on/off bit. See also the documentation from the HomeEasy project below for further details.


01 01 10 01 01 01 10 10 10 10 10 10 01 01 10 10 10 10 10 01 10 10 01 10 10 01 01 10 01 01 01 10
0 0 1 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 1 0 0 0 1
00100011 11110011 11101101 10010001
23 F3 ED 91

The data is encoded on the wire (aerial) as a Manchester code.

A latch of 275us high, 2675us low is sent before the data.
There is a gap of 10ms between each message.

0 = holding the line high for 275us then low for 275us.
1 = holding the line high for 275us then low for 1225us.

The timings seem to vary quite noticeably between devices. HE300 devices have a
low for about 1300us for a 1 whereas HE303 devices seem to have a low of about
1100us. If this script does not detect your signals try relaxing the timing
conditions.

Each actual bit of data is encoded as two bits on the wire as:
Data 0 = Wire 01
Data 1 = Wire 10

The actual message is 32 bits of data (64 wire bits):
bits 0-25: the group code – a 26bit number assigned to controllers.
bit 26: group flag
bit 27: on/off flag
bits 28-31: the device code – a 4bit number.

Once that was all clear, I just had to modify my transmitter code, which is connected over serial to my computer, and takes switch commands from my mobile phone. In the future, I will probably move to use an Ethernet shield, or possibly Bluetooth. There has been some problems with the connection to the Arudino, and also in sending the RF signals to the switches. In the new code, I’ve added quite a lot of extra redundancy, repeating the same command many times to makes sure it is received by the switch.

I’ve split the code into a library which can send commands to the Everflourish and Nexa systems, and the main sketch which takes commands from serial. There’s probably a few things to improve on, so feel free to send me comments or patches.

The code is released under GPL 3, or later version.

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.

More DealExtreme

Comments Off

A few months ago I listed what I’d bought and looked at on the Hong Kong based site DealExtreme. Here’s another overview, with more electronics and random stuff.

Ordered

Double-Sided Glass Fiber Prototyping PCB Universal Board (12-Piece Pack)Double-Sided Glass Fiber Prototyping PCB Universal Board (3 x 7 / 5-Piece Pack)Prototype Universal Printed Circuit Board Breadboard - Green + Silver3mm & 5mm Light-emitting Diode - Green + Red + Yellow (100-Piece Pack)Breadboard Jumper Wires for Electronic DIY (65-Cable Pack)4 Channel 5V High Level Trigger Relay Module for Arduino (Works with Official Arduino Boards)2-Channel Relay Shield Module for Arduino (Works with Official Arduino Boards)AMS1117 5V Power Supply ModuleEmolux 62mm Multi-Coated UV Lens Filter - BlackSound and Music Activated Multi-Mode Flashling EL Hearts T-shirt - M (3*AAA)Silica Gel Reusable Moisture-Proof Bead Desiccant - BlueMale + Female DC Power Converter Connector Adapters w/ Terminal Blocks For CCTV Camera (Pair)Universal Heavy Duty 6F22 9V BatteryDSTE NB-7L Replacement 7.4V 1200mAh Battery for Canon G10 / G11 - G12 / SX30 IS - Grey1/4Universal Aluminum Alloy Straight Flash Bracket for Camera - BlackUniversal Aluminum Alloy Tripod Bracket for Speedlight / Camera- BlackUniversal Handheld Jar OpenerWhite Magic Beans with Assorted Messages (10-Pack Growing Plant)Genuine Acecamp 2429 20L Outdoor Water Resistant Dry Bag - Yellow1000mA Car Cigarette Powered USB Adapter/Charger (DC 12V/24V)DIY 433MHz Wireless Receiving Module for Arduino - Green433MHz Wireless Transmitter Module Superregeneration for Arduino - GreenDIY 16-Key AD Keypad Module - Blue4 x 4 Matrix Switch Module - GreenES-71 II Lens Hood for CanonMini Prototype Printed Circuit Board Breadboard for Arduino (5 PCS)Ceramic Capacitor for DIY Electronic Circuit - Red (270-Piece Pack)Solderless Breadboard with 400 Tie-Point (White)USB to RS232 Serial Port Adapter (Transparent Green)Freaduino Soil Humidity Sensor for Arduino - WhiteDouble-Sided Glass Fiber Prototyping PCB Universal Board (3 x 7 / 5-Piece Pack)DIY HR-202 Humidity Detection Sensor Module - BlueAluminum Alloy Straight Hot Shoe Flash Bracket for Camera - BlackFlash Diffuser for Canon 580 EX / EX II / YongNuo YN560 / YN565 Speedlite (3 PCS)HT RJ45 RJ11 Cable TesterStainless Steel 1/4Mini USB 2.4GHz 150Mbps 802.11b/g/n WiFi Wireless Network Card Adapter - BlackUSB 2.0 2.4GHz 802.11b/g/n 150Mbps WiFi/WLAN Wireless Network AdapterUltra-Mini Nano USB 2.0 802.11n 150Mbps Wifi/WLAN Wireless Network Adapter6.3V 3300uf Aluminum Motherboard Capacitors (20-Piece Pack)DIY ZIF DIP IC Socket Set - Green (8 PCS)Solder Tip Refresher3-Pin Triode Transistor for DIY Project - Black (20 x 10-Piece Pack)Aluminum Electrolytic Capacitor for DIY Project (120-Piece Pack)DisplayPort DP Male to HDMI Female Adapter Cable - Black (15CM)Gold Plated 1080i HDMI V1.3 M-M Connection Cable (1M-Length)11x12 132-Panel Brain Teaser Magic IQ BallMicro USB To HDMI MHL Adapter - Black Gold Plated HDMI Male to DVI 24+1 Female Adapter62mm Digital Camera Lens Cover Digital Camera Lens Cover/Cap with Strap for Canon (62mm)

Interesting

Sound and Music Activated Velcro Spectrum VU Meter EL Visualizer T-shirt - Black (Size-L/4 x AAA)RM3 Hex KeyFlat Point Hex Key Screwdriver Set for Electronics DIY (8-Piece Set)RM2 Hex KeyRegal Tools 7-Piece Hex Keys Set7-Piece Set Hex Key Wrenches (0.7~3mm)Replacement Power Supply AC Adapter for Laptops - Black (5.5*2.1mm Plug Size)DIY CC1101 433MHz Wireless Transceiver Module for Arduino (2 PCS)8-Channel 5V Relay Module Shield for Arduino (Works with Official Arduino Boards)8 Channel Relay Module Extension Board for ArduinoDIY 4 x 4 16-Key Numeric Keypad - Black20 x 16 Double-Sided PCB Prototype Board for Arduino (Works with Official Arduino Boards)S1305 8-in-1 Gradual ABS Lens Filters + Lens Mount + Ring Set for 72mm Lens Camera - BlackMystery Speed Controller Pentium-30A for Brushless Motors (300/450 R/C Helicopters)FLYING 30A BEC Electronic Speed Controller for Brushless Motors (ESC)A2208-12T 1500KV Outrunner Brushless Motor1.6Prototype Universal Printed Circuit Board Breadboards - Green + Brown (10-Piece Pack)Prototype Universal Printed Circuit Board Breadboards - Yellow (10-Piece Pack)Prototype Universal Printed Circuit Board Breadboard - Golden (10-Piece Pack)4-Channel Relay Shield Module for Arduino (Works with Official Arduino Boards)Sound and Music Activated Velcro BEAT Spiral Dots EL Visualizer T-shirt - Black (Size-L/4 x AAA)37-in-1 Sensor Module Kit for Arduino (Works with Official Arduino Boards)9000 2.2RD32 720P 5MP Wide Angle Waterproof Action Video Camera with 8-LED White Light/AV Out/TF - YellowRD32 5.0 Mega Pixels HD 720P Waterproof Action Video Camera with 8-LED - Red (TF)1080P CMOS 5MP Sports Waterproof Digital Video Camera w/ 4x Digital Zoom/TV-Out/HDMI/SD (1.5UnisCom VP+309 Mini 1.1Transcend 8GB SDHC SD Card (Class 10 High Speed)3.3V / 5V Power Supply Module for MB102 Breadboard - BlackPower Black Wings Module Breadboard Adapter for Arduino (Works with Official Arduino Boards)MB102 Breadboard Power Supply Module for Arduino (Works with Official Arduino Boards)Power 3.3V / 5V Supply Module for MB102 Bread BoardFC-21 Power Expansion Board Module w/ Switch + Light Indication - Blue + BlackO-Shape Twin Flash Bracket for Macro Photography - BlackHigh Capacity 9800mAh Rechargeable External Battery - BlackFlexible 2-Mode Blue Light EL Strip (DC 12V/3M-Length)Rechargeable 9000mAh Li-ion Emergency Power Battery for Camcorder/Walkie Talkie/Camera + More12V 6800mAh Rechargeable Portable Emergency Power Li-ion BatteryPortable 6800mAh Emergency Rechargeable Battery Pack (EU Plug)12V 1800mAh Rechargeable Portable Emergency Power Li-ion Battery for CCTV Devices12V 6000mAh Rechargeable Portable Emergency Power Li-ion Battery12V 4800mAh Rechargeable Portable Emergency Power Li-ion BatteryPortable Dapper Stage Red/Green Laser Light Show - Blue + White (2 x AAA)Protective Plastic Case for 2.5Protective Plastic Case for 3.550mW Green + 100mW Red Laser Stage Lighting Projector with IR Remote + Tripod (100V~240V AC)Nano V3.0 for Arduino (Works with Official Arduino Boards)USB to RS232 Adapter Cable (1M-Length)RS232 Serial Port Express Card Adapter - Blue + Black + SilverPL2303HX Converter USB to TTL USB to COM Cable Module- Black (1m)Plastic Imine Membrane Screw Insulation Coat - White (1000 PCS)DIY 3mm Iron Hexagon Nut - Silver (200 PCS)2A Ceramic Tube Fuse Set (100-Piece Pack / 6 x 30mm)RGB LED Strip Control Box w/ IR 24-Key Remote Control (DC 12V)44-Key IR Remote Controller for LED Light Strip - WhiteStylish Anti-Slip Shoulder Strap for Canon DSLR Camera - RedMini Portable Metal Flash Holder Mount for Camera - BlackL-Shape Flash Bracket for Camera (2-Piece Set)Fotomate 250mm Movable Range 2 Way Macro Focusing Rail Slider433MHz 4-Channel Wireless Flash Trigger (1 x 12V 23A + 2 x AAA)433MHz 4-Channel Wireless Flash Trigger (1 x 12V 23A + 2 x AAA)Plastic Buckle Clip for High Power 220V SMD 3528 LED Flexible Strip - Transparent (10 PCS)DIY HR-202 Humidity Detection Sensor Module - Blue6490 DHT11 Humidity Temperature Sensor Module - Blue20 x 80mm Double-Sided PCB Prototype Boards (25 PCS)Double-Sided Glass Fiber Prototyping PCB Universal Board (10 x 16)Double-Sided Glass Fiber Prototyping PCB Universal Board (7 x 9)Electrical Bakelite Circuit Board (5x7cm/10-Piece)DS1307 I2C RTC DS1307 24C32 Real Time Clock Module for Arduino (Works with Official Arduino Boards)XL7105-SY DIY 2.4GHz A7105 NRF24L01 Wireless Module for Arduino (2 PCS)2.4GHz NRF24L01+ Wireless Communication Module for Arduino (2 PCS)DIY DS18B20 Stainless Steel Temperature Sensor Probe - BlackDHT21/AM2301 Capacitive Digital Temperature & Humidity Sensor - BlackENC28J60 Ethernet Module for Arduino (Works with Official Arduino Boards)HR31 Humidity Sensor Module for Arduino (Works with Official Arduino Boards)NRF905 Wireless Communication Transmission Module for Arduino (Works with Official Arduino Boards)2 Channel 4 Pins NC Type Shock Switch Sensor ModuleVibration Alarm Sensor Module for Arduino (Works with Official Arduino Boards)BMP085 Altimeter Atmospheric Pressure Module for Arduino (Works with Official Arduino Boards)Human Body Touch Sensor Module for Arduino (Works with Official Arduino Boards)DS1302 Real Time Clock Module with Battery CR2032DS18B20 Temperature Sensor - Black + SilverMicro SD Card Storage Memory Board Module for Arduino (Works with Official Arduino Boards)Digital Vibration Switch Sensor Module for Arduino (Works with Official Arduino Boards)Tilt Switch Sensor Module for Arduino (Works with Official Arduino Boards)3-Pin Light Sensor Module for Arduino (Works with Official Arduino Boards)DHT22 2302 Digital Temperature Humidity Sensor for Arduino (Works with Official Arduino Boards)DS18B20 Digital Temperature Sensor Module for Arduino (-55~125C)IR Receiver Module Wireless Remote Control Kit for Arduino (1 x CR2025)5V Relay Module for Arduino (Works with Official Arduino Boards)DHT11 Digital Temperature Humidity Sensor Module for Arduino (Works with Official Arduino Boards)Hall Effect Magnetic Sensor Module for Arduino (Works with Official Arduino Boards)MMA8451 3-Axial Triaxial Digital Accelerometer Module3-Axis Digital Gyroscope Sensor Module for Arduino (Works with Official Arduino Boards)

Disclaimer: All links are redirected to dx.com with my affiliated ID.

Comments Off

How to make an LED Cube

2 comments

User “fruitkid101″ has a short and to-the-point video up on YouTube on how to construct a 3x3x3 LED cube, and drive it with an Arudino. What distinguishes his video from the hundreds of other LED cube videos out there, is that he explains step by step how to arrange the LEDs and route the wiring. Secondly, as it’s only three layers and nine columns, he needs no other components (save for resistors and three transistors), and all twelve wires are hooked directly up to the Arudino.

Another interesting and instructive video is Kevin Darrah’s on a 8x8x8 RGB cube. (Unfortunately, it wont show in HTML5 yet, but can be downloaded with the Video DownloadHelper Firefox plugin). He explains how to construct the towers which make up the cube, and also goes into detail on testing the LED and connections along the way. Much more work, of course, but also looks very cool.

Home automation with Arduino and Android

Comments Off

Last year I made the first progress towards a DIY remote for my home automation light switches (using the Everflourish RF based system). The goal was to use the 433.92 MHz radio transmitter and an Arduino to control the switches. Furthermore, the Arduino would receive control commands from my always-on computer, with Bash command line control (’cause that’s the way I like it). Finally, a custom Android app was developed as yet another option for remote control. The project is now fully operational, with a few adjustments here and there remaining. The figure below shows a high level overview.

From left to right, the mobile phones run Android apps which present a simple interface to control the lights. Each light can be turned on and off individually, or by some pre-sets (e.g. everything on or off, “good morning”, or “movie time”). The application has hard-wired the IP address of my always on server / PC on the local network. There is of course nothing stopping me from connection to a public IP (and port-forward), however, I don’t need away-from-home control at this point. The phone app simply sends a “light switch command” to the PC, which forwards it directly to the Arduino (see details below).

In this setup, the server is only a proxy, however, it could of course also be used to implement pre-programmed settings. E.g. daily rhythm commands when we’re away on holiday, or other automated functions. Since this box is also my PC, I can also send commands directly to the Arduino over serial /dev/tty; I have some convenience bash-scripts for that. For the phone app, it only does the forwarding on a hard-wired port:

while true; do nc -l 1234 > /dev/ttyUSB0; done

Maybe that bit could be improved in the future. Especially, since there are occasionally a few hiccups in the phone to PC communication. For example, the switch from 3G to local Wifi connection might be delayed as we enter the house, so commands will buffer up, and then suddenly sent en masse. Also, this would be a natural place to expand the system with pre-programmed actions. It should also be noted that to get this to work, I had to enable communication on the port 1234 both on the Wifi router, and the local server firewall.

Finally, the Arduino, connected via USB, accepts the incoming serial messages. The encoding is simple: A two digit code where the first digit is the index of the light, and the second is 0 or 1 for off or on (see the loop() method in the source listing below). So, “11″ will turn on the first light, while “10203040″ turns off all four lights. (Note that in the code below, to make things clearer for myself, index 0 is skipped).

The code below is all there is the the Arduino part. It hard-codes the Everflourish messages and timings. It should be noted that the messages as found in the previous article, are most likely some form of Manchester code, as there are always pairs of 01 or 10. Thus, the hard-coded messages could have been shortened, but this would have added (a bit) to the complexity of the code, so I left it.

The main loop waits for incoming bytes on the serial USB connection, and sends the according light switch command to the RF transmitter on pin 2. Here there is probably also room for some improvements, to avoid illegal numbers, stuck states, etc. Once a valid code is received, the transmitted signal for that button is repeated four times, just as seen with the original remote control.

(Download source)

#define OUT_PIN 2

// Timings in micro seconds
#define SHORT_UP_0 567
#define LONG_UP_1 1134
#define DOWN_SPACE 680
#define UP_END 15000

const int PREAMBLE = {0x00};
const int OFF[] = {0x55};
const int ON[]  = {0xaa};

const int light_array[][5] = {
  {},
  // main
  {0x65, 0xa9, 0x46, 0x95, 0x67, },
  {0x65, 0xa9, 0x46, 0x96, 0x96, },
  {0x65, 0xa9, 0x46, 0x99, 0xa3, },
  {0x65, 0xa9, 0x46, 0x9a, 0x61, },

  // aux
  {0x65, 0xa9, 0x46, 0x95, 0xaa, },
  {0x65, 0xa9, 0x46, 0x96, 0x53, },
  {0x65, 0xa9, 0x46, 0x99, 0x62, },
  {0x65, 0xa9, 0x46, 0x9a, 0xa1, },
}; 

void setup() {
    Serial.begin(9600);
    Serial.println("setup");

    pinMode(OUT_PIN, OUTPUT);
}

void loop() {
  if (Serial.available() > 1) {
     int light_id = Serial.read() - '0';
     int on = Serial.read() - '0';
     Serial.print(light_id);
     Serial.println(on);
    
     for(int i = 0; i < 5; i++) {     
       send(light_array[light_id], on);
     }
     
     //delay(500);
  }
}
  
void send(const int *light_data, boolean on) {

  digitalWrite(OUT_PIN, LOW);
  delayMicroseconds(LONG_UP_1);
  
  send_bytes(PREAMBLE, 1, 4);
  send_bytes(light_data, 5, 8);
  send_bytes(on ? ON : OFF, 1, 8);

  digitalWrite(OUT_PIN, HIGH);
  delayMicroseconds(DOWN_SPACE);
  
  digitalWrite(OUT_PIN, LOW);
  delayMicroseconds(UP_END);

  digitalWrite(OUT_PIN, HIGH);
}

void send_bytes(const int *bytes, int len_bytes, int len_bits) {
  for(int b = 0; b < len_bytes; b++) {
    int data_byte = bytes[b];
    for(int i = len_bits - 1; i >= 0; i--) {
      digitalWrite(OUT_PIN, HIGH);
      delayMicroseconds(DOWN_SPACE);
    
      digitalWrite(OUT_PIN, LOW);
      int data_bit = ((data_byte >> i) & 1);
      if (data_bit == 0) {
        delayMicroseconds(SHORT_UP_0);
      } else {
        delayMicroseconds(LONG_UP_1);
      }
    }
  }
}

Comments Off

DealExtreme

Comments Off

DealExtreme / dx.com is a Hong Kong gadget site with thousands and thousands of China products of all kinds, often at very competitive prices. Every order is free of shipping charges, even if you buy a $1 item. It makes it easy to order and forget. The only downside is the shipping time, which sometimes can be around three to four weeks; some things might arrive earlier, though.

Here are the items I’ve bought for myself and others so far, followed my wish list, or list of items which might be interesting. The order list can be download in CSV form, while the wish list had to be scraped. For what it’s worth, here is a small Python script which does that, plus a bash script for HTML rendering of image links and product descriptions.

The Python script uses WebDriver / Selenium, and install for that goes:
sudo apt-get install python-pip
sudo easy_install selenium

Orders

Genuine Acecamp 2429 20L Outdoor Water Resistant Dry Bag - Yellow1000mA Car Cigarette Powered USB Adapter/Charger (DC 12V/24V)DIY 433MHz Wireless Receiving Module for Arduino - Green433MHz Wireless Transmitter Module Superregeneration for Arduino - GreenDIY 16-Key AD Keypad Module - Blue4 x 4 Matrix Switch Module - GreenES-71 II Lens Hood for CanonMini Prototype Printed Circuit Board Breadboard for Arduino (5 PCS)Ceramic Capacitor for DIY Electronic Circuit - Red (270-Piece Pack)Solderless Breadboard with 400 Tie-Point (White)USB to RS232 Serial Port Adapter (Transparent Green)Freaduino Soil Humidity Sensor for Arduino - WhiteDouble-Sided Glass Fiber Prototyping PCB Universal Board (3 x 7 / 5-Piece Pack)DIY HR-202 Humidity Detection Sensor Module - BlueAluminum Alloy Straight Hot Shoe Flash Bracket for Camera - BlackFlash Diffuser for Canon 580 EX / EX II / YongNuo YN560 / YN565 Speedlite (3 PCS)HT RJ45 RJ11 Cable TesterStainless Steel 1/4Mini USB 2.4GHz 150Mbps 802.11b/g/n WiFi Wireless Network Card Adapter - BlackUSB 2.0 2.4GHz 802.11b/g/n 150Mbps WiFi/WLAN Wireless Network AdapterUltra-Mini Nano USB 2.0 802.11n 150Mbps Wifi/WLAN Wireless Network Adapter6.3V 3300uf Aluminum Motherboard Capacitors (20-Piece Pack)DIY ZIF DIP IC Socket Set - Green (8 PCS)Solder Tip Refresher3-Pin Triode Transistor for DIY Project - Black (20 x 10-Piece Pack)Aluminum Electrolytic Capacitor for DIY Project (120-Piece Pack)DisplayPort DP Male to HDMI Female Adapter Cable - Black (15CM)Gold Plated 1080i HDMI V1.3 M-M Connection Cable (1M-Length)11x12 132-Panel Brain Teaser Magic IQ BallMicro USB To HDMI MHL Adapter - Black Gold Plated HDMI Male to DVI 24+1 Female Adapter62mm Digital Camera Lens Cover Digital Camera Lens Cover/Cap with Strap for Canon (62mm)

Interesting

Portable Dapper Stage Red/Green Laser Light Show - Blue + White (2 x AAA)Protective Plastic Case for 2.5Protective Plastic Case for 3.550mW Green + 100mW Red Laser Stage Lighting Projector with IR Remote + Tripod (100V~240V AC)Arduino Compatible Nano V3.0USB to RS232 Adapter Cable (1M-Length)RS232 Serial Port Express Card Adapter - Blue + Black + SilverPL2303HX Converter USB to TTL USB to COM Cable Module- Black (1m)Plastic Imine Membrane Screw Insulation Coat - White (1000 PCS)DIY 3mm Iron Hexagon Nut - Silver (200 PCS)2A Ceramic Tube Fuse Set (100-Piece Pack / 6 x 30mm)RGB LED Strip Control Box w/ IR 24-Key Remote Control (DC 12V)44-Key IR Remote Controller for LED Light Strip - White24-Compartment Free Combination Plastic Storage Box for Hardware Tools / GadgetsRemovable Dividers 40-Compartment Plastic Storage for Small Gadgets36-Compartment Free Combination Plastic Storage Box for Hardware Tools / GadgetsEKB-108 Plastic Battery Box for 10 x AA / AAA - Translucent WhiteStylish Anti-Slip Shoulder Strap for Canon DSLR Camera - RedMini Portable Metal Flash Holder Mount for Camera - BlackL-Shape Flash Bracket for Camera (2-Piece Set)Aluminum Alloy Straight Hot Shoe Flash Bracket for Camera - BlackFotomate 250mm Movable Range 2 Way Macro Focusing Rail Slider1/4433MHz 4-Channel Wireless Flash Trigger (1 x 12V 23A + 2 x AAA)433MHz 4-Channel Wireless Flash Trigger (1 x 12V 23A + 2 x AAA)Plastic Buckle Clip for High Power 220V SMD 3528 LED Flexible Strip - Transparent (10 PCS)DIY HR-202 Humidity Detection Sensor Module - Blue6490 DHT11 Humidity Temperature Sensor Module - Blue20 x 80mm Double-Sided PCB Prototype Boards (25 PCS)Double-Sided Glass Fiber Prototyping PCB Universal Board (10 x 16)Double-Sided Glass Fiber Prototyping PCB Universal Board (7 x 9)Electrical Bakelite Circuit Board (5x7cm/10-Piece)Double-Sided Glass Fiber Prototyping PCB Universal Board (3 x 7 / 5-Piece Pack)DS1307 I2C RTC DS1307 24C32 Real Time Clock Module for Arduino - BlueXL7105-SY DIY 2.4GHz A7105 NRF24L01 Wireless Module for Arduino - Green (2 PCS)2.4GHz NRF24L01+ Wireless Communication Module for Arduino - Green (2 PCS)433MHz Wireless Transmitter Module Superregeneration for Arduino - GreenDIY 433MHz Wireless Receiving Module for Arduino - GreenDIY DS18B20 Stainless Steel Temperature Sensor Probe - BlackDHT21/AM2301 Capacitive Digital Temperature & Humidity Sensor - BlackENC28J60 Ethernet Module for Arduino - WhiteHR31 Humidity Sensor Module for Arduino - BlueNRF905 Wireless Communication Transmission Module for Arduino2 Channel 4 Pins NC Type Shock Switch Sensor ModuleVibration Alarm Sensor Module for Arduino - BlackBMP085 Altimeter Atmospheric Pressure Module for ArduinoHuman Body Touch Sensor Module for Arduino - Black + BlueDS1302 Real Time Clock Module with Battery CR2032DS18B20 Temperature Sensor - Black + SilverMicro SD Card Storage Memory Board Module for ArduinoArduino Compatible Digital Vibration Switch Sensor ModuleArduino Tilt Switch Sensor Module - BlackArduino Compatible 3-Pin Light Sensor Module - RedArduino Compatible DHT22 2302 Digital Temperature Humidity SensorDS18B20 Digital Temperature Sensor Module for Arduino (-55~125IR Receiver Module Wireless Remote Control Kit for Arduino (1 x CR2025)Arduino 5V Relay Module - Blue + BlackDHT11 Arduino Compatible Digital Temperature Humidity Sensor ModuleFreaduino Soil Humidity Sensor for Arduino - WhiteHall Effect Magnetic Sensor Module for Arduino (DC 5V)MMA8451 3-Axial Triaxial Digital Accelerometer ModuleArduino 3-Axis Digital Gyroscope Sensor Module - Blue

Comments Off

Small DIY keypads

Comments Off

Looking for a simple remote control solution, I came across these small 4×4 button keypads seen in the pictures below. The first two are similar in that they are simple discrete digital circuits with a 8-pin (4×4) output. The only difference is the direction of the pins. The third uses an analogue signal to determine which button is pressed, thus only a single free analogue pin is needed on the Arudino.


(Images link to the Deal Extreme product pages)

Gerhard Schmidt has posted a nice article on how to read these keypads (his examples are with 3×4 keypads, but the principles are of course the same). For the digital 8-pin versions, reading is very simple, and you can even get away with no extra components, if you are willing to spend 8 IO ports on your micro controller. For the analogue based board, voltage thresholds are used to distinguish which key is pressed. Those boundaries will of course depend on the implementation of the board. Deal Extreme links to one circuit diagram, and on Waveshare’s product page (they seem to be the original manufacturer) an overview of voltage ranges for both 5V and 3.3V can be found.

Comments Off

Arduino on Fedora 17

2 comments

Working with the Arduino on a changing Fedora environment is a bit of a challenge. For every release or update, there’s something new and exciting which breaks the Arudino IDE, programmer, or serial connection. Here’s what I’ve collected for Fedora 17 and previous versions.

The basic setup for the programmer is to let the rxtx module have access to the lock file system. This is one way of achieving that: (note the new location of the lock files)
sudo usermod -a -G uucp,dialout,lock $USER
sudo chgrp uucp /run/lock
sudo chmod 775 /run/lock

Next, the gpsd daemon might still be in the way. One or more of the commands below should take care of it:
sudo systemctl stop gpsd
sudo systemctl disable gpsd
sudo killall gpsd
sudo yum erase gpsd

More recently, the ModemManager (for 3G and other modems) might interfere with the serial connection. However, NetworkManager depends on the the former, so it cannot just be removed. The hack below should take care of it though (lest you want to hack around with udev exception rules).
sudo chmod 0000 /usr/sbin/modem-manager
sudo killall modem-manager

Finally, an incompatibility been a system / GCC library and some older versions of the Arduino IDE seems to have been introduced. It manifests itself at compile-time, with the errors “error: expected identifier or ‘(‘ before ‘double’” and “error: expected ‘)’ before ‘>=’ token”. Although most likely just a temporary issue until next upgrade, it can be fixed by commenting out the following line in hardware/arduino/cores/arduino/wiring.h

file: .../hardware/arduino/cores/arduino/wiring.h

// #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

And that’s it. Now you’re all set to program the Arduino on Fedora 17.