What you will find here is intersections of art, design, and technologies of movement, light, sound, sensing, and control.

making blog

Flourish 2012, Arduino 101, PS1

Submitted by Ed_B on Tue, 04/03/2012 - 03:49

The Flourish 2012 Conference was mentioned in this earlier post. About 40 people took part in the workshop, sponsored by Flourish 2012 and presented by Pumping Station: One. I was the instructor.

We used the Flex kit from Sparkfun. It has several types of resistive sensors, a breadboard, hookup leads, and an Arduino Uno. Although the workshop was free, seating was limited so we used Eventbrite for ticketing. Since some people already owned Arduinos, and others wanted to try it before buying it, we had two types of tickets. You could bring your own Arduino (preferably a Flex kit), or use one of ours and return it afterward.

 

Avner counting pins collaborative electronics Eric looking for trouble
Tim Saylor introduces Pumpng Station:One Ed Bennett shows the Flex breadboard It's almost working!

Working with circuits and breadboads isn't hard, but you have to train your eye to see the physical sense of the thing. For a beginner it's very easy to make mistakes. If it weren't for the volunteers from PS1 who patrolled the room watching for people needing help, the workshop would not have been possible.  Patrick, Anna, Avner, Steve, and Eric stayed very busy for the whole two hours.

 Images by Anna Yu

Flourish 2012 Arduino 101

Submitted by Ed_B on Sat, 03/31/2012 - 11:47

Flourish 2012 logo

 

Flourish 2012

 

Arduino 101: A hands-on workshop presented at Flourish 2012 by Pumping Station: One (pumpingstationone.org) at the University of Illinois at Chicago, Room 430 Student Center East, 750 S. Halsted, 1:00pm

 

Instructor: Ed Bennett

 

The purpose of the Flourish Conference is to promote the use and adoption of Free Libre Open Source Software (FLOSS) by demonstrating the practical applications of FLOSS in the business and academic world.

 

Outline:

What's a microcontroller (MCU)?

embedded controller
hardware i/o interface

program memory (flash)

RAM

built-in peripherals

Arduino UNO's MCU: Atmel Atmega328p

