WII NUNCHUCK projects with Arduino Leonardo AVR-T32U4

Image

https://www.olimex.com/Products/Modules/Sensors/MOD-WII/MOD-Wii-UEXT-NUNCHUCK/ 

WII NUNCHUCK is low cost joystick and 3 axes accelerometer combo which could be read by I2C.

We created UEXT plug-in board which allow WII-NUNCHUCK to be used with any of our development boards with UEXT connector.

Here on this video: http://www.youtube.com/watch?v=fXa6AA9Aq_o

you can see four projects made with WII-NUNCHUCK

1. Mouse – you can move the mouse pointer with Joystick and to use the two buttons as mouse buttons

2. Sound – with the 3 axes accelerometer you can change the pitch of the generated tone

3. Driving two servos with the 3-axes accelerometer

4. Drivinig RGB stripe with MOD-RGB and MOD-WII-NUNCHUCK – as AVR-T32U4 have just one UEXT port we use the UEXTx5 extender.

The demo code is at GitHub: https://github.com/OLIMEX/DUINO/tree/master/AVR/WII-NUNCHUCK

New Product: MOD-LED8x8RGB stackable RGB LED MATRIX

Image

MOD-LED8x8RGB is intelligent 8×8 RGB LED module, it allow many modules to be stacked together.

Image

If we look at the back side there are two connectors named EXT-IN and EXT-OUT when two modules are stack together EXT-IN of the one snap to EXT-OUT of the other so both get connected.

MOD-LED8x8RGB works with 5V power supply as you can see on the two sides there are big copper pads named VCC/GND and VCC1/GND1 when modules are snap together permanently (if you make big screen) is good these VCC-VCC1 and GND-GND1 to be connected between the modules so better power distribution is achieved.

Image

to connect MOD-LED8x8RGB you will need ARDUINO working with 5V like OLIMEXINO-32U4 – make sure the power jumper is set to 5V as OLIMEXINO-32U4 can work both on 3.3 and 5V.

Then you should connect OLIMEXINO-32U4 to MOD-LED8x8RGB as on above picture in this way:

  • D13 -> EXT-IN.LATCH
  • 5V -> EXT-IN.VCC
  • GND -> EXT-IN.GND
  • UEXT.MOSI -> EXT-IN.DATA
  • UEXT.CLK -> EXT-IN.SCK

All next MOD-LED8x8RGB modules snap together, if you make new row of modules use jumper wires to connect EXT-OUT of the most right module on the first row to the EXT-IN of the most left module in the next row and etc.

Working with Arduino led8x8rgb.h library:

led8x8rgb.h and font.h are necessary to work with MOD-LED8x8RGB, you can download them from GitHub: https://github.com/OLIMEX/DUINO/tree/master/AVR/MOD-LED8x8RGB

how to use it?

first define how many matrixes you have connected by altering bigX and bigY numbers in led8x8rgb.h

then you can use color variable to set your color from 0 – black to 7- white

there are two other variables cX and cY which define where on screen to print text or characters and these get automatically updated after printing to new position

the library have functions available:

  • drawPixel(x,y) draws drawPixel at X,Y coordinates (1,1) is upper left corner
  • drawLine(x1,y1,x2,y2) draws line
  • drawRectangle(x1,y1,x2,y2) draws rectangle
  • drawSolidRectangle(x1,y1,x2,y2) draws solid rectangle
  • drawElipse(x,y,rx,ry) draws elipse
  • drawCircle(x,y,r) draws circle
  • drawTriangle(x1,y1,x2,y2,x3,y3) draws triangle
  • drawChar(c) – draws char at cX, cY and updates cX, cY
  • drawString(s) – draws string at cX, cY and updates cX, cY
  • lScroll() – scrolls all screen left 1 column
  • rScroll() – scrolls all screen right 1 column
  • scrollCharLeft(c) – scrolls one character from the bottom right matrix to the left
  • scrollCharRight(c) – scrolls one character from the upper left matrix to the right
  • scrollString( s, dir) – scrolls string left or right depend on dir

Restless_Dancer.ino, Sentence.ino and Winking_Face.ino are demo codes made with led8x8rgb.h library.

Note that MOD-LED8x8RGB is not simple shift register matrix, but have microcontroller inside, so once you shift the info IN and LATCH it the microcontroller takes care to refresh the image on the matrix, this way with slow SPI you can drive large displays as no need to permanently shift new and new images to the screen as on the dummy RGB matrixes.

Here is video of the demo code from the GitHUb:

http://www.youtube.com/watch?v=EImDHxnk6Pw

AVR-T32U4 Arduino Leonardo interfacing to LEDs and Buttons in LED game

Image

We create small video tutorial http://www.youtube.com/watch?v=OCd_YFYHWnM how to connect LEDs and Buttons to AVR-T32U4 Arduino Leonardo and create small Game.

The code is on GitHub https://github.com/OLIMEX/DUINO

A10S-OLinuXino ANDROID GPIO control LED toggle app

Image

We got lot of requests on our forum how to control GPIOs from Android.

With the new A10S Android image we decided to play a bit and it appear to be not hard to implement.

We found two ways to do GPIO control running Android.

GPIO using ADB

1. Boot android (from nand or sdcard)

