r0sset.com - Microcontroller, Software und Photos

8x8 RGB DOT Matrix Display

This Project is a Driver for a 8*8 RGB Dot Matrix Display. It is created for the YSM-2388CRGBC Panel. The aim is to create at least a 16 bit color image. Another goal is to drive the framerate when updating the image over RS232 from the computer as high as possible.

RGB LED Streifen

Ziel dieses Projektes war es ein LED Lauflicht zu erstellen um Sachen in den Himmel zu malen.

Features:

  • 74HC595 Schieberegister
  • 5mm RGB LEDs mit gemeinsamer Annode
  • Porgammierung der LEDs mit SPI
  • Mikrocontroller Atmel Atmege 168

Enable I2C On the Raspberry PI

To Enable I2C on the Raspberry Pi several initialisation steps will have to be performed.
  • Update all Packages
  • Update Rasperry Firmware
  • Install the I2C Kernel
  • Load the I2C Modules

Serial Communication over the Windows API with MinGW

To communicate with my microcontroller a connection over an USB serial port is needed. When searching for information on how to setup a serial connection in Windows i didn't find any useful information on how to open a serial connection except in the MSDN documentation.

Raspberry Pie -- Ein günstiger Linux Microcontroller

Die Leute von Raspberry Pie haben im letzten Jahr ein interessantes Mikrocomputerprojekt gestartet. Ziel des Projektes ist es eine möglichst günstige Hardwareplattform zu erstellen mit der Schüler das Programmieren erlernen können. Ursprünglich war geplant das ganze Projekt nicht größer als einen USB Stick werden zu lassen. Mittlerweile mussten die Entwickler sich von dieser Vorgabe verabschieden dennoch wird das Raspberry Pie etwa so groß wie eine Visitenkarte und ist damit nicht größer als die Arduino Plattform. Geplant sind momentan zwei Versionen des Raspberry Pie, Modell A für etwa 25£ und Modell B für 35£.
Die Raspberry Pie Computer werden voraussichtlich noch in diesem Jahr verfügbar sein.

Beide Versionen werden werden mit folgenden Komponenten ausgeliefert:

  • HDMI
  • USB
  • 3,5mm Audio
  • BCM2835 ARMv6 Processor
  • SD Kartenleser
  • wahrscheinlich jeweils ein UART SPI und I2C Ausgang.

das Model B besitzt dazu noch zusätzlich:

  • Ethernet Port
  • einen weiteren USB port

Debian Router Howto

Nach dem ich meine FritzBox! immer wieder überlastet habe, stand ich vor der Entscheidung, mir einen neuen Router zu kaufen oder einen PC mit Linux so zu konfigurieren, dass er meine Anforderungen erfüllt.

Anfoderungen:

  • Bereitstellung einer Breitband DSL Internetverbindung mit Nat
  • Portweiterleitungen für Programme im lokalem Netz
  • Lokales Ethernet und WLAN Acess Point gemeinsam zu einem Netzwerk Überbrückt
  • DHCP Roter im Lokalem Netzwerk(mit Statischen Adressen)

Materialien

  • Zotac Ion itx A
  • Arccor SpeedModem 200
  • Debian Squeeze
  • Mindestens ein Switch/Hub
Setup als Bild
Aufbau des Servers als Bild

Read Motion Plus via I2C

The Communication with the Wii Motion Plus needs ony one step to initialize and two steps to read from the Motion plus extension. Motion Plus
  • I2C Adress: 0xa4/ 0xa6
  • I2C Motion Read Register: 0x00 (6 bytes)
  • I2C Enable Register 0xfe (Value 0x04)
  • I2C Disable Register 0xf0 (Value 0x55)
