Zeven Rodriguez

Latest from blog

Gestios.com

Thesis

Comments Closed


Share this post

You can visit my finished thesis at gestIOs.com

Read more

Arduino Motor Shield

ITP Fellowship, Tutorials

Comments Closed


Share this post

I have been working with the Arduino Motor Shield. Here are some of the basic specs for the shield:

  • Operating Voltage – 5v to 12v
  • Motor Controller – L298P, Drives 2 DC Motors or 1 Stepper motor
  • Max Current – 2A per channel or 4A max (with external power supply)
  • Current Sensing – 1.65V/A
  • Free Running stop and brake function

 

This Shield has 4 main functions:

Function pins per Ch. A pins per Ch. B
Direction D12 D13
PWM D3 D11
Brake D9 D8
Current Sensing A0 A1

The important thing to understand about this shield is the interface. Each channel has independent Direction, PWM, Brake, and Current Sensing. Setting the Direction Digital HIGH or LOW, moves the motor Clockwise or Counterclockwise. The PWM Pin can be set to Digital HIGH or LOW, which turns the motor On or Off, or can we sent and analogWrite to control the speed. When Brake is set to HIGH it forces the motor to Stop.

 

The last feature on the board is the Current Sensing, which you can access by doing a analogRead on the analog 0 and 1 pins. One important thing on the shield is that there are 2 soldered pins on the back that enable this feature.

IMPORTANT: When the current sense pins are soldered they cannot be used as general analog pins. You will get bad readings if you try to use A0 and A1.

 

 

 

 

 

DC Motor

This shield can run 2 DC motors

This is an example of running 2 DC Motors with Current Sense.

 https://github.com/zevenwolf/Motor-Shield/blob/master/DCMotor/DCMotor.ino

Read more

Intro to TSL2561

ITP Fellowship, Tutorials

Comments Closed


Share this post

The TSL2561 is a full spectrum light sensor. I uses 3 light sensors to achieve this. I am using Lady Ada’s guide and library. In Lady Ada’s example, she uses a regular arduino, where the I2C Data and CLk are  pins are pins 4 and 5. I was using a mega which its Data and CLK are pins 20 and 21. In Arduino, the I2C pins are preset. In the example, ladyada prints out the IR, full spectrum, visible, and lux. The sensor maxes out at around 4935. These readings were taken indoors in a room

tsl2561output

 

This is the code used to generate the readings above.

#include <Wire.h>
#include "TSL2561.h"

// Example for demonstrating the TSL2561 library - public domain!

// connect SCL to analog 5
// connect SDA to analog 4
// connect VDD to 3.3V DC
// connect GROUND to common ground
// ADDR can be connected to ground, or vdd or left floating to change the i2c address

// The address will be different depending on whether you let
// the ADDR pin float (addr 0x39), or tie it to ground or vcc. In those cases
// use TSL2561_ADDR_LOW (0x29) or TSL2561_ADDR_HIGH (0x49) respectively
TSL2561 tsl(TSL2561_ADDR_FLOAT);

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

if (tsl.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No sensor?");
while (1);
}

// You can change the gain on the fly, to adapt to brighter/dimmer light situations
//tsl.setGain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
tsl.setGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)

// Changing the integration time gives you a longer time over which to sense light
// longer timelines are slower, but are good in very low light situtations!
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)

// Now we're ready to get readings!
}

void loop(void) {
// Simple data read example. Just read the infrared, fullspecrtrum diode
// or 'visible' (difference between the two) channels.
// This can take 13-402 milliseconds! Uncomment whichever of the following you want to read
// uint16_t x = tsl.getLuminosity(TSL2561_VISIBLE);
//uint16_t x = tsl.getLuminosity(TSL2561_FULLSPECTRUM);
//uint16_t x = tsl.getLuminosity(TSL2561_INFRARED);
//Serial.println(x, DEC);

// More advanced data read example. Read 32 bits with top 16 bits IR, bottom 16 bits full spectrum
// That way you can do whatever math and comparions you want!
uint32_t lum = tsl.getFullLuminosity();
uint16_t ir, full;
ir = lum >> 16;
full = lum & 0xFFFF;
Serial.print("IR: "); Serial.print(ir); Serial.print("\t\t");
Serial.print("Full: "); Serial.print(full); Serial.print("\t");
Serial.print("Visible: "); Serial.print(full - ir); Serial.print("\t");
Serial.print("Lux: "); Serial.println(tsl.calculateLux(full, ir));
Serial.print("\n");
delay(100);
}

 

 

