Archive for the ‘Arduino’ Category

30
Apr

The Arduino Pro Mini is intended for advanced users who require flexibility, low-cost, and small size. It comes with the minimum of components (no on-board USB or pin headers) to keep the cost down. It’s a good choice for a board you want to leave embedded in a project. Please note that there are two versions of the board: one that operates at 5V (like most Arduino boards), and one that operates at 3.3V. Be sure to provide the correct power and use components whose operating voltage matches that of the board.

 

Uploading Sketches

The board comes without built-in USB circuitry, so an off-board USB-to-TTL serial convertor must be used to upload sketches. This can be a FTDI TTL-232R USB – TTL Level Serial Converter Cable for the 5V Arduino Mini Pro), or a FTDI TTL-232R-3V3 USB – TTL Level Serial Converter Cable or the SparkFun FTDI Basic Breakout Board for a 3.3V Arduino Mini Pro. One quick way to connect these is by inserting a six-pin 0.1″ male pin header into the end of the FTDI cable or breakout board, and pressing it against the six hole programming header on the Mini Pro. If, however, you’re going to be uploading lots of sketches to your Pro Mini, you’ll probably want to solder some pins (male headers) to the holes.

 

If using the FTDI cable on Windows, you’ll need to make one configuration change to enable the auto-reset. With the board connected, open the Device Manager (in Control Panels > System > Hardware), and find the USB Serial Port under Ports. Right-click and select properties, then go to Port Settings > Advanced and check Set RTS on Close under Miscellaneous Options.

 

For the 3.3V versions of the Arduino Pro Mini, select Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328 orArduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega168 from the Tools > Board menu (depending on the microcontroller on your board). For the 5V versions of the Arduino Pro Mini, select Arduino Duemilanove or Nano w/ ATmega328 or Arduino Diecimila, Duemilanove, or Nano w/ ATmega168.

 

 

 

 

The Arduino Pro Mini connected to (and powered by) an FTDI TTL-232R-3V3 USB – TTL Level Serial Converter Cable. The green and black wires align with the labels “GRN” and “BLK” written next to the holes.

 

 

 

 

The Arduino Pro Mini connected to (and powered by) a SparkFun FTDI Basic Breakout Board and USB Mini-B cable. Note that on earlier Pro Mini boards the orientation of the 6-pin header may be reversed; check that the words GRN and BLK align on the Pro Mini and FTDI Basic Breakout.

 

 

 

Power

The board can be powered through USB via the six-pin programming header, or from a regulated 5V or 3.3V (depending on the model) supply applied to the VCC pin or an unregulated supply on the RAW pin.

 

Connectors

Any standard 0.1″ spaced header can be soldered to the holes on the Arduino Pro Mini. To use every pin requires two 12-pin headers, plus a six pin header for programming, if desired. Bare wire can also be soldered directly to the holes.

 

The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the public domain.

30
Apr

The Arduino Wireless shield allows your Arduino board to communicate wirelessly using Zigbee. This documentation describes the use of the shield with the XBee 802.15.4 module (sometimes called “Series 1″ to distinguish them from the Series 2 modules, although “Series 1″ doesn’t appear in the official name or product description).

 

A Simple Example

You should be able to get two Arduino boards with Wireless shields talking to each other without any configuration, using just the standard Arduino serial commands (described in the reference).

 

To upload a sketch to an Arduino board with a Wireless shield, remove the Xbee. Then, you can upload a sketch normally from the Arduino environment. In this case, upload the Communication | Physical Pixel sketch to one of the boards. This sketch instructs the board to turn on the LED attached to pin 13 whenever it receives an ‘H’ over its serial connection, and turn the LED off when it gets an ‘L’. You can test it by connecting to the board with the Arduino serial monitor (be sure it’s set at 9600 baud), typing an H, and pressing enter (or clicking send). The LED should turn on. Send an L and the LED should turn off. If nothing happens, you may have an Arduino board that doesn’t have a built-in LED on pin 13 (see theboard index to check for sure), in this case you’ll need to supply your own.

 

Once you’ve uploaded the Physical Pixel sketch and made sure that it’s working, unplug the first Arduino board from the computer. Change the switch to the Micro setting. Now, you need to upload a sketch to the other board. Make sure its switch is in the USB setting. Then upload the following sketch to the board:

 

 

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

