Pial's (We)Blog

Hobby electronics, interesting findings on the web

I am currently working on a 40x8 scrolling dot matrix display driver based on arduino. I need to design some custom fonts in binary format for that. I looked around the web for a tool and found some excel based tool which are not very quick and easy to use. So I came up with this javascript based 8x8 pixel font generator. Hopefully it will be useful for others too.

 

 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0

Binary code:

Just click on the segments you want to light up. Clicking two times will turn the segment off. The binary font code will be auto-generated on the right. Reset button with reset all the segment status to off.

This tool and a 80x4 matrix image code generator is available on the Tools page.


In my last post I posted a sketch that takes advantage of codes copied and modified from the Henning Karlsen GLCD library for arduino to work in the ChipKIT Uno32 board. This time I modified the library to work with ChipKIT Uno32 IDE.

Here is the updated library for download:

RGB_GLCD_CK.rar (159.96 kb)

Here is the updated library in use to display bitmap images:



Arduino sketch is here for download:

RGB_GLCD_Bitmap_CK.rar (50.89 kb)



I recently purchased a ChipKIT Uno32 designed by digilent inc., that is based on a Microchip PIC 32 bit processor. They claim it to be compatible with most arduino shields and they also released a arduino ide compatible with the chipkit boards. I purchased the board from nkc electronics and found they are selling a RGB 65K color lcd module for about $5. I ordered that as well. When I received the items I made a shield for the color lcd module. The module has solderable contact pads, therefore it is not as dificult as those nokia knock off color lcds to make contact points. I followed the circuilt nkc electronics use on their RGB Lcd shield for this display module, they sell the shile for $19.99. Here is the circuit:

 

schematic

After getting the module hooked up, I first ran the example sketch posted on the product page of nkc electronics. That was very simple and compiled fine in the ChipKIT IDE (mpIDE, multi-platform IDE), which is a modified version of official arduino IDE. Then I looked around the web for better example codes and found a interesting video demo on youtube. Then tracked the source site for the arduino library and example sketch from here. But the library does not compile in chipkit IDE. Because the library uses some macros and libraries very specifically written for avr microcontrollers. Although chipkit is compatible with arduino IDE and most shields, does not mean all the libraries will be directly compatible, due to the fact, architecture between AVR and PIC microcontrollers are different. So I wrote an arduino sketch by slightly modifying the library, which compiled fine and ran successfully on the chipkit board. Here is the video:

Here is the arduino sketch:

RGBLCD_PK.pde (18.78 kb)

Next is to modify the code to get the bitmap display to work. :-)




I found this very well written blog post on the web on how to use your microcontroller with limited I/O pins to drive large dot matrix led displays. The atricle explains how to use 74HC595 shift registers to scan multiple dot matrix display modules's columns and a CD4017 decoded counter to scan the rows. All together you will need 3 I/O pins for the shift register and only 2 I/O pin to drive the decoded counter.

Here is the link: http://embedded-lab.com/blog/?p=2661

I have used 74HC595, CD4017, ULN2003 chips to drive dot matrix displays already using arduino, but that was static/non-scrolling. This blog post gave me better understanding on how to do the scrolling.



Figure: 9 DOF Sensor board right after etching

When I started to gather interest in making a quad copter inspired from open source projects around the world, there was one problem. That is getting the gyro, accelorometer, magnetometer and barometric pressure sensors. All these sesnors are used to keep the quad copter stable in flight and for purposes like altitude hold, heading hold etc. The sensors very small package smd devices, are a bit hard to work with when it comes to DIY. Sparkfun electronics sells the sensors on breakout board, but those seem a bit over priced for me. For example, the ITG3200 gyro break out board was priced at $49.99 when the sensor chip can be purchased at $10 a piece. So I decied to give it a try after reading some tips about DIY smt/smd soldering on the web. I tried hot pan soldering couple of times but it partially burnt the pcb in process making it look very ugly but the sensors worked. Then I moved to toaster oven convection heat soldering and it seems to work much better. I got a cheap convection toaster oven for $29 on last black friday and I am quite happy with it. So here is my latest attempt of smt soldering, which involves making a all-in-one sensor board for my quad copter:



Figure: 9 DOF Sensor board after soldering

Although this process does not always go perfectly fine, I am happy to say that all my sensors worked perfectly fine. Here is it in action within MultiWii configuration tool:





