Posts tagged ·

arduino

·...

Geeky watches

no comments

Douglas Adams had something against digital watches, always criticizing the ape descendants for thinking they were neat. Well, I have to admit I rather like them. As a 8-year old, I spent the better part of a year saving up for my first Casio. However, at some point in the 90s, they seem to have goon out of fashion. Which is a shame, because there are some really nice geeky looking watches around now.

Take these from Sparkfun, for example: The “Solder : Time Watch Kit” to the left is, as the name suggests, a solder kit you put together yourself, to create a fun looking digital watch. Complete with resistors and ICs on display, which is a PIC microcontroller. To the left is the Arudino (ATMega328) based Sparkfun version; “BigTime Watch Kit“. Again you have to solder yourselves, but it is intended as a beginner’s kit, so everything are nice big through-hole components, which there are only a few of.

However, if DIY watches isn’t your cup of tea, you can always go for ThinkGeek’s selection. Here there is a lot of good looking geekery to choose from, including a DIP-switch controlled watch, a binary watch, or if you want to go simple maybe a sundial ring (possibly for the next steam punk gathering).

RF Communication on 433.92 MHz

2 comments

I recently got a Sparkfun order on my door, so it’s time to play. In the box was a RF Link Transmitter, and Receiver. They are sold as 434 MHz radio wireless links. Others talk about 433 MHz. To be precise, it’s 433.92 MHz. That matters, because if you search for that number, you will find the so called home automation systems using that frequency, including X10, Everflourish, and many others. My plan then, is to build something similar to the TellStick from TellDus, which control these devices from my computer. Connect that up to an Android app, and I could control my lights and other appliances from any mobile phone.

First things first, though. Hooking up the bits was easy, following these two similar tutorials. Using the VirtualWire Arduino library v1.5 (1.6 released at the time of writing) by Mike McCauley (download version 1.5) transmitting data was a breeze. The library includes example code for transmitter and receiver, simply upload and go. Note that the transmitter data should be connected to pin 12 on the Arudino, and the receiver on pin 11 on the other. Data was received loud and clear, without errors. Mike’s library is well written, and covers several important aspects of RF communication, including a dedicated protocol, CRC handling, robust encoding over the air, baud rate, and to top it off, an easy to use API.

Now, of course when using my Everflourish nothing happened. Which was a good sign; it did not interfere with the Virtual Wire transmission. That remote is using a different protocol to talk to the light switches. Luckily, it has already been reversed engineered and the source code is available from TellDus. It will probably take some time to get this working. Meanwhile, some pictures.

Arduino, Fedora 15, and the gpsd incompatibility

no comments

Even though the Arduino is very popular amongst makers and other electronics hobbyist, it is still a fringe platform in most settings. And even though the arduino package is available through many repositories, more testing would be welcome.

In the latest packages in Fedora 15, things have broken down in several ways. Tom Trebisky does a good job of guiding you through the pitfalls here. He has further useful notes on Arduino here.

What had me going mad was this message: “avrdude: stk500_recv(): programmer is not responding”. Everything seemed to be fine, the lights were blinking when connecting, the logs looked normal, and what’s more, all my boards worked when programmed on another system, but not on my Fedora 15 at home! Furthermore, the error seemed to be half sporadic. Sometimes it would fail at once, while other times it got a bit further before it stopped.

Tom writes: “On a hunch (having watched the messages via dmesg when I plug in my arduino) I get rid of gpsd“. And that was my problem as well. The gpsd daemon was some how conflicting with the ttyUSB device. One option to remove it would be

service gpsd stop
killall gpsd
yum erase gpsd

However, in my case I could not remove the gpsd package because it was a dependency of another application I wanted. In the end, I simply renamed the binary (/usr/sbin/gpsd), so it would not be automatically activated when I plug in the Arduino. Maybe not so elegant, but I could finally get to work with more fun stuff.

Commercial Quadricopters

no comments

Coming a long way since the DIY Arudino based ArduCopter announced a year ago, commercial quadricopters seems to be taking off. Gizmodo and Slashdot are reporting on the Aeryon Scout Quadrotor by Canadian Aeryon Labs Inc. The marketing is towards police organizations, and the forum headlines compare it to a Predator UAV, which of course sets the discussion off on a totally useless track.