void loop()
{
Serial.print('H');
delay(1000);
Serial.print('L');
delay(1000);
}

 

 

When it’s finished uploading, you can check that it’s working with the Arduino serial monitor. You should see H’s and L’s arriving one a second. Turn off the serial monitor and unplug the board. Change the switch to the Micro setting. Now connect both boards to power. After a few seconds, you should see the LED on the first board turn on and off, once a second. (This is the LED on the Arduino board itself, not the one on the Xbee shield, which conveys information about the state of the Xbee module.) If so, congratulations, your Arduino boards are communicating wirelessly.

 

A Few Notes

You can use any of the standard Arduino serial commands with the Xbee shield. With the switch in the Micro position, the print and println commands will send data over the Xbee shield and the USB connection (i.e. to other Xbee shields and to the computer at the same time). In this configuration, however, the board will only receive data from the Xbee shield not from the USB connection.

 

The Xbee module on the shield is set up to work at 9600 baud by default, so unless you reconfigure it, you’ll need to make sure you’re passing 9600 to the Serial.begin() command in your sketch.

 

To allow your computer to communicate directly with the Xbee shield, connect it to an Arduino board whose microcontroller has been removed and place the switch in the USB configuration. Then you can send data to and receive data from the Xbee module from any terminal program. This allows you, for example, to see the data that the module is receiving from other Xbee shields (e.g. to collect sensor data wirelessly from a number of locations).

 

Configuring the Xbee Module

You can configure the Xbee module from code running on the Arduino board or from software on the computer. To configure it from the Arduino board, you’ll need to have the switch in the Micro position. To configure it from the computer, you’ll need to have the switch in the USB position and have removed the microncontroller from your Arduino board.

 

To get the module into configuration mode, you need to send it three plus signs: +++ and there needs to be at least one second before and after during which you send no other character to the module. Note that this includes newlines or carriage return characters. Thus, if you’re trying to configure the module from the computer, you need to make sure your terminal software is configured to send characters as you type them, without waiting for you to press enter. Otherwise, it will send the plus signs immediately followed by a newline (i.e. you won’t get the needed one second delay after the +++). If you successfully enter configuration mode, the module will send back the two characters ‘OK’, followed by a carriage return.

 

Send Command Expected Response
+++ OK<CR>

 

Once in configuration mode, you can send AT commands to the module. Command strings have the form ATxx (where xx is the name of a setting). To read the current value of the setting, send the command string followed by a carriage return. To write a new value to the setting, send the command string, immediately followed by the new setting (with no spaces or newlines in-between), followed by a carriage return. For example, to read the network ID of the module (which determines which other Xbee modules it will communicate with), use the ‘ATID command:

 

Send Command Expected Response
ATID<enter> 3332<CR>

 

To change the network ID of the module:

 

Send Command Expected Response
ATID3331<enter> OK<CR>

 

Now, check that the setting has taken effect:

 

Send Command Expected Response
ATID<enter> 3331<CR>

 

Unless you tell the module to write the changes to non-volatile (long-term) memory, they will only be in effect until the module loses power. To save the changes permanently (until you explicitly modify them again), use the ATWR command:

 

Send Command Expected Response
ATWR<enter> OK<CR>

 

To reset the module to the factory settings, use the ATRE command:

 

Send Command Expected Response
ATRE<enter> OK<CR>

 

Note that like the other commands, the reset will not be permanent unless you follow it with the ATWR comamand.

 

References

For more information, see: the hardware page for the Xbee shield, and the Digi Xbee page. The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the public domain.

12
Apr

The RoboTurret Vision Tracking Kit is an industry first! Never before has it been so easy and so inexpensive to jump into the world of machine vision! Trossen Robotics has teamed up with RoboRealm to bring this fantastic kit to experimenters everywhere. Included with this kit is the Desktop RoboTurret, a Microsoft Lifecam VX-800 with mounting solution, and a full license to the easy to use yet powerful RoboRealm  Machine Vision software! The Desktop RoboTurret  is fully supported within Roborealm with its own interface module, providing a GUI for easy control of the pan/tilt and the various I/O features of the board. There is also a demo Roborealm program available that can be used to track different colored objects using this kit; a great starting point for your next machine vision project!

