Rapid prototyping for music, art and design work

Accessing sensors and actuators in Nokia N900

Nokia N900 has a bunch of interesting sensors and actuators. This post explain how to read the internal sensors (e.g. accelerometer) and write the actuators (e.g. vibration motor) by accessing sysfs in X Terminal application. Details can be found in Maemo wiki pages


Read the rest of this entry »

Measure pendulum with accelerometer

Acceleration sensor can be used to measure pitch, yaw and roll. The same method can be used to find amplitude. It’s all about tilt.

Read the rest of this entry »

S60 Python connected to Sparkfun BlueSMiRF Silver bluetooth module

This demo is implemented with S60 Python connected to BASIC Stamp 2 via Sparkfun BlueSMiRF Silver bluetooth module.

Read the rest of this entry »

Ping))) Ultra sonic sensor: Proximity sensor

QTI sensor: line sensor

InfraRed object detector

Temperature probe: measuring temperature

Sparkfun BlueSMiRF Silver


BlueSMiRF Silver is a bluetooth module from Sparkfun Electronics. This post describes how you can set up connectivity between your PC and BlueSMiRF.

Read the rest of this entry »


Arduino NG supports PWM with three pins – 9, 10 and 11. Those pins are assigned to Atmega8 PB1(OC1A), PB2(SS/OC1B) and PB3(MOSI/OC2) pings

PB1 (OC1A) – Arduino Pin 9

PB2(OC1B) – Arduion Pin 10

PB3(MOSI/OC2) – Arduion Pin 11

Read the rest of this entry »

Control LED by pressing button (using interrupts function in AVR)

Interrupts are interruptions from the main program flow triggered by some event. Interrupts are not supported by BASIC Stamp but Arduino can support it by including a library. AVR MacPack (AVR-GCC) also can support it by including <avr/interrupt.h>. Interrupts is very useful function because you don’t have to listen to the external event all the time in your code. If you assign the external event as interrupts, AVR jumps to particular function when the event happens and returns to current location of the code.


Read the rest of this entry »

Control LED by pressing button (digital input functions in AVR)

This post describes how to program Atmega8 on Arduino board using AVR-GCC. The program enable user to control a LED by pressing a button.


  • Arduino x 1
  • USB cable x 1
  • LED x 1
  • Button x 1
  • Resistor (10KR) x 1


Read the rest of this entry »

Bit operations with AVR-GCC

Bit operations are used when interfacing with digital out such as switching pins On/Off. Programming with bit operations enable  following functions to control digital out.

  • Switching pins on (for example, turning on LED)
  • Switching pins off (for example, turning off LED)
  • Toggling pins (for example, Turning of LED if it is on and vice versa)

Read the rest of this entry »

Atmel Atmega8 (Arduino NG) Digital I/O pin register

Digital and analog pins are controlled by accessing bits. Arduino NG Diecimila has Atmel Atmega8 on board and Atmega8 has two digital ports and one analog (digital to analog converter) port. This post describes Pin assign between Arduion and Atmega8. It also describes location of bits assigned to specific ports.

Read the rest of this entry »

Blinking LED on Arduino NG with AVR MacPack first time

As Arduino has Atmel chip on board, you can also program code with C on your Mac. Softwares for the developing environment are all free. Programming with C looks more complicated but still all logic are the same as Arduion IDE and you can even create more functions with C. Once you have managesd to run your C language code on Arduio, you can also flash the code to other smaller or more powerful Atmel chips. This post describes how I as Mac user managed to write a code to blink LED on Arduion board.


Read the rest of this entry »

Digital and Analog IO using MIDI

If you have following issue on your physical computing. Miditro Wireless might be a solution.

  • PureData or Max/MSP user
  • Familiar with MIDI interface
  • Control sensors wirelessly even though most of computation is done with PD or Max/MSP wireless

Pulse IO for Ping))) Ultrasonic Sensor

PBasic code for Ping))) Ultrasonic Sensor looks very simple.

BASIC Stamp PBasic code:

pPing PIN 7 ‘ 7 pin connects to SIG pin of the PING)))
wTime VAR WORD ‘ declaring wTime as a variable
cTrigger CON 5 ‘ trigger pulse = 10 uS for BS2

DO ‘ repeat between DO – LOOP
PULSOUT pPing, cTrigger ‘ send a command to Ping)))
PULSIN pPing, 1, wTime ‘ receive a value from Ping)))
DEBUG DEC5 wTime, CR ‘ send the value to computer
PAUSE 100 ‘ stop for 100 milliseconds

If you are not familiar with BS, you can only look at Pulsin and Pulsout. Once BS sends a Pulse for a certain period. The period seems 50µs. The Ping))) sensor send back the value after that.
Pulseout command:

PULSOUT Pin, Period

  1. Pin is a variable/constant/expression (0 – 15) that specifies the I/O pin to use. This pin will be set to output mode.
  2. Period is a variable/constant/expression (0 – 65535) that specifies the duration of the pulse. The unit of time depends on the microcontroller. in my case, a unit is 10µs.

PULSIN Pin, State, Variable

  1. Pin is a variable/constant/expression (0 – 15) that specifies the I/O pin to use. This pin will be set to output mode.
  2. State is a variable/constant/expression (0 – 1) that specifies whether
    the pulse to be measured is low (0) or high (1). A low pulse begins
    with a 1-to-0 transition and a high pulse begins with a 0-to-1
  3. Variable is a variable (usually a word) in which the measured pulse duration will be stored.

f you want to simulate this on Max/MSP via Maxduino by Marius Schebella and Arduino, You can download a PDF about the PING))) from Parallax site. Page 3 would be helpful to understand the pulse.

Controlling servos with Motion Sensor

At the beginning me and Linus Roune both had a go at controlling Servos with some sort of data we would get form a sensor. Linus got into some heavy stuff with Arduino I went to look for solution using Basic Stamp.
The servos we had were Parallax (Futaba) Servos so hooking them with Basic Stamp was easy, and I found the code on the web. What I didn’t pay attention to was the difference between Standard and Continuous Rotation type of servo.


Read the rest of this entry »

How to connect Flash to external sensors using Processing and an Arduino board

The Flash meets Processing Meets Arduino setup

In the example, we use an Arduino board to receive analog signals from 3 sensors, and send them to the computer’s serial port.

A simple Processing application listens to the serial port, and creates an XML socket where it sends the signals it receives.

The Flash application listens to the XML socket created in Processing, and when an event occurs, a function is launched to process the received data.

Below are example snippets for each part of the solution:

Arduino code example
Processing code example
Actionscript code example

The Flash game shown at the presentation

The game sources (fla+arduino+processing)

– Viljo Malmberg, Aleksi Hyvönen and Brian Mogensen

Arduino & Pure Data


It is possible to make Arduino and Pure Data communicate with each other so that one doesn’t have to program Arduino with it’s own programming language (which is called Arduino).

Read the rest of this entry »

Interfacing servo motor with Arduino

The Arduino (build 0007) analogue output pins (PWM 9-11) have a frequency of approximately 30769 Hz. According to the Parallax documentation ( the low time for a pulse train can be between 20-40ms which means that the Arduino pulse is in the range. However, to be consistent with the BS board the frequency can be lowered by the following code =>

Read the rest of this entry »

Social links powered by Ecreative Internet Marketing