Friday, May 17, 2013

Internet of food: Arduino-based, urban aquaponics in Oakland

The land in West Oakland where Eric Maundu is trying to farm is covered with freeways, roads, light rail and parking lots so there’s not much arable land and the soil is contaminated. So Maundu doesn’t use soil.

Instead he’s growing plants using fish and circulating water. It’s called aquaponics- a gardening system that combines hydroponics (water-based planting) and aquaculture (fish farming). It’s been hailed as the future of farming: it uses less water (up to 90% less than traditional gardening), doesn’t attract soil-based bugs and produces two types of produce (both plants and fish).

Aquaponics has become popular in recent years among urban gardeners and DIY tinkerers, but Maundu- who is trained in industrial robotics- has taken the agricultural craft one step further and made his gardens
smart.

 


http://faircompanies.com/videos/view/internet-food-arduino-based-urban-aquaponics-in-oakland/

http://www.green-trust.org/wordpress/aquaponics-project/

Sunday, May 12, 2013

Metal Construction Sets for Robotics or Project Assembly

When I was a kid, I used to make cranes, bridges,  and other devices with Erector Sets. Alas, my childhood Erector company is long gone, but a French company called Meccano produces their products in the US under the Erector name. It's not quite the same stuff, and actually is better in my opinion, but not quite compatible. Exacto out of Argentina makes some tougher pieces that conform to the Meccano Standard.

These pieces are great for constructing Arduino projects. You can mount servo's, stepper motors, Arduino boards, and displays, Load cells, or any other adaptation you can think of. You can make Arduino controlled vehicles or robotic arms.

Here's an older document that explains some of the differences, and gives some of the history of the competing standards:

http://www.arrickrobotics.com/erector.txt

Metallus - Meccano compatible http://www.metallus.de/index.php?&page=einzelteile

Exacto - Meccano compatible http://www.exactosystem.com/

Meccano / Erector http://www.meccano.com/ / http://www.erector.us/

Thursday, April 18, 2013

Introducing MySQL Connector/Arduino

Have you ever wanted to use a local database server to store data from your Arduino projects? Would you like to be able to send queries directly to a MySQL database from your Arduino sketch? Well, now you can!

The MySQL Connector/Arduino is a new technology made for the Arduino permitting you to connect your Arduino project to a MySQL server via an Ethernet shield without using an intermediate computer or a web-based service.

Having direct access to a database server means you can store data acquired from your project as well as check values stored in tables on the server and keep the network local to your facility including having a network that isn't connected to the internet or any other network.

The Connector/Arduino library allows you to issue queries to the database server in much the same manner as you would through the MySQL client application. You can insert, delete, and update data, call functions, create objects, etc. Issuing SELECT queries are also possible but they incur a bit more thought concerning memory management.

http://drcharlesbell.blogspot.com/2013/04/introducing-mysql-connectorarduino_6.html

Monday, April 15, 2013

BMA180 Accelerometer

Years ago I saw a neat dash gadget for a Jeep that had two pictures of a Jeep on the unit. As you drove, the two pictures would move, showing pitch and roll angles, with the idea it would help prevent you from tipping over when driving off road.


I received a BMA180 Accelerometer, and decided to build an Arduino version, maybe eventually displaying graphics on a LCD screen. For now I want to get the unit talking to the Arduino, displaying G forces in 3 dimensions:

Pitch (front to back, or X)
Roll (side to side, or Y)
Yaw (pivoting as in a skid, or Z)

I connected a BMA180 breakout as follows:


Although the BMA180 requires a 3.3v input, the TWI interface (SCK/SDI) is 5v logic tolerant.