This easy to build kit is based around the exclusive MosquitIO Pan & Tilt Microcontroller  and includes everything needed to build a fully programmable, Arduino-compatible Pan & Tilt platform. Add webcams, lasers, airsoft guns, a variety of sensors to the available I/O, up to two small motors, and switch things on and off with the built-in solid-state relay! The MosquitIO  can also be custom programmed using the Arduino IDE for autonomous behavior using sensory input, or a variety of other custom applications- your imagination is the limit!

 

For more details watch the video mentioned below:

 

http://www.youtube.com/watch?v=o3hJOMQjNwo&feature=player_embedded

24
Mar

Inverse kinematics is a method to position a tip of some linked stricture in 3D space by calculating joint angles from tip X, Y, and Z coordinates. To move the arm, six servos need to be controlled ( five for the arm without wrist rotate ). Given that large amount of processing time would be spent calculating servo angles, I decided not to drive servos directly from Arduino pins and made simple servo shield using Renbotics schematic and library code. I built only half of the circuit using single 4017 counter – this gives me seven servo control channels, which is plenty.

Below is a inverse kinematics code. It can be used as-is or transformed into a library. As presented, it shall be used with caution – no boundary check is performed so it is quite easy to inadvertently send the arm flying into your forehead or the control board. The code uses single-precision floating point math, which seems to be adequate for the task.

#include <servoShield.h>
/* Servo control for AL5D arm */

/* Arm dimensions( mm ) */
#define BASE_HGT 67.31      //base hight 2.65"
#define HUMERUS 146.05      //shoulder-to-elbow "bone" 5.75"
#define ULNA 187.325        //elbow-to-wrist "bone" 7.375"
#define GRIPPER 100.00          //gripper (incl.heavy duty wrist rotate mechanism) length 3.94"

#define ftl(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))  //float to long conversion

/* Servo names/numbers */
/* Base servo HS-485HB */
#define BAS_SERVO 0
/* Shoulder Servo HS-5745-MG */
#define SHL_SERVO 1
/* Elbow Servo HS-5745-MG */
#define ELB_SERVO 2
/* Wrist servo HS-645MG */
#define WRI_SERVO 3
/* Wrist rotate servo HS-485HB */
#define WRO_SERVO 4
/* Gripper servo HS-422 */
#define GRI_SERVO 5

/* pre-calculations */
float hum_sq = HUMERUS*HUMERUS;
float uln_sq = ULNA*ULNA;

ServoShield servos;                       //ServoShield object

void setup()
{
  servos.setbounds( BAS_SERVO, 900, 2100 );
  servos.setbounds( SHL_SERVO, 1000, 2100 );
  servos.setbounds( ELB_SERVO, 900, 2100 );
  servos.setbounds( WRI_SERVO, 600, 2400 );
  servos.setbounds( WRO_SERVO, 600, 2400 );
  servos.setbounds( GRI_SERVO, 600, 2400 );
  /**/
  servos.start();                         //Start the servo shield
  servo_park();
  Serial.begin( 115200 );
  Serial.println("Start");
  delay( 500 );
}

void loop()
{

  //zero_x();
  //line();
  circle();
 }

