Pial's (We)Blog

Hobby electronics, interesting findings on the web



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;
  } 
}

Download the sketch file:

StepperTest.pde (829.00 bytes)



When I was on TI's website today checking out the MSP430 microcontroller series chips, I also discovered another cool product they have. It's a wristwatch with built-in RF transceiver based on their one family of microcontrollers (CC430 RF SoC Series). It is called the EZ430-Chronos. This is full featured sports watch with time keeping, 3-axis accelerometer, pressure sensor and temperature sensor. The watch can easily communicate with other wireless sensors around it that are transmitting in the same frequency. The watch kit comes with two USB interface module. One for wireless connection to the watch to set time etc. or collect accelerometer and other sensor data on the pc. The other interface is to reprogram the watch if you want. The kit also comes with tools to disassemble the watch for reprogramming. There is a wiki page for more information at:
http://www.ti.com/chronoswiki

I believe it will be definite attraction for techsavy people out there.



Today I bumped into TI's website about their recently released embedded development kit targeted towards hobbyists. It is called the LaunchPad. The kit is priced at only $4.30 and TI's store will ship it free if ordered from there. You can also order it from their distribution partners, but with shipping cost. However, one of the distribution partner, Arrow Electronics is offering free shipping till the end of July for any orders. So you can order it there as well for free shipping. Here are the few features of the microcontrollers that comes with the kit.

Features

  • Low Supply Voltage Range 1.8 V to 3.6 V
  • Ultralow Power Consumption
    • Active Mode: 220 µA at 1 MHz, 2.2 V
    • Standby Mode: 0.5 µA
    • Off Mode (RAM Retention): 0.1 µA
  • Five Power-Saving Modes
  • Ultrafast Wake-Up From Standby Mode in Less Than 1 µs
  • 16-Bit RISC Architecture, 62.5 ns Instruction Cycle Time
  • Basic Clock Module Configurations:
    • Internal Frequencies up to 16 MHz With One Calibrated Frequency
    • Internal Very Low Power LF Oscillator
    • 32-kHz Crystal
    • External Digital Clock Source
  • 16-Bit Timer_A With Two Capture/Compare Registers
  • Universal Serial Interface (USI) Supporting SPI and I2C (See Table 1)
  • Brownout Detector
  • 10-Bit 200-ksps A/D Converter With Internal Reference, Sample-and-Hold,
    and Autoscan (See Table 1)
  • Serial Onboard Programming, No External Programming Voltage Needed
    Programmable Code Protection by Security Fuse
  • On-Chip Emulation Logic With Spy-Bi-Wire Interface

The kit comes with the followings:

  • LaunchPad Development board (MSP-EXP430G2)
  • Mini USB cable
  • 2x MSP430 flash devices
    • MSP430G2211IN14 flash device
    • MSP430G2231IN14 flash device (preloaded with sample program)
  • 10-pin PCB Connectors (2 male & 2 female)
  • 32kHz crystal
  • Quick Start Guide
  • 2x LaunchPad stickers

    I believe it will be quite popular in the hobbiest community for the low price of the microcontrollers (around $2.17 for retail) and low power usage of the chips. I saw a demo video where they were powering up the microcontroller and a LCD display using only 3 pieces of grapes, potatos, kiwis etc.
  • For more information please visit their wiki site at: http://www.ti.com/launchpadwiki


    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)


    I recently wrote some code to drive a 4 digit seven segment display using the arduino and 74HC595 shift register chip. The display is a seven segment common anode display with decimal dots. The pin configuration can be found here. I have connected a DS18S20 temparature sensor to read the temparature and display the reading on the seven segment display.

    Here is how it looks:




    Here is the arduino sketch:

    Download the sketch from the link below: 

    SevenSegmentTest.pde (2.27 kb)

    If you have any questions, please feel free to ask me via the contact link.


    My 2002 Audi A4 key was worn out due to use and the clip that holds the two part of the key was broken last time when I was trying to replace the battery. Therefore I was looking for a replacement on eBay. I was not ready to go to the dealer as they usually charge $150 for a new key+remote and another $100 to program the immobilizer inside the key. I got a cheap deal on ebay for a used key that looked much much better than the one I had. Replacing the remote part in the new key shell was simple enough, as I decided to use old key's portion for the part where the remote chip is located. The chip is clipped to the plastic part using metal pins and it is not easy to take it apart without cutting the pins that hold it in place. But the bigger problem was to open the top part (part holding the flip key). First of all, it took me very long to find out using google that, there is a screw holding the two parts there which is located under the audi logo. I had to take the audi logo apart (it's pasted there using a adhesive connector). Then I was able to take the two parts apart, using a screw driver and a little bit of force. The most hard part was to remove the rfid transponder, that communicates with the immobilizer on the car, without that the new key would start the car, but the engine will shut off after 2 seconds activating the immobilizer. The immobilizer in my old key was pasted to the body using epoxy glue which took a lot of effort to take apart, but finally after a time consuming effort I was able to take it apart and place inside the body of the replacement key. I am just listing the resources that helped me to achive this, hoping it would help other DIYers out there.

    http://www.audizine.com/forum/showthread.php?324553-How-do-you-remove-the-immobilizer-from-an-2002-b6-remote-fob

    http://www.myturbodiesel.com/1000q_how_to/multi/immobilizer.htm

     


    Arduino project: The clock

    I have been working on this for a while and finally it has been perfected. Here the arduino reads data from DS1307 RTC chip using I2C protocol and displays the time in english and bengali digits on a dot matrix display. The dot matrix display is connected to the arduino through 74HC595 shift register chips to expand the I/O pins of arduino. Here is how the prototype looks:

    Photos:





    Video:

    Arduino Real Time Clock using I2C and Dot Matrix Display from Pial on Vimeo.


    iPhone v3.1 update issue

    On 09/09/09 apple released the updated ver. 3.1 os for the iPhone. I was very excited to read about it on apple.com website and couldn't wait to get the update installed on my iphone 3G. The added features as described on apple.com are:

    iPhone OS 3.1 also includes these features and updates:

    • Improved syncing for music, movies, TV shows, podcasts, and photos1
    • iTunes U content organization1
    • Redeem iTunes Gift Cards, codes, and certificates in the App Store
    • Display available iTunes account credits in the App Store and iTunes Store
    • Save video from Mail and MMS into Camera Roll
    • Option to "Save as new clip" when trimming a video on iPhone 3GS
    • Better iPhone 3G Wi-Fi performance when Bluetooth is turned on
    • Remotely lock iPhone with a passcode via MobileMe
    • Use Voice Control on iPhone 3GS with Bluetooth headsets
    • Paste phone numbers into the keypad
    • Option to use Home button to turn on accessibility features on iPhone 3GS
    • Warn when visiting fraudulent websites in Safari (anti-phishing)
    • Improved Exchange calendar syncing and invitation handling
    • Fixes issue that cause some app icons to display incorrectly

    Out of excitement I decided to update my iPhone OS to 3.1 and after that the worse happened. After the update I noticed that my contact list is blank. Then I got a popup warning like.."Microsoft Exchange requires encryption which is not supported on this device", and I only had the option to disable the account. So my exchange emails disappeared, my calendar went empty and my contacts were gone, because all were in sync with my exchange. Then I thought I might be able to restore to my last version from the iTunes software update directory. Surprisingly enough, only the last version (v 3.1) was available there to restore to. So there was no way I could go back to v 3.0 or v 3.0.1. So now I have my iphone with no exhchange email, calendar or contact sync over the air. Later I had to manually sync my calendar and contacts through iTunes on the pc where I have exchange email set up in my outlook. I have all my contacts and up to date calendar events on my phone, but no email sync or over the air update of calendar events. I was reading about it through google search and found out that l am not the only unfortunate one. Apple has included exchange mail box security enforcement on the device (those are set up exchange server admins). So if your server admin enabled device side encryption, you are in back luck. Because iPhone 1G, 3G do not support device side encryption. iPhone 3GS support it, so 3GS users will not experience this problem. Hopefully apple will come up with a solution for the device. As for now, the apple support site is asking for exchange server admins to disable this security feature on the server, so that device side encryption is not enfoced. I do not think the server admins will be happy about this and it's an acceptable solution.


    I had this cool mobile pc from Sony for a while now. I was kind of getting tired of how slow XP would run on this machine and multi-tasking was almost impossible due to small amount of RAM it had on this (512MB). Most probably because of the tons of bloatware that came installed with the default Windows XP Pro installation from Sony. When Windows 7 RTM was released on MSDN recently, I wanted to give it a try on my machine. I started looking on Google for other people who installed Windows Vista, Windows 7 beta or Windows 7 RC on their UX series ultra mobiles and learn about their experiences. Most probably I was looking if all the hardware on the UX will work in Windows. After getting convinced that Windows 7 runs quite well and grabbing all the available Vista drivers for the UX, I sat down to install. I have a Lite-On external usb dvd writer and connected it to the UX. I did the first installation and it took about 20-25 minutes to complete, which was quite fast compared to earlier windows installation experiences. Surprisingly enough 85% of the UX's hardware were recognized and installed by Windows 7. The only major hardware that was not installed was the web cam. Then I grabbed the driver package I downloaded earlier that I found on http://www.micropctalk.com/ and install the missing hardwares from there. The link is shared on this thread - http://www.micropctalk.com/forums/showthread.php?t=5617&page=14. And the direct download link is: http://www.megaupload.com/?d=0CIQ4TEV. I am not sure how long it will be available though. Because I also found a few other links on the thread, that was broken already. In the download package, the instructions say to install the hardware in a certain order and the folders are numbered accordingly. If you follow the order, you will be fine. However, you won't need to install all of them. Windows 7 will pre-install most of the hardware for you. You will mostly need to install the driver for the mouse stick, software for the touch screen, utility for the special buttons, Sony Event Manager tool, Sony Firmware Extension Parser Driver, Sony Notebook Control Driver, Sony Utility Dlls, Sony Shared Libraries, Sony Power Management, Hard drive protection driver form Misc Drivers folder, Camera Driver & Applications and other Sony bundled applications such as the Sony VAIO Control Center tool, wireless switching utility, zoom utility. Alternatively you can also download the drivers from Sony's support site, which might be a bit confusing, because those drivers, patches etc. were targeted for windows vista. In other words, you will not need to download all the drivers and patches from there and install on windows 7, just get the applications and drivers you need, that windows 7 did not pre-install for you.

    Please note that if you don't install the special button utility and the sony event manager, the zoom buttons and the touch launcher button on your UX will not work. I was having problem with those buttons for some time and finally figured out the reason was the Event Manager tool not been installed. 

    This is how it's looking running windows 7. You may have noticed the RAM usage is near the red area. Mine came with 512Mb of RAM and I am not surprised to see the usage up to that level. However, the UX is much more responsive than it was in Windows XP. I got rid of the restore partition, which eats up about 7GB of space on the hard drive. Now I have around 20GB of free space after the installation. I have yet to install more software on the UX as I need. But Windows 7 comes with all the important tools and software you need to do on this tiny yet powerful machine. I think Microsoft did a great job on making Windows 7 less hardware power hungry, more stable and the footprint to run on smaller hardware profiles. I was reading about people successfully installing and running windows 7 on their old intel mmx hardware with 128Mb or RAM, which is quite impressible based on the features and power windows 7 presents.

    One thing I want to mention though, I was unable to get the back side camera to work with the camera utility, only the front camera is accessible with the tool right now.


    I know this has been posted by many people already on different web sites and forums. Still I am posting the Arduino (Atmega168) fuse bit settings, as it appears in AVR Stuido 4 programming  interface:

    Fuse bits:



    Lock bits:



    Please remember the programming sequence:

    Step one: Flash the appropriate boot loader

    Step two: Set the fuse bits

    Step three: Set the lock bits


    I hope this helps. I myself looked for this information earlier and it was not easy to find them all together.