//BMA180 triple axis accelerometer sample code//
//www.geeetech.com//
//
#include  
#define BMA180 0x40  //address of the accelerometer
#define RESET 0x10
#define PWR 0x0D
#define BW 0X20
#define RANGE 0X35
#define DATA 0x02
//
int offx = 31;
int offy = 47;
int offz = -23;
//
void setup()
{
 Serial.begin(9600);
 Wire.begin();
 Serial.println("Demo started, initializing sensors");
 AccelerometerInit();
 Serial.println("Sensors have been initialized");
}
//
void AccelerometerInit()
//
{
 byte temp[1];
 byte temp1;
  //
  writeTo(BMA180,RESET,0xB6);
  //wake up mode
  writeTo(BMA180,PWR,0x10);
  // low pass filter,
  readFrom(BMA180, BW,1,temp);
  temp1=temp[0]&0x0F;
  writeTo(BMA180, BW, temp1);
  // range +/- 2g
  readFrom(BMA180, RANGE, 1 ,temp);
  temp1=(temp[0]&0xF1) | 0x04;
  writeTo(BMA180,RANGE,temp1);
}
//
void AccelerometerRead()
{
 // read in the 3 axis data, each one is 14 bits
 // print the data to terminal
 int n=6;
 byte result[5];
 readFrom(BMA180, DATA, n , result);

 int x= (( result[0] | result[1]<<8>>2)+offx ;
 float x1=x/4096.0;
 Serial.print("x=");
 Serial.print(x1);
 Serial.print("g");
 //
 int y= (( result[2] | result[3]<<8>>2)+offy;
 float y1=y/4096.0;
 Serial.print(",y=");
 Serial.print(y1);
 Serial.print("g");
 //
 int z= (( result[4] | result[5]<<8>>2)+offz;
 float z1=z/4096.0;
 Serial.print(",z=");
 Serial.print(z1);
 Serial.println("g");
}
//
void loop()
{
 AccelerometerRead();
 delay(300); // slow down output
}
//
//---------------- Functions--------------------
//Writes val to address register on ACC
void writeTo(int DEVICE, byte address, byte val)
{
  Wire.beginTransmission(DEVICE);   //start transmission to ACC
  Wire.write(address);               //send register address
  Wire.write(val);                   //send value to write
  Wire.endTransmission();           //end trnsmisson
}
//reads num bytes starting from address register in to buff array
 void readFrom(int DEVICE, byte address , int num ,byte buff[])
 {
 Wire.beginTransmission(DEVICE); //start transmission to ACC
 Wire.write(address);            //send reguster address
 Wire.endTransmission();        //end transmission

 Wire.beginTransmission(DEVICE); //start transmission to ACC
 Wire.requestFrom(DEVICE,num);  //request 6 bits from ACC

 int i=0;
 while(Wire.available())        //ACC may abnormal
 {
 buff[i] =Wire.read();        //receive a byte
 i++;
 }
 Wire.endTransmission();         //end transmission
 }



As I move the sensor through the X, Y, and Z axis, the serial monitor shows the changing g forces for each axis. Next update will be to show actual angles on a LCD.



Saturday, April 6, 2013

This weeks projects: Load cells, Breadboard Power Supply, Temp / Humidity and more ....

I had a bunch of parts come in this week:

A 85lb. Load Cell (Arduino Scale project)
DHT-11 Temp / Humidity Sensors
Breadboard dual voltage (3.3/5v) power supply
Motion Sensors
3 axis accelerometer

Still in transit:

DHT-22 Temp/Humidity Sensor
Waterproof DS18B20 Temp Sensor

I have my work cut out for me, and updated code and tutorials will be posted. Contact me if you want any of our protoboard projects listed in the various tutorials I post here.

On this load cell (from a Accuteck  W-8260-86W Postal Scale) the 4 wires coming from the load cell are:

Red: Excitation +
White: Signal +
Green: Signal -
Black: Excitation -

This matches the GSE / NCI / Sensotec wiring scheme. To increase the output of the load cell so that the Arduino can read it on an analog input, we will need a INA125P amplifier and a 10 ohm resistor.

* 4/11/13 update: Our free sample INA125P came in today from Texas Instruments. Many electronics manufacturers will send you free samples for prototyping projects. Atmel sent us 3 free 328P-PU processors.


* 4/13/13 update: INA125P came in, circuit is connected and the code uploaded, along with the video.



// Arduino as load cell amplifier
// by Christian Liljedahl 
// christian.liljedahl.dk

// Load cells are linear. So once you have established two data pairs, you can interpolate the rest.

// Step 1: Upload this sketch to your arduino board

// You need two loads of well know weight. In this example A = 10 kg. B = 30 kg
// Put on load A 
// read the analog value showing (this is analogvalA)
// put on load B
// read the analog value B

// Enter you own analog values here
float loadA = 10; // kg
int analogvalA = 200; // analog reading taken with load A on the load cell

float loadB = 30; // kg 
int analogvalB = 600; // analog reading taken with load B on the load cell

// Upload the sketch again, and confirm, that the kilo-reading from the serial output now is correct, using your known loads

float analogValueAverage = 0;

// How often do we do readings?
long time = 0; // 
int timeBetweenReadings = 200; // We want a reading every 200 ms;

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

void loop() {
  int analogValue = analogRead(0);

  // running average - We smooth the readings a little bit
  analogValueAverage = 0.99*analogValueAverage + 0.01*analogValue;

  // Is it time to print? 
  if(millis() > time + timeBetweenReadings){
    float load = analogToLoad(analogValueAverage);

    Serial.print("analogValue: ");Serial.println(analogValueAverage);
    Serial.print("             load: ");Serial.println(load,5);
    time = millis();
  }
}

float analogToLoad(float analogval){

  // using a custom map-function, because the standard arduino map function only uses int
  float load = mapfloat(analogval, analogvalA, analogvalB, loadA, loadB);
  return load;
}

float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}


Our Inspiration:

http://www.controlweigh.com/loadcell_colors.htm
http://cerulean.dk/words/?page_id=42

Saturday, March 23, 2013

Ham Radio for Arduino and Picaxe


Ham Radio Meets Open Source Electronics

Microcontroller technology has exploded in popularity among ham radio operators. The new generation of single-board microcontrollers is easier than ever to use, bringing together hardware and software for project-building most radio amateurs can easily dive into.

With inexpensive microcontroller platforms – such as the popular open-source Arduino board – along with readily available parts, components and accessory boards, the possibilities are limitless: beacon transmitters, keyers, antenna position control, RTTY and digital mode decoders, waterfall displays, and more.

Editor Leigh L. Klotz, Jr, WA5ZNU has assembled this first edition of Ham Radio for Arduino and PICAXE to help introduce you to the rewards of experimenting with microcontrollers. Klotz and many other contributors have designed projects that will enhance your ham radio station and operating capabilities. Or, you can take it to the next step, using these projects as a launch pad for creating your own projects. http://hamradioprojects.com/

Sunday, March 17, 2013

Missing Arduino Analog Inputs, and the Random Function

The Atmel 328P chip used on many of the Arduino boards actually has 8 Analog Inputs, but specifically with the DIP version instead of the SMT, there weren't enough pins on the DIP carrier to bring those ports out for use. On some of the SMT versions, like the Pro Mini, Ports A6 & A7 are available as analog inputs, but not multi purpose (Digital I/O) like A0-A5.

Even on the UNO, which doesn't bring A6 & A7 out to a pin, we can still make use of these ports. The Random function is a common function for many applications, as it seems to provide a random number generator that can be used for dice games, and other applications. However, unless seeded by a varying start number, it actually is quite predictable.

One neat feature of an analog input is referred to as a floating input. This is a input that is not connected to anything. If you try to read it, the values will be all over the place, based on changing electrical fields nearby. We can use either of these two phantom analog inputs as seeds for the random function, ensuring a truly random output.


long randNumber;

void setup(){
  Serial.begin(9600);
  randomSeed(analogRead(A7));
}

void loop(){
  randNumber = random(300);
  Serial.println(randNumber);

  delay(50);
}


More Info:


http://arduino.cc/en/Reference/RandomSeed

http://arduino.cc/en/Reference/Random

http://arduino.cc/en/Reference/AnalogRead