/* arm positioning routine utilizing inverse kinematics */
/* z is height, y is distance from base center out, x is side to side. y,z can only be positive */
//void set_arm( uint16_t x, uint16_t y, uint16_t z, uint16_t grip_angle )
void set_arm( float x, float y, float z, float grip_angle_d )
{
  float grip_angle_r = radians( grip_angle_d );    //grip angle in radians for use in calculations
  /* Base angle and radial distance from x,y coordinates */
  float bas_angle_r = atan2( x, y );
  float rdist = sqrt(( x * x ) + ( y * y ));
  /* rdist is y coordinate for the arm */
  y = rdist;
  /* Grip offsets calculated based on grip angle */
  float grip_off_z = ( sin( grip_angle_r )) * GRIPPER;
  float grip_off_y = ( cos( grip_angle_r )) * GRIPPER;
  /* Wrist position */
  float wrist_z = ( z - grip_off_z ) - BASE_HGT;
  float wrist_y = y - grip_off_y;
  /* Shoulder to wrist distance ( AKA sw ) */
  float s_w = ( wrist_z * wrist_z ) + ( wrist_y * wrist_y );
  float s_w_sqrt = sqrt( s_w );
  /* s_w angle to ground */
  //float a1 = atan2( wrist_y, wrist_z );
  float a1 = atan2( wrist_z, wrist_y );
  /* s_w angle to humerus */
  float a2 = acos((( hum_sq - uln_sq ) + s_w ) / ( 2 * HUMERUS * s_w_sqrt ));
  /* shoulder angle */
  float shl_angle_r = a1 + a2;
  float shl_angle_d = degrees( shl_angle_r );
  /* elbow angle */
  float elb_angle_r = acos(( hum_sq + uln_sq - s_w ) / ( 2 * HUMERUS * ULNA ));
  float elb_angle_d = degrees( elb_angle_r );
  float elb_angle_dn = -( 180.0 - elb_angle_d );
  /* wrist angle */
  float wri_angle_d = ( grip_angle_d - elb_angle_dn ) - shl_angle_d;

  /* Servo pulses */
  float bas_servopulse = 1500.0 - (( degrees( bas_angle_r )) * 11.11 );
  float shl_servopulse = 1500.0 + (( shl_angle_d - 90.0 ) * 6.6 );
  float elb_servopulse = 1500.0 -  (( elb_angle_d - 90.0 ) * 6.6 );
  float wri_servopulse = 1500 + ( wri_angle_d  * 11.1 );

  /* Set servos */
  servos.setposition( BAS_SERVO, ftl( bas_servopulse ));
  servos.setposition( WRI_SERVO, ftl( wri_servopulse ));
  servos.setposition( SHL_SERVO, ftl( shl_servopulse ));
  servos.setposition( ELB_SERVO, ftl( elb_servopulse ));

}

/* move servos to parking position */
void servo_park()
{
  servos.setposition( BAS_SERVO, 1715 );
  servos.setposition( SHL_SERVO, 2100 );
  servos.setposition( ELB_SERVO, 2100 );
  servos.setposition( WRI_SERVO, 1800 );
  servos.setposition( WRO_SERVO, 600 );
  servos.setposition( GRI_SERVO, 900 );
  return;
}

void zero_x()
{
  for( double yaxis = 150.0; yaxis < 356.0; yaxis += 1 ) {
    set_arm( 0, yaxis, 127.0, 0 );
    delay( 10 );
  }
  for( double yaxis = 356.0; yaxis > 150.0; yaxis -= 1 ) {
    set_arm( 0, yaxis, 127.0, 0 );
    delay( 10 );
  }
}

/* moves arm in a straight line */
void line()
{
    for( double xaxis = -100.0; xaxis < 100.0; xaxis += 0.5 ) {
      set_arm( xaxis, 250, 100, 0 );
      delay( 10 );
    }
    for( float xaxis = 100.0; xaxis > -100.0; xaxis -= 0.5 ) {
      set_arm( xaxis, 250, 100, 0 );
      delay( 10 );
    }
}

void circle()
{
  #define RADIUS 80.0
  //float angle = 0;
  float zaxis,yaxis;
  for( float angle = 0.0; angle < 360.0; angle += 1.0 ) {
      yaxis = RADIUS * sin( radians( angle )) + 200;
      zaxis = RADIUS * cos( radians( angle )) + 200;
      set_arm( 0, yaxis, zaxis, 0 );
      delay( 1 );
  }
}
The youtube video for the demonstration is: http://www.youtube.com/watch?v=nz_tgDD8FNw

30
Dec

The Grow Light
The Exhaust Fan that pulls air out of the room, through the grow light fixture
A Heater
The controller has the ability to log the temperature and humidity readings with a time stamp to an SD card. It also logs events such as the powering on and off of appliances in a separate file in the same directory. The file directory structure is as follows: “YEAR\MM\DD\” and there is an event and data log for each day.