Figure: 9 DOF IMU & Baro sensor reading in MultiWii config

I know my board does not look as good as the manufactured boards with silkscreen and things but it works and I am happy with it as it saves me money to buy more gadgets to play with. Laughing The total cost to make the board included $10 for ITG3200, $8 for BMA180, $8 for BMP085, $3 for HMC5883, the I2C voltage level converter plus other passive parts cost were about $10, which brings the total to roughtly around $40. I spent around $10 for shipping for all the components. Still it is much cheaper then buying these sensors as breakout boards from Sparkfun or buying it from ebay for $99 which does not include the 3.3v regulator and I2C level converter.

This board has built-in 3.3v regulator and I2C level converter to use this board directly with a 5v powered arduino or any microcontroller board.

Here the schematic for anyone out there to give this a try, the schematic is based partially on Sparkfun breakout boards schematics, data sheets, and partially on the Free IMU project.

 



Figure: Second version of the board with corrected circuit for HMC5883L magnetic sensor and smaller board size.

I needed to make a little modification for the HMC5883L magnetic sensor, which has a little bit different application circuit than HMC5843 and HMC5883 version of this sensor.

Here is a short video of the sensor showing the output in MultWii config:



I recently purchased the HC-05 RS232 serial bluetooth module from eBay. These modules sells from $10 to $20 including shipping. My plan was to use it as a economic wireless communication tool between PC and the Arduino board. The module has built-in Serial<-->Bluetooth protocol converter. Therefore it can be connected directly to Arduino serial pins without any ttl level translator chip and with a few external components. One thing to note though, the seller I purchased the module from on ebay had the wrong schematic posted on the listing which was meant for a older version of this module. So depending on which version you have, you will have slightly different pin connection for the AT command enable pin and led indicator pins. The major difference between the two version of the module is, the newer version works in both master and slave mode depending on how you set it up via AT commands and improved firmware. The specification of this module is as follows:

● Bluetooth protocol:  Bluetooth Specification v2.0+EDR
● Frequency:  2.4GHz ISM band
● Modulation:  GFSK(Gaussian Frequency Shift Keying)
● Emission power:  ≤4dBm, Class 2
● Sensitivity:  ≤-84dBm at 0.1% BER
● Speed: Asynchronous:  2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
● Security:  Authentication and encryption
● Profiles:  Bluetooth serial port
 
Power supply: +3.3VDC 50mA
Working temperature: -20 ~ +75 Centigrade
Dimension: 26.9mm x 13mm x 2.2 mm

Here are the data sheet, example schematic for this module:

BC4_Bluetooth Module Datasheet.zip (1.12 mb)

The schematic I used to connect to arduino is as follows:




This can be used as a cheap way to talk to your Arduino wirelessly and debug your quad copter over serial port without using the relatively expensive XBee modules, even though you will not get as much range as the XBees.

Here is my version of the break out board.



Figure: Front side of the break out board.



Figure: Back side of the break out board.

Testing the module with MultiWii quad and configuration tool:


[Chris Hulbert] is making it easy for Arduino users to program MSP430 chips with a header file that allows you to compile Arduino sketches for the Launchpad. This makes sense, as the growing number of Arduino sketches available, and the low cost of the TI Launchpad make for a good bedfellows. It’s really wasn’t that hard to make this happen, although you’re not going to find support for all of the Arduino functions just yet.


At the time of writing, [Chris] has just 51 lines of code committed to the project. It provides macros for setup(), loop(), delay(), pinMode(), pinBit(), digitalWrite(), and digitalRead(). You’ll notice that one of the most important parts of the header file is that it disables the watchdog timer for the user (a stumbling block for many MSP430 beginners). It’s an interesting solution, but to be truly useful we’d want to see hardware integration with the Arduino IDE. That, as well as the rest of the Arduino functions are at the tips of your fingers. Get coding and submit your push requests to [Chris] for inclusion in his repository.

[Thanks Chris]

 



Surfing around the web I found the latest trend on remote controlled, semi-autonomous and full autonomous model airplanes, quadcopters etc. There are several open source projects available out there with available hardware for purchase and software, as well as firmware downloads for free. Most of the projects have excellent manuals on how to assemble the hardware, upload the firmware and configuring it. If you are struggling to learn how to fly a RC helicopter or a plane, one of these project might help you learn how to fly, using the on board auto stabilization option. I will be listing a couple of interesting links here.