In this snippet of code, she uses the concept of Bit Math. For more information on this portion of the code read <a title="BitMath" href="http://www.arduino.cc/playground/Code/BitMath">http://www.arduino.cc/playground/Code/BitMath</a>

ir = lum &gt;&gt; 16;

full = lum &amp; 0xFFFF;

&nbsp;

For a simpler example where you just want access to a certain part of the sensor you would use the getLuminosity() function and pass TSL2561_VISIBLE, TSL2561_FULLSPECTRUM, TSL2561_INFRARED into it.

&nbsp;

#include &lt;Wire.h&gt;
#include "TSL2561.h"

// Example for demonstrating the TSL2561 library - public domain!

// connect SCL to analog 5
// connect SDA to analog 4
// connect VDD to 3.3V DC
// connect GROUND to common ground
// ADDR can be connected to ground, or vdd or left floating to change the i2c address

// The address will be different depending on whether you let
// the ADDR pin float (addr 0x39), or tie it to ground or vcc. In those cases
// use TSL2561_ADDR_LOW (0x29) or TSL2561_ADDR_HIGH (0x49) respectively
TSL2561 tsl(TSL2561_ADDR_FLOAT);

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

if (tsl.begin()) {
Serial.println("Found sensor");
} else {
Serial.println("No sensor?");
while (1);
}

// You can change the gain on the fly, to adapt to brighter/dimmer light situations
//tsl.setGain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
tsl.setGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)

// Changing the integration time gives you a longer time over which to sense light
// longer timelines are slower, but are good in very low light situtations!
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)

// Now we're ready to get readings!
}

void loop(void) {
// Simple data read example. Just read the infrared, fullspecrtrum diode
// or 'visible' (difference between the two) channels.
// This can take 13-402 milliseconds! Uncomment whichever of the following you want to read
// uint16_t x = tsl.getLuminosity(TSL2561_VISIBLE);
uint16_t x = tsl.getLuminosity(TSL2561_FULLSPECTRUM);
//uint16_t x = tsl.getLuminosity(TSL2561_INFRARED);
Serial.println(x, DEC);
delay(100);
}

Read more

Working with Rotary Encoders

ITP Fellowship, Tutorials

Comments Closed


Share this post

A rotary encoder is a digital rotary sensor. It has the capability of rotating 360 degrees and can tell you direction. This tutorial is based on Paul Stoffregen’s Encoder library and explanations.

Rotary Encoder

encoder

Inside of a rotary encoder are 2 contacts that are read by the arduino and the center contact grounds the encoder. The rotary encoder has a built in pattern that helps determine the direction you are spinning. The rotary encoder is essentially 2 switches. When Pin 1 goes high you are moving left. When Pin 2 goes high you are going right.

Rotary Encoder

Pin 1 == Low & Pin 2 == Low ==> Position 1

Rotary Encoder

Pin 1 == High & Pin 2 == Low ==> Position 2.  We know that we have moved left.

The arduino pins read the  HIGH and LOW of the pins to determine the direction. To simplify this process we are using this library http://www.pjrc.com/teensy/td_libs_Encoder.html. I used the basic code in the library example.

Arduino

/* Encoder Library - Basic Example</div>
* http://www.pjrc.com/teensy/td_libs_Encoder.html</div>
This example code is in the public domain.
*/

#include &lt;Encoder.h&gt;
// Change these two numbers to the pins connected to your encoder.
//   Best Performance: both pins have interrupt capability
//   Good Performance: only the first pin has interrupt capability
//   Low Performance:  neither pin has interrupt capability
Encoder myEnc(5, 6);
//   avoid using pins with LEDs attached
void setup() {
Serial.begin(9600);
Serial.println("Basic Encoder Test:");
}
long oldPosition  = -999;
void loop() {
long newPosition = myEnc.read();
if (newPosition != oldPosition) {
oldPosition = newPosition;
Serial.println(newPosition);
}
}