The interesting features of the Aeryon Scout includes its easy assembly and disassembly, high quality camera payload, and robust remote control system. The videos on their site shows off this. Otherwise, there’s few technical details, and the most crucial one for these kind of vehicles; how long can it stay up in the air, is not mentioned. They do talk about batteries though, using 11.1 V or 14.8 V lithium polymer cells. Price is not known either, however, since it’s target towards governments, you can expect a 10x markup.

Which brings us to the consumer quadricopter Parrot AR.Drone. It’s being sold as a kid’s toy, and you can get one for about 300 USD. There’s some pictures and videos on their site, but also a whole user community site. Their forum includes some more technical details about the product: The computer is based on ARM9 468 MHz, DDR 128 Mbyte at 200MHz, Wifi b/g, Linux OS. The guidance system uses a 3 axis accelerometer, 2 axis gyrometer, and a 1 axis yaw precision gyrometer. It has 4 brushless motors, (35,000 rpm, power: 15W), and uses a lithium polymer battery (3 cells, 11,1V, 1000 mAh). Finally, it weights between 380 and 420 g (based on which hull is attached), and they claim a 12 minutes flying time.

Teensy USB Development Board

no comments

The Teensy is a complete USB-based microcontoller development system, in a very small footprint. It is similar to Arduino boards in that it uses an ATMEGA Atmel AVR processor, however not compatible. Even so, there is a software add-on for the Arduino IDE. They claim the USB communication is faster than the Arduino, since the the later uses USB-to-serial communication. As far as I understand, that is also the case with the new Arduino Uno.

The Teensy boards are much smaller than the basic Arduino boards, but still features a mini USB port. It is also available with header pins to fit on a bread board. PJRC lists a number of fun projects using the Teensy.

Interacting with the Button Pad Controller SPI

4 comments

By popular request, here’s an update to the first code for the Button Pad Controller SPI. This sketch now includes interactive feedback, in the form of changing colours based on key-presses.

Click view full size image.

Click to view full size image.

Click to play video.

Click to play video.

Download the sketch here.

// The wires
#define CS 10
#define MISO 11
#define MOSI 12
#define SCK  13

// Frame buffer for lights
int lights = 16;
int depth = 3;
byte buf[16][3];

boolean wait = false;
boolean ready = true;

void setup() {
  pinMode(CS, OUTPUT);
  pinMode(MISO, OUTPUT);
  pinMode(MOSI, INPUT);
  pinMode(SCK, OUTPUT);

  digitalWrite(CS, LOW);
  delay(100);

  blank();

  Serial.begin(9600);
  Serial.println("Starting");
}

void blank() {
  // init frame buffer
  for(int l = 0; l < lights; l++) {
    for(int d = 0; d < depth; d++) {
      buf[l][d] = 0;
    }
  }
}

void loop() {
  digitalWrite(SCK, HIGH);
  digitalWrite(CS, HIGH);
  delayMicroseconds(15);

  // Set lights: 3 x 16 bytes
  for(int d = 0; d < depth; d++) {
      for(int l = 0; l < lights; l++) {
        writeByte(buf[l][d]);
      }
  }

  if(!ready) {
    wait = true;
    ready = true;
  }

  // Read the buttons: 16 bytes.
  for(int l = 0; l < lights; l++) {
    // readByte returns a non-zero value when a button is pressed.
    byte b = readByte();

    // If a button is pressed, change the colour.
    if (b > 0 && ready && !wait) {
      if      (buf[l][2] > 0) { buf[l][2] = 0; }
      else if (buf[l][1] > 0) { buf[l][1] = 0; buf[l][2] = 255; }
      else if (buf[l][0] > 0) { buf[l][0] = 0; buf[l][1] = 255; }
      else {                                   buf[l][0] = 255; }

      Serial.print("Button ");
      Serial.print(l);
      Serial.print(": ");
      Serial.print((int)b);
      Serial.println();

      // Change colours slowly.
      ready = false;
    }
  }

  digitalWrite(CS, LOW);

  // After the second cycle, get ready to read new button clicks.
  if(wait) {
    delay(500);
    wait = false;
    ready = true;
  }

  delayMicroseconds(400);
}

// Write out a byte.
// This is for a single colour channel, for a single button.
void writeByte(byte data) {
  for(int i = 0; i < 8; i++) {
    digitalWrite(SCK, LOW);
    delayMicroseconds(5);

    digitalWrite(MISO, (data & (1 << i)) >> i);
    delayMicroseconds(5);

    digitalWrite(SCK, HIGH);
    delayMicroseconds(10);
  }
}

