My first stepper experiment

I got my first stepper running with Arduino. I found an old pair of steppers in one of the boxes where I keep such things for years now, (»maybe one needs them one day«).

This is the stepper motor pair I have:

2014-01-25 16.52.53

It is a 6 wire unipolar motor: It seems as if bipolar steppers have 4 wires, unipolar ones 5 or 6 wires.

Now I had to find out what are the common ground wires. Here I found

...one way to distinguish common wire from a coil-end wire is by measuring the resistance. Resistance between common wire and coil-end wire is always half of what it is between coil-end and coil-end wires. This is due to the fact that there is actually twice the length of coil between the ends and only half from center (common wire) to the end.

Testing the resistance with an ohmmeter the two center wires could be identified as the common wires.

Unfortunatelly, I only had a L293D step motor driver chip which is meant for bipolar motors. But as it turns out, this is not a problem when you connect the 2 common wires

The MotorKnob tutorial on arduino.cc (big picture of the breadboard layout) shows how to connect a bipolar motor to the Arduino. When you don't connect the common wire, the unipolar motor works with the L293D driver.

Connecting an Arduino with the Raspberry Pi via I2C

Today, I tried connecting my Raspberry Pi to an Arduino via I2C bus following roughly the guide from Oscar Liang.

According to the GPIO pinout, we have to connect pins 3 and 5 of Pi's GPIO port to Arduino's A4 and A5 pins.

First, the revision of the Raspberry Pi is important to determine which I2C port to use. Output of /proc/cpuinfo is

$ cat /proc/cpuinfo
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 0002
Serial          : xxx

That means, that according to this list ...

'0002' => 'Model B Revision 1.0',
'0003' => 'Model B Revision 1.0 + Fuses mod and D14 removed',
'0004' => 'Model B Revision 2.0 256MB', (Sony)
'0005' => 'Model B Revision 2.0 256MB', (Qisda)
'0006' => 'Model B Revision 2.0 256MB', (Egoman)
'0007' => 'Model A Revision 2.0 256MB', (Egoman)
'0008' => 'Model A Revision 2.0 256MB', (Sony)
'0009' => 'Model A Revision 2.0 256MB', (Qisda)
'000d' => 'Model B Revision 2.0 512MB', (Egoman)
'000e' => 'Model B Revision 2.0 512MB', (Sony)
'000f' => 'Model B Revision 2.0 512MB', (Qisda)

...I have a Model B Revision 1.0 and therefore according to this overview I have to use -y 0 in the i2c commands following.

After installing the i2c-tools

$ sudo apt-get install i2c-tools

we can try to find the I2C device Arduino:

$ /usr/sbin/i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Now write a 1 to Arduino with:

/usr/sbin/i2cset -y 0x00 0x04 1

On the Arduino I installed a Wire program from Arduino's examples.

Using Atmel Studio 6.1 for Arduino development

When you have enough of the "all very easy and basic" Arduino IDE you can switch to Atmel Studio and have much better IDE and editor for your Arduino projects. The following is based on this post by EngBlaze.com

Install Arduino from http://arduino.cc/

  • Install e.g. in C:\Program Files (x86)\Arduino

Install Atmel Studio 6.1 from http://www.atmel.com/microsite/atmel_studio6/ (free registration required)

Start Arduino

  • File / Preferences / Show verbose output during: [ ✓ ] compilation
  • Ensure correct board is set in Tools / Board. I've selected Arduino Duemilanove w/ ATmega328 for the Diavolino Arduino clone
  • Compile any example program, e.g. from File / Examples / 01. Basics / Blink
  • In output  log, look for the name of the path where the core library was generated, e.g.C:\Users\{YOUR_USERNAME}\AppData\Local\Temp\build4980286967124578172.tmp\core.a
  • Generate a new directory and copy the core.a file to this directory with the new name libcore.a, e.g. copy C:\Users\{YOUR_USERNAME}\AppData\Local\Temp\build4980286967124578172.tmp\core.a C:\docs\Arduino\arduinocore_105\libcore.a
  • Close Arduino

Start Atmel Studio

Change your project settings (Alt + F7)

The following steps should be done for Debug and Release configuration separately: Once for Debug, once for Release. Changing Debug and Release at the same time using All Configurations led to strange error message boxes when saving the configuration.

AVR/GNU C++ Compiler / Symbols

F_CPU=16000000L
ARDUINO=101

AVR/GNU C++ Compiler / Directories

C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino
C:\Program Files (x86)\Arduino\hardware\arduino\variants\standard

AVR/GNU C++ Compiler / Optimization

Optimization Level: Optimize for size (-Os)
Other optimization flags: -fdata-sections

AVR/GNU C++ Compiler / Miscellaneous

Other flags:-fno-exceptions

AVR/GNU Linker / Libraries

Libraries / Add item: core
Library search path: C:\docs\Arduino\arduinocore_105

AVR/GNU Linker / Optimization

Garbage collect unused sections [ ✓ ]

Create an external tool

In Tools / External tools...   create an external tool to send a compiled program to the chip:

  • Command: C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe
  • Arguments:-C"C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf" -v -v -v -v -patmega328p -carduino -P\\.\COM4 -b57600 -D -Uflash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i
  • [ ✓ ] Use output window

Recommended talks from 30C3

Talks at the 30C3 that are especially worth watching

Note to myself: Watch these

Maybe I have to look into the lightning talks:

Samsung Galaxy S3: Multi-Window reaktivieren nach Update auf Android 4.3

Nach dem Update auf Android 4.3 funktioniert beim S3 manchmal Multi-Window nicht mehr. Multi-Window wird z.B. durch langen Druck auf die "Back"-Taste eingeschaltet und erlaubt zwei Apps gleichzeitig auf dem Bildschirm.

Ich habe das gemäß http://forum.xda-developers.com/showthread.php?t=2530414 einfach reparieren können:

  1. Einstellungen / Mein Gerät / Startbildschirmmodus

    Einstellungen / Startbildschirmmodus
    Einstellungen / Startbildschirmmodus
  2. Einfacher Modus auswählen
  3. Anwenden
  4. Standardmodus auswählen
  5. Anwendens3_a43_2