2. Connect USB-to-Serial cable on UART1

3. Open terminal at speed 115200

4. When loading is ready in the terminal type “sh” and enter

5. “ls /sys/class/gpio_sw” will give you a list of all accessable GPIOs.

The GPIOs name is according to the chip ports. For example PE3 is LED1.

6. To set PE3 as output:

#echo 1 > /sys/class/gpio_sw/PE3/mul_sel

or as input

#echo 0 > /sys/class/gpio_sw/PE3/mul_sel

7. To turn on LED:

#echo 1 > /sys/class/gpio_sw/PE3/data

and to turn off:

#echo 0 > /sys/class/gpio_sw/PE3/data

8. If GPIO is as input to read state:

#cat /sys/class/gpio_sw/PE3/data

GPIO using Android SDK

Basicly you should read and write to the filesys. Make sure that your app is running as root, or else nothing will happen.

The demo program toggle LED1 on every button press.  The sources are at GitHub: https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A10S/A10S-ANDROID-GPIO

All read/write methods are realized in GPIO.java file.

The application is with single button and each time you press it it toggles the green LED on the board.

TOGGLE

You can see ToggleLED.apk running at this video: http://www.youtube.com/watch?v=8kTUkJx2TgQ

Arduino Breadboarding with AVR-T32U4

Image

AVR-T32U4 is the easiest way to do breadboard projects with Arduino. With retail price of EUR 12.95 this is also the Arduino board with best price/performance ratio.

As you see from the picture above AVR-T32U4 snap perfectly to Breadboard-1 and it powers the two power buses with 3.3V and GND and you have access to all Arduino pins A0-A5 and D0-D13 on the breadboard area, so you can easily connect to LEDs, Servo Motors,  Sensors etc.

Here is step by step instructions what you have to do to get started.

1. Download Arduino IDE from http://arduino.cc/en/Main/Software; Unpack the downloaded zip file in main drive C:\arduino-1.0.4

2. Plug AVR-T32U4 to your PC and it will ask for drivers, point it to C:\arduino-1.0.4\drivers

3. After the drivers are installed run C:\arduino-1.0.4\arduino.exe

4. Select the board to be Arduino-Leonardo as per attached picture

Image

5. Right mouse click on “My computer” then select Properties-> Hardware-> Device Manager and check which virtual COM port is created when you plug AVR-T32U4.

Image

as you see on the picture in this case COM33 is created by Arduino-Leonardo

6. From Arduino menu select the com port as per attached picture:

Image

6. Open Blink LED project:

Image

7. Upload the sketch by click on -> button

Connect LED with longer led to D13 and shorter leg via 220 ohm to GND.

You should see the LED blinking as on this video: http://www.youtube.com/watch?v=M0cVerSNUDc

Congratulations you just complete your first Arduino project!

We also highly recommend you when you do prototype work to put USB-ISO between your Arduino and PC in this case even if you do some stupid like to make short on your Arduino board or put wrong voltage somewhere your PC will be always protected, so even if your Arduino board burn your computer will be safe.

MOD-RGB – Arduino, Maple and Pinguino Examples

Image

Here we will demoнstrate you how to use our new MOD-RGB LED driver UEXT module with our Arduino, Pinguino and Maple boards which have UEXT connector.

Getting the Libraries and Examples

The library/example .zip files for Arduino, Maple and Pinguino can be downloaded from:
https://www.olimex.com/Products/Modules/LED/MOD-RGB/

Installing the Libraries and examples

For Arduino, use the Fade sketch directly, no additional files or configuration needed.

For Maple:
1. Make sure that the Maple IDE is not running
2. Copy the MODRGB folder to the /libraries folder of your Maple IDE installation folder
3. Start the IDE. The “MODRGB” examples should now appear under File/examples.
4. Include the library in your projects as such:
#include “MODRGB.h”

For Pinguino, use the example directly. It has been tested with PIC32-PINGUINO, PIC32-PINGUINO-OTG, PIC32-PINGUINO-MICRO, PIC32-PINGUINO-MX220

 Examples

All packages include the same example – Fade.

It uses built-in functons or the MODRGB library to set the RED, GREEN and BLUE values that the MOD-RGB board outputs.

The example fades the lights from blue to red to green to blue again in an endless loop.
If you want to adjust the speed at which the colors change, change the value of the delay period to your liking:
#define SPEED 500

ImageImageImage

A13-OLinuXino serving MOD-RGB and WEB-CAM for live stream

Image

In the previous post I wrote how A13-OLinuXino runs Apache server and you can control MOD-RGB strip over the internet, now the A13-OLinuXino service is available online at : http://94.156.100.85:8081/RGB/ you can open this URL and see actually web pages served by A13-OLinuXino

What’s new Dimitar Gmishev did is to connect USB web camera to A13-OLinuXino too, so now you can see the RGB stripe response to the web cntrol.

To see the MOD-RGB stripe via the web cam you need video player – in our case this is open source Kantaris player with Ctrl-B you force it to play stream from internet URL and point it to : http://94.156.100.85:8080 and you will see the web cam video stream, so when you change the RGB color control you see the result on the camera!

Have fun and try it yourself

Previous Older Entries

Follow

Get every new post delivered to your Inbox.

Join 566 other followers