// Read a byte.
// Returns the value for a single button.
// Non-zero if it is pressed, or 0 otherwise.
byte readByte() {
  byte result = 0;
  for(int i = 0; i < 8; i++) {
    digitalWrite(SCK, LOW);
    delayMicroseconds(5);

    result += (!digitalRead(MOSI)) * i;
    delayMicroseconds(5);

    digitalWrite(SCK, HIGH);
    delayMicroseconds(10);
  }

  return result;
}

Arduino for Fedora

no comments

It’s old news, but I missed that the Arduino IDE now is available in the Fedora repository, since Fedora 13.

sudo yum install arduino

You might also have to include your user in some additional groups:

sudo usermod -a -G uucp,dialout,lock $USER

Should you still have problems with messages like “How can I use Lock Files with rxtx? in INSTALL”, setting the permission on /var/lock might help:


sudo chgrp uucp /var/lock
sudo chmod 775 /var/lock

Arduino IDE – Adding a little Emacs

no comments

Voidman  has a great hack for the Arudino IDE: Adding some of the most common Emacs short cuts to the editor. It’s only a few lines of added code, compile, and up and running.

Physical tone matrix

no comments

As an update to yesterday’s post on the Tone Matrix, here’s a very stylish realization from the Reenigne blog. Featuring 16×16 LED lights (just like the Flash app),  the same number of switches (using simple wire and conducting through the finger), and an Arduino / ATmega328 controller.

Online Parts Suppliers

no comments

Nathan Seidle, founder of SparkFun, recently told the story of how his business started from his bedroom in 2004. Since then, there has popped up a lot of good suppliers of electronics and other maker parts online. Here’s a short list of some of them. Feel free to send me more links. Since almost all of these are US based, sites from Europe is especially welcome.

SparkFun – sparkfun.com

Very well equipped online electronics shop, with smooth ordering process. They stock basic components, soldering kits, robotics, Arduinos, and also produce several breakout boards and other items themselves. In Nate’s own words, “SparkFun makes technology more accessible.”

Furthermore, they have established healthy community, with comments and discussions on both the product pages and forums

Maker Shed – makershed.com

Grown out of the MAKE Magazine, Maker Shed have lots of different “projects in a box”, or kits; a little bit of everything. Including electronics, crafts, and chemistry sets.

Solarbotics – solarbotics.com

More components, kits, boards, and Arudinos. Focusing on robotic kists and solar cells.

The Electronic Goldmine – goldmine-elec.com

Electronic Goldmine “specialize in purchasing inventory lots directly from manufacturers and companies that build electronic equipment”. A very good selection of basic components at good prices, however with changing inventory from week to week.

ServoCity – servocity.com

Get your moving parts from ServoCity; including steppers, servos, DCs, and accessories. As well as other mechanical parts shaft couplers for your motors. Furthermore, they stock an extensive selection of batteries.

McMaster Carr – mcmaster.com

McMaster Carr has a wast selection of mechanical and  electrical parts, as well as utility hardware.

Conrad Electronics – conrad.com

Finally, the only non-US shop on the list for now; Conrad Electronics from Austria. They have web sites and shops in several European countries. They have a broad assortment of technical parts and kits, including consumer electronics, computer, hobby, lighting, and RC kits. Their selection of batteries is impressive.

Smallduino: Ardweeny

no comments

Here’s probably the smallest fully functional Arudino out there: Ardweeny. At $10 from Maker Shed, you can’t go wrong. They market it as a bread board item, however I can’t see why you could not include it in a permanent project as well.

Panorama Robots

2 comments

It somehow seems inevitable; if you are into photography and electronics, you want to build a panorama robot. Coupled with very good software to stitch and render a panorama image, the results can be breathtaking even with little effort. For the stitching software, I recommend Hugin, the open source panorama stitcher. On a modern OS; just go yum / apt-get install hugin. For a good intro into setting up and shooting the single frames which goes into your panorama, see Robert. Cailliau’s article.

Once you’ve taken a few pictures, maybe five or even ten with a fairly wide angle lens, you realize that you can get even more detail if you use a zoom lens. Maybe 200 or 300mm. However, now you have to take hundreds of pictures to cover the same area in your finished panorama. This is were the robots come in.