DiyDrones.com - It has the list of almost all the open/commercial projects out there in this area.

Some of the autopilot frameworks are based on the popular Arduino platform, which makes it very simple for arduino fans to modify and contribute to the code if needed. Here are the a few of those:

1. Ardupilot: They have excellent hardware and software that produces very stable RC aircrafts.
2. Aeroquad: Aeroquad has a large developer community contributing to the development of this project which is making the platform better everyday.
3: KKMulticopter: They developed a very easy to build solution for a very fun to fly quad/tri copter.
4. MultiWii: Another arduino based platform using the popular and easy to find Wii Motion Plus and Nunchuck sensors. They are currently expanding their hardware support for wide variety of sensors.

More to come soon..

 




Recently I collected a broken hard drive to experiment on making a POV clock that I found on the web. After taking the hard drive apart, my first idea was to drive the stepper motor in the hard drive using Arduino. I looked around the web for writeup and tutorials about the principles of driving stepper motors. I particularly found this resource very useful: http://www.cs.uiowa.edu/~jones/step/. Reading this tutorial I found out the type of stepper motor the hard drive had, as there are couple of types of stepper motors available in the market. This hard drive had a Variable Reluctance Stepper Motor and the internal construction of it is like the figure below.

 . . . . . . . . 1 ---/\/\/\-  .            1 | . .      2   X   3 2 ---/\/\/\-|-- C        Y o Y |          3   X   2 3 ---/\/\/\-               1
The motor has 4 pins, the common pin is usually connected to the positive power supply and the three other pins are required to be supplied negative voltage in a sequence to get the stepper motor moving. The logic is visualized in the figure below:



Now that I understood the logic of driving the motor, I wrote up the code for Arduino. The code uses 3 arduino digital pins in output mode (Pin 2,3,4) to drive the 3 coils of the stepper motor. However the arduino digital I/O pins does not produce enough current to drive the motor coils. Therefore power transistors or Darlington array chips (ULN2003 etc.) or H-Bridge motor drive chip (L293D etc.) are required to successfully drive the motor. For the experiment I used couple of regular NPN switching transistors (2N3904). These transistors yield quite low current (around 150-200mA), so I couldn't drive the motor beyond a certain speed. I wrote the code that will start spinning the motor at a lower speed and then gradually speed up. You can play with the steppingDealy value to control the speed of the motor.

Here is the arduino code:


int pinA = 2;
int pinB = 3;
int pinC = 4;
int steppingDelay = 100;

void setup() {
  pinMode(pinA, OUTPUT);
  pinMode(pinB, OUTPUT);
  pinMode(pinC, OUTPUT);

  digitalWrite(pinA, HIGH);
  digitalWrite(pinB, HIGH);
  digitalWrite(pinC, HIGH);  
}

void loop() {
  stepping(1);
  delay(steppingDelay);
  stepping(2);
  delay(steppingDelay);  
  stepping(3);
  delay(steppingDelay);
  if(steppingDelay > 10)
  {
    steppingDelay--;
  }
}

void stepping(int stage)
{
  switch(stage)
  {
  case 1:
    digitalWrite(pinA, LOW);
    digitalWrite(pinB, HIGH);
    digitalWrite(pinC, HIGH);
    break;
  case 2:
    digitalWrite(pinA, HIGH);
    digitalWrite(pinB, LOW);
    digitalWrite(pinC, HIGH);
    break;
  default:
    digitalWrite(pinA, HIGH);
    digitalWrite(pinB, HIGH);
    digitalWrite(pinC, LOW);
    break;
  } 
}

Arduino sketch download:

StepperTest.pde (829.00 bytes)


This is a experiment with arduino and nokia 3310 display module. I downloaded the library from http://www.nuelectronics.com/estore/index.php?main_page=product_info&products_id=12. I got the display modules from eBay and made my own simple breakout board. This demo shows the time reading from a DS1307 time keeping chip. Also demonstrates how to display a graphic image and animation on the display using the library.

Here is how it looks:

Here is a video clip:

 

Here is the arduino sketch:

Nokia3310_Clock.pde (5.80 kb)

pacman.h (5.87 kb)




Control panel


Blogroll


    Archive