It is composed of the following components:
Arduino Mega 1280 (I’m sure with some code adjustments it could work with an Arduino Uno, but currently the sketch is almost 32Kb it would require down-scaling)
SHT15 Digital Temperature and Humidity Sensor
DS1307 Real-time Clock w/ Rechargeable coin-cell battery
Serial 2×16 Alphanumeric LCD Display
SD card mounted on Ethernet Shield (I don’t use the Ethernet for this project, just the SD interface)
3 NPN Transistors that activate relays that control the grow light, heater and exhaust fan (I use 2 PowerSwitch Tails and a Relay from Sparkfun)

01
Dec

Even though there is a large number of different types of microcontrollers and even more programs created for their use only, all of them have many things in common. Thus, if you learn to handle one of them you will be able to handle them all. A typical scenario on the basis of which it all functions is as follows:

  • Power supply is turned off and everything is still…the program is loaded into the microcontroller, nothing indicates what is about to come…
  • Power supply is turned on and everything starts to happen at high speed! The control logic unit keeps everything under control. It disables all other circuits except quartz crystal to operate. While the preparations are in progress, the first milliseconds go by.
  • Power supply voltage reaches its maximum and oscillator frequency becomes stable. SFRs are being filled with bits reflecting the state of all circuits within the microcontroller. All pins are configured as inputs. The overall electronis starts operation in rhythm with pulse sequence. From now on the time is measured in micro and nanoseconds.
  • Program Counter is set to zero. Instruction from that address is sent to instruction decoder which recognizes it, after which it is executed with immediate effect.
  • The value of the Program Counter is incremented by 1 and the whole process is repeated…several million times per second.

28
Nov

                  Wiring is an open source electronics prototyping platform composed of a programming environment (IDE), an electronics prototyping board, documentation thoughtfully created with designers and artists in mind and a community where experts, intermediate and beginners from around the world share ideas, knowledge and their collective experience.
The Wiring i/o board is a small, cheap standalone computer with many connection capabilities. It can be easily programmed in a variant of the Processing language, with a similar programming environment. The board can control all kinds of sensors and actuators. Sensors allow the board to acquire information from the surrounding environment (temperature sensors, light sensors, distance sensors, etc). Actuators are devices that allow the board to create changes in the physical world (lights, motors, heating devices, etc). It can also interact easily with other devices and computers, such as your PC/Mac, GPS receivers, barcode readers.

Wiring is an open project initiated by Hernando Barragán (University of Los Andes, Architecture and Design School). It builds on Processing, the open source progra programming language and environment initiated by Ben Fry and Casey Reas. Arduino was inpired by Wiring and is basically the same thing. It is programmed in the Wiring language.

, , , , , , , , , , , , , , , , , , ,

28
Nov

Fritzing is an open source  software initiative  to support designers and artists ready to move from physical prototyping to actual product. It was developed at the University of Applied Sciences of Potsdam.

The software is created in the spirit of processing and Arduino and allows a designer, artist, researcher, or hobbyist to document their Arduino-based prototype and create a PCB layout for manufacturing. The complementary website helps to share and discuss drafts and experiences as well as to reduce manufacturing costs. In other words, they make electronic items from your design.

Fritzing can be seen as an Electronic Design Automation (EDA) tool for non-engineers: the input metaphor is inspired by the environment of designers (the bread board-based prototype), the output is offering nearly no options and is focused on accessible means of production.

, , , , , , , , , , , , , , , , ,

27
Nov

Arduino is a single-board microcontroller with an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. The hardware consists of a simple open hardware design for the Arduino board with an Atmel AVR processor and on-board input/output support. The software consists of a standard programming language compiler and the boot loader that runs on the board.

Arduino hardware is programmed using a Wiring-based language is similar to C++ with some simplifications and modifications, and a Processing-based integrated development environment. Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators.

, , , , , , , , , , , , , , ,

28
Jun

QkCtrl Serial BT adds a programmable Bluetooth remote control to your electronics projects. QkCtrl Serial BT enables you to design custom controls that let you easily communicate with serial devices over Bluetooth. It’s simple and takes very little to integrate into your projects.

QkCtrl Serial BT was designed with the Arduino microcontroller in mind. However, it should work with most projects that support serial communication and most Bluetooth transceivers that support SPP. Check out a sample project on the kvndev’s website to see how you can implement QkCtrl Serial BT into your project.
Read More

, , , , , ,