The pocket camera on the turn table below is a very cheap solution; about 15 Euros. I have not found a specific product or manufacture name, though. It shows up in searches for “Panorama Drehteller“. Next to it is a more professional solution, the Gigapan Systems Epic 100 Panorama Robot. It can take a DSL, and pan both horizontally and vertically. You need both if you plan on using a 200mm lens.

So if you’re only into photography, and not DIY and soldering, those are maybe some of the solutions you’d go for. However, if you are able to build one yourself, what is stopping you? Nothing, it seems, judging by the number of home made panorama bots. Here is a Lego Mindstorms competition to build a pano bot with the winners from 2008. Here is a Jason Babcock’s second go at a panoramic turntable, using ULN2004A and BX-24 micro-controller.  And here is T. Emrich’s system which looks like a very solid setup, and clever control: His early work resulted in a horizontal rotation only solution. Later on, he built the GigaPanBot or Gigapixel Panorama Robot with complete freedom on both axis, seen in the picture below. Maybe most impressive, is how the whole system fits into his camera bag.

So what if you want to build your own. Well, nothing is stopping you, and there is plenty of parts to pick up to make a simple first system. Babcock’s first attempt was using a stepper motor from an old fax. Or you could buy a new stepper motors for less than 20 Euros.

To help you on your way, there’s the DollyShield, which I spotted on the Arduino Shield List. It includes control of two DC motors, shutter remote for the camera, joystick buttons and a LCD. “It is designed to provide an inexpensive and easy-to-use interface for two-axis motion control integrated with a camera.”

Arduino Shield List

no comments

Jon Oxer has launched a site to catalogue all Arudino shields: Arduino Shield List (shieldlist.org). At the time of writing, there are “pin usage details for 166 shields from 70 makers, and counting!”

Motors and robotics

no comments

Looking at the 12 V stepper motor at SparkFun, I came across a few other fun links. Including instructions for stepper motor wiring, a DIY surveillance camera, and an example project for the Arudino, using an EasyDriver Stepper Motor Driver. Also interesting, were the hardware suppliers: here’s some clamping shaft couplers from ServoCity, and lots more from McMaster-Carr.

Finally, I was eyeing up on of the robotics kits at SparkFun: “The POP-BOT is an Arduino compatible, mobile robotic platform. It comes complete with wheels, motors, sensors, software, documentation, etc. The POP-168’s pin-out is similar to the Arduino Stamp“.

First code for the Button Pad Controller SPI

4 comments

I recently got the Button Pad Controller SPI from SparkFun. Today I had some time to play around with the code, and got it working. Currently, it is only blinking all the lights, however the code should demonstrate the basics. The user guide from SparkFun documented the details of the interface. Add a few delayMicroseconds() calls, and it’s up and running.

Download the sketch here.

// The wires
#define CS 10
#define MISO 11
#define SCK  13

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

  pinMode(CS, OUTPUT);
  pinMode(MISO, OUTPUT);
  pinMode(SCK, OUTPUT);

  digitalWrite(CS, LOW);
  delay(1);
}

int lights = 0;

void loop() {
  Serial.println("loop");

  // "The Button Pad Controller SPI will begin listening
  //  for a data set once the CS input has been brought high."

  // "(HINT: It's best if the SCK signal is set high before
  //  setting the CS pin high)."
  digitalWrite(SCK, HIGH);
  digitalWrite(CS, HIGH);
  delayMicroseconds(15);

  // Blink the lights.
  lights = !lights;

  // Four frames (3 for lights input, 1 for button output)
  // (Here, it is writing to output on the 4th as well, which
  // is wrong, but seems not to cause any issues).
  for(int f = 0; f < 4; f++) {

      // Each frame has 16 * 8 = 128 bits of data.
      for(int i = 0; i < 128; i++) {

          // "The data on the MISO line should be set while the
          //  clock is low. When the SCK signal goes high the
          //  Button Pad Controller locks in the data currently
          //  on the MISO line."
          digitalWrite(SCK, LOW);
          delayMicroseconds(5);

          digitalWrite(MISO, lights);
          delayMicroseconds(5);

          digitalWrite(SCK, HIGH);
          delayMicroseconds(10);
      }
  }

  digitalWrite(CS, LOW);

  Serial.println("end");

  // "The CS signal should remain high for the duration of the
  //  data set, at which point it should be brought low for a
  //  minimum of 400 μs before sending the next set of data."

  //delayMicroseconds(400);
  delay(500);
}

Bad Behavior has blocked 87 access attempts in the last 7 days.