As you can see above Pin 5 and Pin 6 are the pins the arduino is going to read in order to determine which pin is high or which pin is low.


encoder serial monitor

Advanced Topic: Inverse Logic and Arduino Pull-up

The Rotary Encoder is essentially 2 switches. This library sets both pins as INPUTS, followed by setting a digitalWrite to HIGH. This engages the arduino’s pull-up resistor for that pin. What the pull-up resistor does it allows a small trickle of positive voltage into the pin. Setting that pin to constantly read HIGH until you rotate the knob where the state would change to LOW. We normally think in HIGH being On and LOW being Off. With Inverse Logic HIGH is your Off state and LOW is your On state. In the case of the rotary encoder, when the pin makes contact with the white area, the encoder makes a connection to ground. Ground is now the path of lease resistance. So no electricity is flowing through the pull-up resistor, thus the pin goes Low. The orange represents the path of least resistance and the flow of electricity.

pullupresistor

Note: This library can use the arduino interrupt pins for better performance.

Read more

ChronoDot and Arduino 1.0

ITP Fellowship, Tutorials

Comments Closed


Share this post

Recently I updated LadyAda’s RTC Library for Arduino 1.0 and older versions. In arduino 1.0 the wire library changed. It is now wire.read and wire.write. I also found that when you do use the write(0), Arduino would interpret the 0 as an integer. The new wire library does not. Because of this I had to explicitly say int i = 0;

The code can be found here https://github.com/adafruit/RTClib

ChronoDot and Arduino

The red wire power goes to 3.3v. Black goes to ground. SDA (Data), the green wire, goes to Analog Pin 4. SCL (Clock), the yellow wire, goes to Analog Pin 5.

Read more

Sparkfun OpAmp Breakout LMV358

ITP Fellowship, Tutorials

Comments Closed


Share this post

The LMV358/LMV324 are low voltage (2.7–5.5V) versions of the dual and quad op amps, LM358/LMV324, which currently operate at 5–30V. If you need to use a piezo as an analog sensor into the arduino, this is the chip and breakout board to use. Most OpAmp chips operate by looking at 2 voltages and amplifying the difference between them.   The chip has a pot that lets you dial in the amplitude of that difference. One thing I noticed is that when I hit the piezo you get negative values. This can be fixed by using an absolute value function. This happens because in order to contain huge spikes in the voltage of a piezo(+30v), the breakout board uses a voltage divider which manages that voltage and sets the output of the OpAmp at 2.5 volts. Tom and I used an oscilloscope to verify this. This is important because the when you hit the piezo it spikes to +5 and to 0. This makes sure that we do not send too much positive voltage to the arduino and negative voltage which would fry it.

http://www.sparkfun.com/products/9816

Sparkfun OpAmp Breakout LMV358

Read more

Adafruit Stepper Gear

Stuff, Tutorials

Comments Closed


Share this post

This Adafruit Stepper Gear has a star shaped post which make is difficult to use in a gear. In inkscape you can go to Extensions > Render > Gear and use these settings to create the star shaped post:

Number of Teeth: 10

Circular Pitch: 6.4

Pressure angle: 10

Read more

Commercial Gallery

Exhibits

Comments Closed


Share this post

I went to 2 galleries in the SoHo area. The first gallery I went to was called the Morrison Hotel. This was a rock and roll photography gallery. It was a very relaxed environment. It mostly focused on 60s and 70s photographs. It had all of the main players, Robert Plant, Hendrix, Jerry Garcia, The Stones, etc. It was a small square space with typical flood lighting. Most of the work was environmental black and white portraits with very simple frames. All of the prints are numbered and most where high numbered prints.

P1020530

The Opera Gallery was the complete opposite. It was a modern art gallery. The top floor was used to show off a specific artist, while the downstairs was more of a general artist space. When you entered the gallery there was a small alcove on the left with a piece which would immediately draw your attention. The rest of the gallery went straight back and ended with a 2 small alcoves at the end on the left and right. The downstairs was a big room with a small partition which divided it into 2 spaces. The lighting was flood lighting which was spotty.

P1020532

The main artist exhibiting was sas + colin. Who focused on these large fiberglass masks.

Read more

Moma: Abstract Expressionists

Exhibits

Comments Closed


Share this post

Moma: Abstract Expressionists

Moma: Abstract Expressionists

The MOMA is redesigning the entrances of there exhibits. The Abstract Expressionist exhibit is a clear example of the new visual style they are going for. They are using large type with high contrasting colors. In this case they flooded 2 walls with this design. I also found it interesting that the automatic doors add this barrier which helps you read the sign when you first get in.

abstractexpressionists

Moma: Abstract Expressionists

The reorganization of the abstract expressionists had a good flow. The scale of the art and the sparsity makes it overwhelming enough. You still get the wow factor. The designers used the rooms to juxtapose the artists. Rothko and Newman are used as the calm rooms to give viewers a break from the Pollock paintings. One of the main breaks in the flow where the Robert Frank Photos by the staircase and the rest of the photography.

Moma: Abstract Expressionists

One of the biggest issues I had with the exhibit was the lighting. The lighting felt spotty. I made a weird gradation between the work. It made the art photograph ok, but the light was not enough to light the room evenly.

Read more

Prototype and Production

Thesis

Comments Closed


Share this post

My thesis system is based on a simple structure. You have an input, it is interpreted and an output is produced. This system is a web application and uses javascript and ruby to create the interaction.  For example, when a button or gesture is activated on a touchscreen, it turns on a light. This is how the system would interpret that: When the button is pressed, a message is fired to update the database, program that connect the microcontroller to the internet, is always checking the database for any change in the database. Since we pressed the button the state was changed. The light turns on. In order for this to happen, the user needs to complete a series of steps before this magic could happen. Users need to design, setup, and display their project. There are 3 tiers of interaction with system. There are a series of users that work with the system. The users have projects associated to them. Those projects have 4 points of interaction. The display, which is was the audience sees. The design, which is the place where the user creates the interface. The setup, which is the area that users setup the translation from gesture to hardware control. And finally, the output, which is what the microcontroller references to know what it should be doing, i.e. turning on a light.

Once users login, they will be taken to there projects area. Here are displayed all of the current projects. Users have quick access to view the 4 main areas: display, design, setup, and output. If the click on the actual project, an overview of the project would appear. There is also an deploy option, which sets the project live and ready for general consumption.

Areas of focus(What will be built out for thesis):

  • Everything except the general diagnostics

Once the user creates a project they now have the option to start designing or setting up the project. In this case we’ll start with design. In this area users will be able to upload code already written or add graphical elements. When a graphical element is placed on the screen the user can drag it around to place it or delete it if not being used.

Areas of focus:

  • Upload code (due to time constrains building an entire layout area is not feasible)

The setup section ties in the audiences interface with the output control. Here the user will add output components and the characteristics the control them. In this case we have a stepper. The stepper has certain attributes, like what pins its connected to, how many steps it has etc. The will also add the input controls which tells the system this button makes this stepper move 20 steps.

Area of focus:

  • The 2 loads I will focus on are steppers and LEDs
  • In the interaction type will be Gesture(being swipes, etc)  and Button

The output area will actually be just so the program and find out its instruction(json). Either software can interpret the json or the actual networked hardware can read it. The user will be able to view this code to be able to create a better stream line interfacing with the microcontroller.

Area of focus:

  • This is a crucial step that needs to be done

Build for thesis:

Online Software (This should happen in the next 2 weeks)

  • 2 displays use cases using gestures
  • User Main area
  • Stepper Form
  • Led Form
  • Gesture Form
  • Button Form
  • Input Interpreter
  • Output Interpreter

Hardware (Rest of the Semester)

  • Software to interpret information coming from online
  • Create 2 turntables
  • Collect information to put in the display cases ie Vase and Elements or Minerals

These are the 2 use cases:

One is a rotating vase that updates content based on how the user rotates it .

Microfind is an exhibit that that focuses on kids exploring common items under a microscope. The exhibit has 2 modes: a learning and exploration and a memory game. Under the learning and exploration kids can click on cells on the interface to move a microscope over the object selected. Interesting information about the objects and a live view the microscope is displayed on the interface. The second mode is a memory game where kids will have to match an image of an object under microscope. The interface will change into a touchpad which will let the kids move the microscope in any direction. Once they match the picture to the live view, it will advance to the next image.


Read more