Pial's (We)Blog

Hobby electronics, interesting findings on the web



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.


[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]

 


I found this very nicely written article by Starlino on IMU AKA Intertial Measurement Unit which is the heart of any autopilot system for hobby RC aircrafts:

Link: http://www.starlino.com/imu_guide.html



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..

 


The STM32 Value line Discovery is the cheapest and quickest way to discover the STM32. It includes everything required for beginners and experienced users to get started quickly.

 The STM32 Value line Discovery includes an STM32F100 Value line microcontroller in a 64-pin LQFP package and an in-circuit ST-Link debugger/programmer to debug Discovery applications and other target applications. A large number of free, ready-to-run application firmware examples are available on www.st.com/stm32-discovery to support quick evaluation and development using the LEDs, button and extension header to connect to other boards or devices.

 

Features:

  • STM32F100RBT6B microcontroller, 128 KB Flash, 8 KB RAM in 64-pin LQFP
  • On-board ST-Link with selection mode switch to use the kit as a stand-alone ST-Link (with SWD connector for programming and debugging)
  • Two red LEDs; LD1 for USB communication, LD2 for 3.3 volts power on
  • Designed to be powered by USB or an external supply of 5 V or 3.3 V
  • Can supply target application with 5 volts and 3 volts
  • Two user LEDs, LD3 and LD4 (green and blue)
  • Two push buttons (User and Reset)
  • Extension header for all QFP64 I/Os for quick connection to prototyping board or easy probing

 Benefits:

  • Discover STM32 with STM32 Value line, including 128-Kbyte Flash, 8-Kbyte RAM in a 64-pin LQFP
  • Immediate plug-and-play demonstration
  • Adapts the demo to the future application environment
  • Non-intrusive debug with the in-circuit debugger present on STM32 Value line Discovery. The kit can be used as an ST-link for your own board.
  • Ideal for prototyping and easy probing. Enable quick connection to a prototyping board
  • Fast startup, accelerate your developments



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)



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:

    #include <OneWire.h>
    #include <DallasTemperature.h>
    
    #define ONE_WIRE_BUS 2
    
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);
    DeviceAddress insideThermometer;
    
    //]\const int ledPin =  13;// LED connected to digital pin 13
    const int latchPin = 5;//Pin connected to ST_CP of 74HC595
    const int clockPin = 6;//Pin connected to SH_CP of 74HC595
    const int dataPin = 7;//Pin connected to DS of 74HC595
    
    const int digitPins[4] = {
      8,9,10,11}; //pins to control the 4 common anode pins of the display
    
    const byte digit[10] = //seven segment digit bits
    {
      B00111111, //0
      B00000110, //1
      B01011011, //2
      B01001111, //3
      B01100110, //4
      B01001111, //5
      B01111101, //6
      B00000111, //7
      B01111111, //8
      B01101111  //9
    };
    
    int digitBuffer[4] = {
      0};
    int digitScan = 0;
    int soft_scaler = 0;
    float tempC, tempF;
    int tmp;
    
    void setup()   {                
      TCCR2A = 0;
      TCCR2B = (1<//pinMode(ledPin, OUTPUT); 
      for(int i=0;i<4;i++)
      {
        pinMode(digitPins[i],OUTPUT);
      }
      pinMode(latchPin, OUTPUT);
      pinMode(clockPin, OUTPUT);
      pinMode(dataPin, OUTPUT);  
    
      sensors.begin();
      sensors.getAddress(insideThermometer, 0);
    }
    
    ISR(TIMER2_OVF_vect) {
      soft_scaler++;
      if(soft_scaler==15)
      {
        refreshDisplay();
        soft_scaler = 0;
      }
    };  
    
    void refreshDisplay()
    {
      for(byte k=0;k<4;k++)
      {
        digitalWrite(digitPins[k], LOW);
      }
      digitalWrite(latchPin, LOW);  
      shiftOut(dataPin, clockPin, MSBFIRST, B11111111);
      digitalWrite(latchPin, HIGH);
      delayMicroseconds(400);
      digitalWrite(digitPins[digitScan], HIGH); 
    
      digitalWrite(latchPin, LOW);  
      if(digitScan==2)
      {
        shiftOut(dataPin, clockPin, MSBFIRST, ~(digit[digitBuffer[digitScan]] | B10000000)); //inserting the dot
      }
      else
      {
        shiftOut(dataPin, clockPin, MSBFIRST, ~digit[digitBuffer[digitScan]]);
      }
      digitalWrite(latchPin, HIGH);
      digitScan++;
      if(digitScan>3) digitScan=0;
    }
    
    void loop()                     
    { 
      //digitalWrite(ledPin, HIGH);
      sensors.requestTemperatures();
      tempC = sensors.getTempC(insideThermometer);
      tempF = DallasTemperature::toFahrenheit(tempC);
      tmp = int(tempF*100);
      digitBuffer[3] = tmp/1000;
      digitBuffer[2] = (tmp%1000)/100;
      digitBuffer[1] = (tmp%100)/10;
      digitBuffer[0] = (tmp%100)%10;
    
      //digitalWrite(ledPin, LOW);
      delay(20);
    }
    
    
    

    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.




    Control panel


    Blogroll


      Archive