The Motion Plus extension has two basic states, the I2C repeater state and the motion sensing state.
After poweron is the motion plus in the I2C repeater state, in this state the I2C communication is forwarded to the rear port of the motion plus and it listens for commands that are written to the I2C oxa6.
After a successfull write of 0×04 to the register 0xfe the motion plus changes to the motion sensing state and its I2C adress to 0xa4 .
To be able to read the data of the motion plus is now easy first the Register 0x00 the to be read has to be written to the I2C bus, after that the six bytes of data can be read. The data that is read is enxoded as described at wiibrew.org.
To disable the Motion sensing, 0×55 must be written to the Register 0xf0.
edit: The disable commands for the Motion Plus are not different to the enable commands for the Nunchuck(or the other extension controllers). That means if you want to disable the Motion Plus you tell the Motion Plus to switch on the extension controller by writing 0x55 to 0xf0. After that you have to wait 38ms to be able to the extension controller on the back of the Motion Plus it is already initialized so it is not needed to Initialise the Extensioncontroller again.
Example Code:
/*
 * motionplus.c
 *
 * This is a driver for the motionplus addon of the wii remote.
 * it was written on an Atmel 644 microcontroller around the
 * I2C library of Peter Fleury
 * http://homepage.hispeed.ch/peterfleury/group__pfleury__ic2master.html
 *
 *
 *  Created on: 21.08.2009
 *      Author: Paul Rosset
 *      License: BSD-License
 */
/*
 * Enables the motionplus extension
 * and initializes the motionplus structure
 * after his call the Adress of the motionplus changes to
 */
uint8_t motEnable(void)
{
	motionplus.roll=0;
	motionplus.pitch=0;
	motionplus.yaw=0;
	i2c_init();

	if (i2c_start(0xA6 + I2C_WRITE))
		return ERROR_AT_I2C_START;
	if (i2c_write(0xFE))
		return ERROR_AT_I2C_WRITE;
	if (i2c_write(0x04))
		return ERROR_AT_I2C_WRITE;
	i2c_stop();
	return 0;
}
/*
 * Disables the Motionplus Controller
 */
uint8_t motDisable(void)
{

  if (i2c_start(0xA4 + I2C_WRITE))
    return ERROR_AT_I2C_START;
  if (i2c_write(0xF0))
    return ERROR_AT_I2C_WRITE;
  if (i2c_write(0x55))
    return ERROR_AT_I2C_WRITE;
  i2c_stop();
  return 0;

}
/*
 * Requests Data to read
 * (sets the register that is read )
 */
uint8_t motRequestData(void)
{
	if (i2c_start(0xA4 + I2C_WRITE))
    return ERROR_AT_I2C_START;
  if (i2c_write(0x00))// sends zero before receiving
    return ERROR_AT_I2C_WRITE;
	i2c_stop();
	return 0;
}
/*
 * Update the Data for the Sensor
 * and parse it
 * */
uint8_t motUpdate()
{
		if(motRequestData())
			return 1;
	if(i2c_start(0xA4 + I2C_READ))
		return ERROR_AT_I2C_READ;

	for(int i = 0; i < 5; i++)
	{
		data[i]=i2c_readAck();
	}
	data[5]= i2c_readNak();
	i2c_stop();
	motionplus.yaw = data[0] | ((data[3] & 0xFC) <<6) ;
	motionplus.roll = data[1] | ((data[4] & 0xFC) <<6);
	motionplus.pitch = data[2] | ((data[5] & 0xFC) <<6);
	return 0;
}

Read Nunchuck via I2C

The reading of the Nunchuck is similar to read of the motionplus. The biggest Problems are the timining errors. Since i used a 16MHz Oscillator my microcontroller an 400khz as my I2C speed, the communication was often to fast when reading the data. When this happens the nunchuck hangs and does nothing more.
Motion Plus

I2C Adress: 0xa4

I2C Enable Register 0xf0 (Value 0x55)

I2C Extension ID: 0xFA to 0xFF (0000 A420 0000)

I2C Motion Read Register: 0x00 (6 bytes)

The Nunchuck is first initialized writing 0x55 to Register 0xF0. After This step it might be needed to wait some cycles. The six bytes are aquisitioned by reading beginning at the register 0x00. The data can be dechiffred by using the following code:
nunchuck.stick_x = data[0]; //8bit value
nunchuck.stick_y = data[1];
nunchuck.acc_x = (data[2] <> 2) & 0x03); //10bit value
nunchuck.acc_y = (data[3] <> 4) & 0x03);
nunchuck.acc_z = (data[4] <> 6) & 0x03);
nunchuck.button1 = data[5] & 0x01; //boolean
nunchuck.button2 = data[5] & 0x02;