8-bits (avr-gcc uses 16-bit int's)

20 MHz (16 MHz in Arduino)

32K of flash

2K of RAM

1K of eeprom

 

What's Arduino? (a registered trademark, open source software/hardware, a defacto standard, a community, avr-gcc, libraries, bootloader)

 

Arduino board image from Sparkfun

image is CC BY-NC-SA 3.0 (sparkfun.com)

 

Installing the Arduino environment

A brief word on the Arduino environment 0.xx to 1.xx transition (new reference design)

changes in the IDE

change in the USB interface

changes in libraries

Various components on the Arduino board

What does a minimal Arduino consist of

 

Arduino UNO schematic diagram

Tour of the board connectors
       5.0 volts
       3.3 volts
       ground
       analog in
       analog out
       digital in/out
        bits/bytes

serial ports

uart

i2c

spi

Launching and running

tour of the IDE

pick your board (Uno)
find your serial port (ttyUSB0 or ttyACM0 or comX)
find/set your sketches folder
how projects/files are named

external editor
save-as from the examples folder
code beautifier

Location of the examples and reference

Why is blinking an LED important?

toolchain test

universal on-off output method

“hello world” of microcontrollers

Basic structure of the language; Simplifed mix of C and C++
       if
       while
       for
       functions
 

Buy it or build it? “Hardware is hard”. What is a shield?

 

Sources of stuff to hook up to the board

sparkfun

adafruit

 

Always get libraries/examples before buying hardware
 

Contents of the Sparkfun “Flex” kit

 

How to use a breadboard

run an LED

 

Logic levels on input or output pins

1, TRUE, high, +5 volts, ON

0, FALSE, low, ground (0 volts), OFF

Running basic built-in examples with i/o
       digital output
               blink
       digital input
               fake pushbutton (pullup w/ a  with wires)
       analog input
               voltage divider / pot (a ratio w/ one unknown value)
               voltage divider / photocells
       analog output (PWM)
               Regular LED
               RGB LED
       data (intelligent) i/o
               serial monitor

 

Some possible future directions of the Arduino hardware development
 

 

 

 

Crystalfonz Serial LCD code for PS1 class

Submitted by Ed_B on Sun, 03/04/2012 - 14:59

 

  I expanded the functions to include all the basic cursor movements, and also got the scrolling queue function happenin. 3-18-12  

/*
CrystalfontzDisplay1.ino

Sample code and utility functions for the Crystalfontz CFA-632
serial character display. 16x2

Ed Bennett 3-18-12

The display has no backlight. It consumes 9mA at 5V. The data line
is connected to the TX pin (digital i/o 1) of the Arduino. When the
Arduino is being programmed, the display sees that data at its input.
The display sees the programming data as a spray of random numbers.
Some of these numberes are control commands. This sometimes causes
the display to crash, and sometimes it won't restart correctly, even
from power-up. The solution here is to power the display from digital
i/o 2. (Yes, really.) The +5 supply line for the display is connected
to pin DIO 2. The display is kept powered off until the program starts
running and turns on DIO 2.

Several configuration options for the display are set by making solder
bridges on the jumper pads on the back of the display. To configure the
display for 5 volt async data, and to show the splash screen at startup,
bridge these jumpers: JPB, JPC, JPD, JPE. Keep the splash screen option
active. It can tell you that the display is still good if your program
stops working.

CFA-632 Electrical connections are all on J2: 
Ground to pin 1 
+5 to pin 2 
data_in to pin 4 (LCD data in comes from dio2 (TX pin) of Arduino) 
 
*/
 
int sensorPin = A0;
int sensorValue = 0;

char message1[] = "tweedle dee";
char message2[] = "deedle twee";

void setup() 
{  

  pinMode(2, OUTPUT);
  digitalWrite(2, LOW); 

  Serial.begin(9600);  
  digitalWrite(2, HIGH);   
  delay(2000);
  
  wrapOFF();
  
  setScrollMarquee(message2);
  runScrollMarquee(1);
  
} 
 

void loop() 
{ 
  int sense;


  setCursorPosition(0,0);
  //showUnderlineCursor();
  hideCursor();
  
  sense = analogRead(sensorPin);
  
  clearLine(0); // deletes leftovers from previous print
  Serial.print("sense = "); 
  Serial.print(sense);

  delay(500);
} 

void hideCursor(void){
  Serial.write((byte)4);
}

void showBlockCursor(void){
  Serial.write((byte)6);
}

void showUnderlineCursor(void){
  Serial.write((byte)5);
}

void clearDisplay(void){
  Serial.write((byte)12);
}

void clearLine(int line){
  setCursorPosition((byte)line,(byte)0);
  Serial.print("                ");
  carrigeReturn();
}

void homeCursor(void){          // move cursor to top left position
  Serial.write((byte)1);
}

void hideDisplay(void){        // data does not change
  Serial.write((byte)2);
}

void unhideDisplay(void){     // data does not change
  Serial.write((byte)3);
}

void backspace(void){
  Serial.write((byte)8);
}

void linefeed(void){          // Cursor down one row. Cursor will wrap
  Serial.write((byte)10);     // if scroll is on
}

void deleteChar(void){        // deletes character at cursor position
  Serial.write((byte)11);
}

void setCursorPosition(int row, int column){
  Serial.write((byte)17);
  Serial.write((byte)column); // column 0-15
  Serial.write((byte)row);    // row 0 or 1
}

void carrigeReturn(void){     // home cursor on current line
  Serial.write((byte)13);
}

/*
wrapON()
Turns wrap feature on. When wrap is on, a printable character
received when the cursor is at the right-most column will cause
the cursor to move down one row to the left-most column. If
the cursor is already at the right-most column of the bottom row, 
it will wrap to the top row if Scroll is off, or the display will
scroll up one row if Scroll is on.
*/

void wrapON(void){      
  Serial.write((byte)23);
}

void wrapOFF(void){       
  Serial.write((byte)24);
}

/*
scrollON()
Turns scroll feature on. Then a Line Feed [linefeed()] command from
the bottom row will scroll the display up by one row, independent
of Wrap. If Wrap is also on [wrapON()], a wrap occurring on the 
bottom row will cause the display to scroll up one row. Scroll is
on at power-up.
*/

void scrollON(void){
  Serial.write((byte)19);
}

void scrollOFF(void){
  Serial.write((byte)20);
}

void doBargraph(int length){

  Serial.write((byte)18);  // enter bargraph mode
  Serial.write((byte)0);   // select custom characters 0,1 (huh?)
  Serial.write((byte)15);  // medium width low bar style
  Serial.write((byte)0);   // start column character pos.(values are 0-15)
  Serial.write((byte)14);  // end column character pos.(values are 0-15)
  Serial.write((byte)length); // length (values are 0-96)
  Serial.write((byte)1);   // row (0 or 1)
}

// scrolls a message -- 20 chars max
void setScrollMarquee(char myString[]){
  int i =0;

  hideCursor();
  runScrollMarquee(255);
  
  for(i=0; i<20 && myString[i] != 0; i++){
    Serial.write((byte)21); // assign scrolling characters
    Serial.write((byte)i);
    Serial.write((byte)myString[i]);
  }
}

void runScrollMarquee(int line){ // line is 0 or 1. line = 255 means stop

// send scroll command val=22 then
// send line, then step size, then speed
  Serial.write((byte)22); //enable scroll marquee command
  Serial.write((byte)line); 
  Serial.write((byte)1); // scroll step size in pixels. range is 1-6

  //update_speed determines how often updates will 
  //occur. The units are 1/96 of a second (about 10 mS). 
  //The valid range is \005 (52 mS) to \100 (1.042 S).
  Serial.write((byte)5); // update speed
}

void stopScrollMarquee(void){
  runScrollMarquee(255);
}

PS1 Minimal Arduino-compatible

Submitted by Ed_B on Sun, 03/04/2012 - 14:45

 Here is the detail of the  minimal ATmega168/328 board we madein class. It uses an external FTDI usb to serial adapter cable for programming.

 
 
 

 

Making Arduino-compatibles at PS1

Submitted by Ed_B on Tue, 02/21/2012 - 20:06

 

On Sunday Feb. 19th, I gave a workshop at Pumping Station:One. The subject was Intro to Arduino. We made a minimal Arduino-compatible on a protoboard. I like dong it this way because you're actually building the circuit and not just soldering parts in holes.

 

Making Arduino-compatible boards at Pumping Station<br />
            One Making Arduino-compatible boards at Pumping Station<br />
            One

 

The usb to serial adapter in the photo is from FTDI, but we used one from Adafruit that comes as a bare board.

 

  very minimal Arduino-compatible  

 The success rate was very good and we look forward to having more Arduino based classes. The next one should be March 4th.

 

Stepdrive203

Submitted by Ed_B on Tue, 12/13/2011 - 19:40

Here is source code for an accelerated stepping motor driver. It is alpha, but mostly works well.

Osloom Component

Submitted by Ed_B on Thu, 11/17/2011 - 01:45

I'm putting together some materials to test for the Osloom project. The first item is the linear actuator. It requires a driver board, power supply, and controller.

The actuator needs to be tested, just to see it go. The assembly has to be elevated so that the parts can move. I had to make a stand. Aluminum angle stock in 1"x1" and 1-1/2"x1-1/2" seemed to be a good size.

 

Measure the stock. Use square, ruler, and caliper to locate lines. Scribe lines. Layout dye is more of a mess then it's worth in this case. Make starter punches for drill holes. I took the (mostly) prepped stock over to the Pumping Station One shop to do the assembly.

The top and bottom needed to be parallel, so I leveled the bottom piece, and floated the top piece around until it was level, too. The screws held the top geometry during soldering. Soldering aluminum takes a lot of heat. The blue tank is propane for preheating. The yellow tank is MAPP gas which burns hotter than propane.

Back at home, I set the actuator on its new stand and started work on the control test. I wrote a simple single-purpose acceleration sketch for an Arduino. I usually build my own "Arduino" on a proto-board. The board is connected to the driver board's step, direction, and enable input lines. It seems to work okay.

 

Controlling a Light from an Arduino

Submitted by Ed_B on Sun, 10/23/2011 - 21:43

Somebody on the PS1 list asked about the basic circuit for turning a lamp on and off with an Arduino. It seemed like a fair enough question. Controlling any D.C. powered, low voltage light bulb is pretty much the same circuit, regardless of the bulb. the circuit diagram will be the same for different loads, but the parts may be different sizes or types than what's shown here. Three things have to match: (1) the volt and amp rating of the bulb, (2) the volt and amp capacity of the power supply for running the bulb, and (3) the volt and amp rating of the transistor.

The circuit has (from top to bottom) a 5 volt, 1 Amp wall adapter; the lamp, transistor, and resistor; and the Arduino.

 

  The blink.pde test program that comes with the Arduino uses digital i/o pin 13. So that's what I used. Next to pin 13 is the GND (ground) pin. 

 

The Arduino outputs a tiny current to turn on the transistor. The transistor switches power to the lamp. The resistor limits the current flowing between the Arduino and the transistor.

 

The transistor is type TIP122. (The number is printed on the transistor.) It's a good general-purpose switch for medium to small DC loads. The three pins of the TIP122 are identified as (from left to right ) Emitter, Collector, and Base, E, C, B. 

Transistors will only switch DC loads. To switch an AC load or to switch wall current, use a solid state relay. 

 

Replacing Vacuum Tube Circuit Electrolytics

Submitted by Ed_B on Fri, 10/21/2011 - 08:20

I found this early 1960's intercom system for about 10 dollars. It uses vacuum tubes. I like any kind of commercial equipment that uses tubes, so that was enough reason to adopt it.  It's not pretty in any sense, but it gots tubes. When I got it home I discovered that it didn't work. When I turned it on, the tubes took a few seconds to warm up enough to power the speaker. That's normal. What's not normal is the maximally loud HNNRRRRRRRRR sound it made. I've heard this sound before. It happens with old tube amplifiers when the electrolytic filter capacitors in the power supply "dry up" with age. It's a dangerous condition and will fry the power supply if it's allowed to HNNRRRRRRRRR for very long.

A two-station intercom.

The amp looks nicer outside of its box.

The big brown cylinder is the bad filter cap.

The filter caps smooth pulsating DC from the rectifier. The smoothing action makes clean DC with only a little ripple distortion.  Without the caps, the whole amplifier is hammered with 120 Hz bursts of voltage. This is the cause of the noise. Electrolytic capacitors have a shelf life, like bread does. They will go bad just sitting there. Capacitor design has improved over time, so the rotten cap problem is more a problem with older chemistries, like the chemistry in old capacitors. Not ironic, I suppose. In any case, the best thing for an electrolytic cap is to use it (gently). These days pretty much any old vacuum tube equipment will have rotten electrolytics unless it's been taken care of. Plugging in a garage sale find might lead to disappointment. There are two ways around this. First is to replace the filter caps before trying to use the device. The other way is sort of magical. I've never had the patience to go all the way through with it. Supposedly if you plug the device into a varible transformer (Variac) and raise the input voltage on the device from 0 volts to the full 120 volts, over a period of a month or two, the electrolytics will "form up" and "heal". Maybe it's true, I dunno. It's easier (but not cheaper) to replace them. There's a third way -- luck.

I made up a replacement from discrete capacitors. The ratings are about the same.

After cutting out the old cap, I tested the new setup to be sure it would work. It's tacked onto some wires hanging in space.
The new cap has more external wires than the original. To make the necessry connections, I added a 2-position wiring terminal.

 

I found a screw in a convenient place to attach the terminal.
Space is tight next to the output transformer.
Soldering parts of this size and mass can be efficiently done with a 100 watt soldering gun.

The new caps are in place. The wires are very stiff. The caps have no inclination to float around. In fact, they couldn't move if they wanted to. I've had the yellow caps in my junk box for a long time. The leads are work hardened from handling, so they would be very difficult to straighten.

The remote station has only a speaker and a switch inside. Whatever had been the connection point for the wiring was gone.

I'm adding a terminal block to the inside of the remote unit.

When tubes were common, electrolytic capacitors were much bulkier and more expensive than now. Tube power supplies usually produce two or three different voltages. In a small guitar amplifier, the first two stages might use 150 volts, and the output  might use a combination of 300 and 375 volts. Each supply voltage takes one cap. To save space and money, power supply capacitors were made with two or three (usually three) capactors in one package. Usually they took the form of a metal can about the size of a large tube. These were mounted vertically on top of the chassis alongside the vacuum tubes. Cheaper ones look like a large electrolytic with multiple leads. That's what I replaced here.

Base station on the left,
remote station on the right.

The remote station positioned
for testing.

 

 

 

figuring out hardware I/O on android

Submitted by Ed_B on Fri, 10/14/2011 - 01:07

 

Hardware I/O on android is a big deal. I'm surveying the different ways that people are doing it. (Not including the audio methods.) The ADB is at the core of several techniques. The google ADK uses the same hardware, but does it differently.

Processing has such good serial support on the desktop that using it on a tablet should be a natural. The way I like at the moment (subject to change at any time) is using the USB host or USB OTG (On The Go) port on my Herotab C8. Take that into a USB to serial converter, and we're back in familiar territory. Of course it doesn't work that way, but I want to see if I can make it work. The Processing authors say this on their development blog:

Q: How do you do serial on P5 in Android?

A: You can't.

Really. A two word answer -- unqualified -- just NO. That looks like a challenge to me...

Syndicate content