Servo Motors

A lot of people when first getting into Arduino projects seem to like robotics. It is fun to create something that you can watch move around. If you are interested in such things, you will be interested to learn about servo motors.

 

Pictured below is a Parallax Continuous Rotation Servo motor.

 

Parallax Servo Motor

Parallax Servo Motor

Click the above image or here to learn more about them and download the Arduino sketch to experiment with them.

AVR Raspberry Pi Programmer

There are a number of ways to program AVR microcontroller chips. For my DIY projects, I like to save money by buying components and putting them together to create what I need. I bought some blank ATMEGA 328P micro controllers so that I could make Arduino circuit boards for my projects. Building the Arduino circuit board myself rather than buying the completed Arduino saves money. Granted, it takes more time, but to me it is more satisfying to do it myself.

Since I have blank chips, they need the Arduino Bootloader programmed in. My favorite programmer for that purpose is a Raspberry Pi shown below.

Raspberry Pi Programmer

Raspberry Pi
Programmer

It uses a modified version of AVRDude especially for the Raspberry Pi. Instructions on how to get it and use it are here.

Here is how it is wired.

The astute observer will note that besides the 6 wires, I have a 16Mgz crystal  on the breadboard. If the chip is blank when it is being programmed this crystal is not needed, however there are times when I reprogram a chip. For those times, the crystal is needed because the fuses are set to use external clocking rather than the internal clock.

 

The BusPirate (a very useful circuit)

A few days ago my son bought me a birthday present. It was a BusPirate from SparkFun. This is what it looks like plugged into a breadboard.

BusPirate

BusPirate and Breadboard

The BusPirate is quite a handy circuit. I have used it to flash a BIOS chip using FLASHROM  and also program an AVR ATMEGA 328P with AVRDude.

It can even be used in the Arduino IDE as a programmer simply by adding a few lines:

in programmers.txt (found in the hardware directory).

The I/O header [breakout] looks like this:

BusPirate I/O Header

BusPirate I/O Header

The BusPirate has many uses, check out the possibilities here.

If you’d like to try some of the functions of the BusPirate on an Arduino, you might be interested in the Arduino Sketch called “MiniPirate“. You can find more information here.

PIR Sensor for your Arduino

A PIR  or Passive Infrared module is really fun to play with. This is what they look like:

 

Passive Infrared Sensor [front view]Passive Infrared Sensor [back view]

 

They are basically a motion detector and are called ‘passive’ in the sense that these devices do not generate any energy for detection purposes. They work entirely by detecting the energy given off by other objects in the infrared spectrum wavelengths. More information about infrared can be found here.

Here is how to hook it up:

 

PIR Fritzing Example

Get the Fritzing source for the above image here. Once you have it hooked up, head on over to the Arduino Playground and get the sketch to make it work.

I added a buzzer and it alerts me when anything (including the cat) sneaks up on me.

 

 

 

Wireless Bluetooth Module for your Arduino

If you’d like to wirelessly attach your Arduino to another device (such as a phone or tablet) via bluetooth, I’d recommend the serial bluetooth module from Elecrow.com.

Here is what they look like:

 

Serial Bluetooth Module

 

The module has firmware from BOLUTEK. The PDF document with all of the available BOLUTEK commands is BLK-MD-BC04-B_AT COMMANDS . I also document the AT commands in the sample source code (aduino sketch) below.

There was no sample code that I could find for using these with an Arduino so I wrote my own. The following sketch (load it into any arduino) sets up the module in slave mode so you can connect to it with any blue tooth enabled device. The PIN code is 232323 as you can see from the source.

 

Connecting an Arduino to a LAN with the ENC28J60

I picked up a couple of these modules:

 

ENC28J60

from Elecrow.com so I could attach (communicate with and control) several of my Arduinos through a LAN connection.

The main chip is the ENC28J60 from microchip.com. These modules are better than an Ethernet Shield in that you can easily attach these to any Arduino and they are less expensive than a shield.

I have found (and you will too if you GOOGLE this module) that even though they say 3.3V input, they don’t work well at that voltage. They run perfectly when supplied by the Arduino 5V pin.

To run your Arduino sketch pick up a copy of the needed ENC28J60  library from Elecrow here.

Need more information or sample code?  I found the best information about using this module is here:  tweaking4all.com

Careful! Don’t Let the Smoke out!

[warning]Careful! Don’t let the smoke out![/warning]

Hopefully you’ve never ruined any electronics device due to applying too much power. Some people have (cough, cough .. the voice of experience) and when this happens the device or component goes up in smoke. In popular jargon it is said to have “lost its smoke“.

When working with various components, always check their voltage ratings and make sure the input voltage does not exceed those limits.  Also, even with correct voltages, if certain components are wired wrong (like polarized capacitors)  they can still  be damaged.

So it pays to always double check things before you hit that power on button!

 

OBD-II Testing with an Arduino

OBD-II  (an abbreviation for  On-Board Diagnostics, Second Generation) is a set of standards for implementing a computer based system to control emissions from vehicles ( and a lot more ! ).  If you are not familiar with OBD-II you can read more about it here.

I just recently acquired an OBD-II UART board and cable

OBD-II UARTOBD-II Cable

from SparkFun.com, so I can diagnose any car problems. One end of the cable connects to the OBD-II connector on your car, the other end connects to the board.  The board can then connect to any serial port via a 6 pin header that needs to be soldered on.

The 6 pin header connects nicely to an FTDI board

FTDI Breakout 5V

that Sparkfun.com also sells.  The tutorial about this product shows how to attach an arduino and LCD monitor to capture data from your cars’ computer.

The board did not come with any OBD-II diagnostic / analysis software but there are a number of FREE and commercial offerings to choose from.

I like to write my own software and so I came up with this Python script to inquire for and analyze the OBD information. It is too big to post here so just click on the image to download it.

Python_small

If you’d like to test the Python code but do not have the OBD-II UART, you can substitute any Arduino you might have lying around. I wrote a simple sketch to emulate the OBD-II information coming from a ‘sample’ car. Just attach the arduino to your computer via any USB cable, load the sketch and run the Python script.

I tested it with my Aduino Nano.
Arduino Nano

Here is the sketch:

Atmel versus PIC Microcontrollers

Many years ago (I am old  ;-)) I was asked which microcontrollers are  best, ones from PIC (microchip.com) or ones from  Atmel (atmel.com).

At the time I was asked, there was a lot of discussion about chip architecture, instruction sets and which chip was best.

I thought at the time and still feel this way, it depends on too many factors to say which is best.

Certainly with the popularity of the Arduino the Atmega series of chips from Atmel got a boost in popularity.

For most of my projects, I find myself using an Atmega 328p mostly because I can buy it locally in my favorite electronics store cheaply and It is easily programmed with the Arduino IDE.

 

 

Fritzing Circuit Design Software

If you need a way to design a circuit or show a nice graphic of it for someone else to follow, you might consider Fritzing from fritzing.org.

A quote from their website:

Fritzing is an open-source hardware initiative that makes electronics accessible as a creative material for anyone. Fritzing.org offers a software tool, a community website and services in the spirit of Processing and Arduino, fostering a creative ecosystem that allows users to document their prototypes, share them with others, teach electronics in a classroom,and layout and manufacture professional pcbs.


 

Fritzing software is vector based so you can, drag and drop circuit components, easily re-size and attach wires.

It allows you to make COOL looking graphics like this:

fritzing

The Fritzing software comes with an extensive libary of components, however there are others who have created libraries of parts too. One of my favorite  Internet  hangouts is Adafruit.com. They have created a Fritzing library of parts which you can find on Github here.

Load more