Posts | Comments

Planet Arduino

Archive for the ‘mini’ Category

There’s building small computers — like the Raspberry Pi — and then there’s building small computers — like this Desktop Viewer from Star Trek.

[Monta Elkins] is using a Beetle for this project; it’s an Arduino clone, hosting the ATMega32U4 microcontroller, with a unique feature that allows you to twist connecting wires to secure them to the board. Instead, [Elkins] went with the logical choice of soldering them. For a display, he used a SPI serial OLED 128 x 64 monochrome screen which he has cycling through a number of iconic Star Trek TOS symbols and animations. The images were converted into PROGMEM  — which gets loaded into flash memory — before finally being uploaded to the Beetle.

Following some fine 3D print work in ABS plastic which rendered the Desktop Viewer’s case, [Elkins] used acetone to solvent-weld the pieces together and applied a quick coat of paint to finish it off. This little replica would make a great desktop gadget as it requires a micro-USB to power the device.

While this little display ornaments your workspace, you can further dazzle any visitors with a pneumatic door and your LCARS-inspired home automation system.


Filed under: 3d Printer hacks, Arduino Hacks

Instructables user [Team_Panic] — inspired by the resurgence of robot battle arena shows — wanted to dive in to his local ‘bot building club. Being that they fight at the UK ant weight scale with a cap of 150 grams, [Team_Panic] built a spunky little Arduino Mini-controlled bot on the cheap.

The Instructable is aimed at beginners, and so is peppered with sound advice. For instance, [Team_Panic] advises building from “the weapon out” as that dictates how the rest of the robot will come together around it. There are also some simple design considerations on wiring and circuit boards considering the robot in question will take a few hits, as well as instructions to bring the robot together. To assist any beginners in the audience, [Team_Panic] has provided his design for a simple, “slightly crude,” wedge-bot, as well as his code. Just don’t forget to change the radio pipe so you aren’t interfering with other bots!

Arduino Wedge Bot OpenArduino Wedge Bot Controller[Team_Panic] concludes by urging any prospective roboteers to pay attention to the rules and regulations of their local robo battle clubs and have fun! He really pump up the robot battle community — and we’re hard-pressed to argue with such helpful enthusiasm. Meanwhile, the world is still waiting for the epic, giant robo-showdown of the century.


Filed under: 3d Printer hacks, Arduino Hacks, robots hacks
Mar
03

Arduino USB-to-Serial Tutorial – Programming the Pro Mini

arduino, CP2102, FT232RL, mini, PL2032HX, Pro, USB to RS232, USB to Serial Commenti disabilitati su Arduino USB-to-Serial Tutorial – Programming the Pro Mini 

Julian Ilett show us how to program the Pro Mini Arduino using a simple USB to Serial adapter. Three USB to Serial adapter are tested here. He writes:

Here I attempt to use 3 different USB to Serial modules to program a clone Arduino Pro Mini. The chips are the FTDI FT232RL, the Silicon Labs CP2102 and the Prolific Technologies PL2032HX.

Arduino USB-to-Serial Tutorial – Programming the Pro Mini - [Link]

Ago
01

Review – adafruit industries Mini 8×8 LED Matrix with I2C backpack

16K33, adafruit, arduino, demonstration, graphic, holtek, i2c, LED, LED matrix, lesson, matrix, mini, review, scrolling, text, tronixstuff, tutorial Commenti disabilitati su Review – adafruit industries Mini 8×8 LED Matrix with I2C backpack 

Introduction

In this review we have a look at the mini 8×8 LED matrix with I2C backpack from adafruit industries. It looked like a small yet versatile display unit for a couple of project ideas, so as part of the evaluation we’ll run through it with you here. As you can see below, it’s quite small with a 20mm square matrix:

contents

The matrix and the controller are seperate which gives you the option of ordering different colours of matrix. Using LED matrices can be a pain, however these units use the Holtek 16K33 controller IC (data sheet) which has an I2C interface – much easier than the usual mess of shift registers and I/O pins:

holtek

 Furthermore you can change the I2C address using the solder pads on the PCB, giving you four possible options. And as it’s I2C, you can use it with other microcontrollers with a little detective work. Moving forward, we’ll assemble the display then explain how to use it with an Arduino, and show a few demonstrations.

Assembly

There really isn’t anything major to do, just solder the matrix to the backpack and some header pins if you need them. adafruit include some however I’m using the 90-degree ones for my own use:

solderingpins

The soldering should take about one minute tops, and then you’re done:

finished

Using the matrix

From a hardware perspective you only have four wires – 5V, GND, SDA and SCL. Yes – it’s a 5V part, so all you Raspberry Pi fans will need a level shifter, which you can get from adafruit as well. Anyhow once you’ve got it connected to your Arduino, a couple of libraries are required – the matrix and GFX libraries. Be sure to install them in your sketchbook/libraries folder and not the usual location. When saving the library files, call the first folder Adafruit_LEDBackpack and the second Adafruit_GFX as they don’t arrive in that format.

Now for a quick demonstration, it’s simply one from the included library. The display is very bright, so I had to reduce the exposure on the camera which makes the background a little dark – but you get the idea:

A pair of those fitted to a dummy or doll would be quite interesting, or make good eyes for a 21st century “Metal Mickey”. Well that’s quite interesting, so how do you in fact display things on the matrix? I’ve deconstructed a few examples to show you how it’s done.

No matter what, you need to include the libraries, define the matrix object in the sketch and then start it with the matching I2C address – for example:

// required libraries
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

// define matrix object
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() 
{
  // start the matrix at I2C address - default is 0x70
  matrix.begin(0x70);  // pass in the address
}

To scroll text across the display, modify the following chunk of code:

matrix.setRotation(0);
  matrix.setTextSize(1);
  matrix.setTextWrap(false); // false means nice scroll, true means each character appears, scrolls off, then repeat
  matrix.setTextColor(LED_ON);
  for (int8_t x=0; x>=-96; x--) // 96 is number of characters to display x 8
  {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Hello, world");
    matrix.writeDisplay();
    delay(100);
  }

First, the setRotation() value is 0~3 and determines which way the text scrolls across the screen. This is useful if you mount the matrix in different positions, as you can still keep the text scrolling in a readable manner. Next, matrix.setTextWrap() – leave this as false,  as true displays each character and then just scrolls it in turn – looking rather odd. Now multiply the number of characters you want to display by 8, and replace the number -96 with negative your value and of course “Hello, world”. Finally follow with rest of the code. There’s a quick demonstration of this code in the sketch and video below:

// required libraries
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

// define matrix object
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

void setup() 
{
  // start the matrix at I2C address - default is 0x70
  matrix.begin(0x70);  // pass in the address
}

void loop()
{
  matrix.setRotation(0);
  matrix.setTextSize(1);
  matrix.setTextWrap(false); // false means nice scroll, true means each character appears, scrolls off, then repeat
  matrix.setTextColor(LED_ON);
  for (int8_t x=0; x>=-96; x--) // 96 is number of characters to display x 8
  {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Hello, world");
    matrix.writeDisplay();
    delay(100);
  }

  delay(500);
  matrix.setRotation(1);  
  matrix.setTextSize(1);
  matrix.setTextWrap(false); // false means nice scroll, true means each character appears, scrolls off, then repeat
  matrix.setTextColor(LED_ON);
  for (int8_t x=0; x>=-96; x--) // 96 is number of characters to display x 8
  {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Hello, world");
    matrix.writeDisplay();
    delay(100);
  }  

  delay(500);
  matrix.setRotation(2);  
  matrix.setTextSize(1);
  matrix.setTextWrap(false); // false means nice scroll, true means each character appears, scrolls off, then repeat
  matrix.setTextColor(LED_ON);
  for (int8_t x=0; x>=-96; x--) // 96 is number of characters to display x 8
  {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Hello, world");
    matrix.writeDisplay();
    delay(100);
  }  

  delay(500);
  matrix.setRotation(3);  
  matrix.setTextSize(1);
  matrix.setTextWrap(false); // false means nice scroll, true means each character appears, scrolls off, then repeat
  matrix.setTextColor(LED_ON);
  for (int8_t x=0; x>=-96; x--) // 96 is number of characters to display x 8
  {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Hello, world");
    matrix.writeDisplay();
    delay(100);
  }  
}

 

Now for some graphics. You can define your own images (!) and store them in an array. Each arrays consists of eight bytes, each representing a row of the matrix. You can use binary to help visualise the results, for example:

static uint8_t PROGMEM
  crosshatch[] =
  { B10101010,
    B01010101,
    B10101010,
    B01010101,
    B10101010,
    B01010101,
    B10101010,
    B01010101 };

and then to display that on the matrix, use the following:

matrix.clear(); // clear the display
matrix.drawBitmap(0, 0, crosshatch, 8, 8, LED_ON); // setup the image to display
matrix.writeDisplay(); // display the image
delay(1000);

… which resulted with:

crosshatch

To control individual pixels, send one or more of the following:

matrix.drawPixel(x, y, LED_ON);

where x and y are the pixel’s coordinates (that fall between zero and seven), followed by:

matrix.writeDisplay();

Here’s a neat example sketch and video of a single pixel “running around the border”:

// required libraries
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

// define matrix object
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

int z;

void setup() 
{
  // start the matrix at I2C address - default is 0x70
  matrix.begin(0x70);  // pass in the address
}

void loop()
{
  matrix.clear();      // clear display
  for (z=0; z<8; z++)
  {  
    matrix.drawPixel(z, 0, LED_ON);  
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(50);
    matrix.drawPixel(z, 0, LED_OFF);  
    matrix.writeDisplay();  // write the changes we just made to the display     
  }  

  for (z=0; z<8; z++)
  {  
    matrix.drawPixel(7, z, LED_ON);  
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(50);
    matrix.drawPixel(7, z, LED_OFF);  
    matrix.writeDisplay();  // write the changes we just made to the display     
  }  

  for (z=7; z>=0; --z)
  {  
    matrix.drawPixel(z, 7, LED_ON);  
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(50);
    matrix.drawPixel(z, 7, LED_OFF);  
    matrix.writeDisplay();  // write the changes we just made to the display     
  }  

  for (z=7; z>=0; --z)
  {  
    matrix.drawPixel(0, z, LED_ON);  
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(50);
    matrix.drawPixel(0, z, LED_OFF);  
    matrix.writeDisplay();  // write the changes we just made to the display     
  }  
}

By this point you should be getting the hang of things now, so we’ll finish up with the last three graphic functions at once. To draw a line between x1, y1 and x2, y2 – use:

matrix.drawLine(x1 ,y1 , x2, y2, LED_ON);

To draw a rectangle with corners at x1, y2, x2, y2 – use:

matrix.drawRect(x1, y1, x2, y2, LED_ON);

To draw a filled rectangle with corners at x1, y2, x2, y2 – use:

matrix.fillRect(x1, y1, x2, y2, LED_ON);

And to draw a circle with axis at x,y and a radius of r pixels – use:

matrix.drawCircle(x, y, r, LED_ON);

Now we’ll put those functions into the following sketch and video:

// required libraries
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

// define matrix object
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();

int y, z;

void setup() 
{
  // start the matrix at I2C address - default is 0x70
  matrix.begin(0x70);  // pass in the address
}

void loop()
{
  // circles
  for (y=0; y<5; y++)
  {
    for (z=0; z<8; z++)
    {
      matrix.clear();
      matrix.drawCircle(3,3, z, LED_ON);
      matrix.writeDisplay();  // write the changes we just made to the display
      delay(100);
    }
  }

  for (y=0; y<=5; y++)
  {
    // rectangles
    matrix.clear();
    matrix.drawRect(0, 0, 4, 4, LED_ON);
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(250);
    matrix.clear();
    matrix.drawRect(4, 0, 4, 4, LED_ON);
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(250);
    matrix.clear();
    matrix.fillRect(4, 4, 7, 7, LED_ON);
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(250);
    matrix.clear();
    matrix.fillRect(0, 4, 4, 7, LED_ON);
    matrix.writeDisplay();  // write the changes we just made to the display
    delay(250);
  }
}

 

If you want to get someone’s attention, you can blink whatever’s on the matrix at various frequencies – and of course turn it off. In the following function, use 0 for off, and 1~3 for different rates:

matrix.blinkRate(x);

Finally, you can also adjust the brightness to one of sixteen levels (0~15) using:

matrix.setBrightness(level); // level: 0~15

That’s enough blinkiness for now. Remember the library is just shielding you from the raw I2C commands, so if you want to create your own functions or use a non-Arduino board – examine the library and the data sheet.

Conclusion

The backpack makes using the matrix an absolute breeze, and the library saves a lot of time and effort – leaving you to get on with creating your ideas into projects. You can get the matrix from adafruit and their distributors.

Full-sized images available on flickr.  And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

[Note - item purchased without notifying the supplier]

The post Review – adafruit industries Mini 8×8 LED Matrix with I2C backpack appeared first on tronixstuff.



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook