Ardiuno Pro-Mini Bring Up

 The Plan

I have been playing around with various projects using my Arduino Uno and Mega.  Each time I have to rip up my previous project to move on to another to re-use the Arduino.  I would like to keep some projects in tact so I found a really cheap Arduino Pro-Mini platform for $3.08.  I bought it here: http://www.banggood.com/Wholesale-New-Ver-Pro-Mini-ATMEGA328-328p-5V-16MHz-Arduino-Compatible-Nano-Size-p-68534.html.  It is cheap enough that I could buy a few and dedicate them to some of my projects.

In addition to being really cheap, it is tiny.  It can be used on projects that I might want to be kept small.  The entire module is not much bigger than quarter.  Here is a picture…

IMG_0828

The Trade Offs /Limitations

Due to the small size (and likely the low price) this board is missing some things:

  1. This Arduino board doesn’t have a USB to serial module on board.  You will not be able to just plug in a USB cable to a PC and start working.  I plan on using a Arduino Uno’s SW UART to communicate with it.
  2. The Uno and Mega is powered from the 5V supply of the USB from the PC.  Since there is no USB port on the Pro-Mini, I will need to find another way to power the board.  If I am already using an Arduino Uno to communicate with it, I can just use the 5V output of the Uno to power it.

The 1st Power Up

All I did was to power up the Pro-Mini using my Uno.  Here is the Fritzing diagram….

ProMiniPowerUp

When power was applied, the power LED turns on and another LED started blinking.  With some probing around, I see that the digital IO pin 13 is the one blinking the LED.  I am assuming that the Arduino example sketch “Blink” was pre-loaded on the board…..

ProMiniBlinkLED

The Sketch Programming Process

I first tried to program the Pro Mini by following several tutorial on line with no success.  I was able to successfully reprogram the boot loader on the Pro Mini using this tutorial… http://arduino.cc/en/Tutorial/ArduinoISP but when I tried to load a sketch, it wouldn’t work.

I also found a tutorial on how to use an FTDI USB to Serial TTL adapter cable to load sketches to the Pro Mini here: http://arduino.cc/en/Guide/ArduinoProMini.  Reading through it, it looked really simple.

  • The serial communication is just using the standard serial RX and TX.
  • Power is supplied using the 5V supply of the USB cable.
  • The only somewhat complicated portion was using the cables RTS line to reset the Arduino.  This pin would be connected to the pin labeled DTR on the Pro Mini board.

Looking at the Pro Mini schematic (http://arduino.cc/en/uploads/Main/Arduino-Pro-Mini-schematic.pdf), this DTR line is a way to toggle the Atmel chips reset line…..

ProMiniDTR

It also looks like the push button can also toggle this reset line.

The Simplified Sketch Programming Process – My version

I really don’t want to purchase a FTDI cable so I came up with my own hack way of using my UNO board to program the Pro Mini.  In essence, I am going to use the USB to Serial module built on the UNO board as an FTDI cable replacement.  To do that…

  • connect the TX of the UNO to the TX of the Pro Mini
  • connect the RX of the UNO to the RX of the Pro Mini
  • connect the 5V of the UNO (which is being powered by the USB cable to the PC) to the VCC of the Pro Mini.
  • disable the rest of the UNO HW by tying the RESET line of the UNO board to ground.

Here is a quick Fritzing diagram…

ProMiniSketchProgrammingSetup

The only thing missing in this simplified set up is that the Arduino IDE can’t reset the Pro Mini during the programming process.  To get around that , I simply manually reset the Pro Mini during the programming process with the push button on the Pro Mini board (not the UNO board).  The sequence is….

  1. Set the board type to the Pro Mini in thd Arduino IDE.
  2. Set the COM port # to the COM port # of the UNO board.
  3. File -> Upload…
  4. When the IDE status is showing “Compiling”, I press and hold the reset button on the Pro Mini board.
  5. When the IDE status reaches “Uploading”, I let go of the reset button on the Pro Mini board.

You have to make sure to let go soon after the “Uploading” shows up.  The time window is about 2-3 seconds so is not that hard to time.  If you wait to long, you will miss the hand shaking during boot up and it won’t work reprogram the Pro Mini.   There is probably some signal I could find on the UNO that I could solder to to make the reset work but I like not needing to make too many mods to get this working.

With this process I can now reprogram my Arduino Pro Mini with HW I already have set up most of the time.

The Cautions

Soldering Capability:

  • The unit I bought did not have any of the headers soldered on.  I had to solder them on myself.  If you are not comfortable soldering, you might not be able to use the board.

L Header Placement:

  • This board has a convenient header with just the 6 essential signals to get the board running on one edge.  The kit also comes with an L header that is intended to be used for it.  I mistakenly soldered it to the underside of the board like the other 2 straight headers.  This causes a problem when trying to plug the board onto a bread board.  The L bracket gets in the way.  Here is a picture of the problem…
  • ProMiniLHeaderProblem
  • Once soldered on, it is really hard to remove since you would need to melt the solder on all 6 pins simultaneously while trying to pull out the header.  I am just living with it on this first one I bought.  Lesson learned.
Advertisements

Simple Android to Arduino Bluetooth Communication

The Plan

In my last post, I showed basic serial communication between an Arduino Uno and a HC-06 Bluetooth module (Arduino + Bluetooth Module Bringup).  I will now show how to use that to send characters back and forth between an Android phone/tablet and the Arduino over Bluetooth using the HC-06 module.

The Setup

Arduino Side:

I have the same Arduino Uno + HC-06 Bluetooth module setup from the above referenced post.  Here is the Fritzing diagram again…

HC06BasicConnectCorrected

I used the same serial passthrough Arduino sketch as I showed in the above referenced post.

DIAGRAM UPDATED: Someone noticed that I had the HV and LV supply reversed in my original diagram. I have corrected it.

Note: I used a HC-05 Fritzing symbol here (only one I could find). The State and Key pins are not there on my HC-06 module. Not sure what they should be connected to if it were a HC-05.

Andriod Phone/Table Side:

I used an Android tablet for my testing.  To prepare for the testing, I powered up the HC-06 module and Bluetooth paired my tablet with the HC-06 using the standard Android Bluetooth settings menu.  When I searched for devices in the Android Bluetooth menu, I saw a new device with name HC-06.  When I tried to pair with it, I was asked for a pin.  I found the default pin listed in the HC-06 datasheet (http://silabs.org.ua/bc4/hc06.pdf) as 1234.  I entered 1234 and successfully paired my Android tablet with the HC-06 module.  The HC-06 data sheet gives the command to change the pin if needed but I am just going to leave it as the 1234 default for now.

Next was to find an Android App that could send and receive Bluetooth characters/strings.  Since I have been playing with MIT’s AppInventor recently (see some of my previous posts with the AppInventor tag), I decided to just build my own.

The Bluetooth Android App

I have a feeling I will be working with Bluetooth often from now on so I decided to make a very generic Android App that can be set to run as BT server or BT client.  Once a BT connection is made in either mode, I want to be able to send and receive characters to the other side.

I created the app in MIT’s AppInventor environment but it would be a little too long to post a tutorial on all the steps.  If you are interested, here is my .aia file if you want to load it into your AppInventor environment and review it on your own….

https://drive.google.com/file/d/0B1a0nPfCQQvKd3NXdkJYeTk4dGM/view?usp=sharing

If you just want to install and use it, here is the .apk file…

https://drive.google.com/file/d/0B1a0nPfCQQvKTk9PZ0JkVG1sSk0/view?usp=sharing

Here are a couple screen shots…

ManualBTscreenshotManualBTScreen2

The App can actually be used without the Arduino + HC-06 setup.  It can even be installed on 2 Android devices then:

  1. Pair the 2 Android devices first
  2. Launched the app on both devices
  3. Click the “Start as Server” button on the 1st device
  4. Click the “Start as Client” button on the 2nd device
  5. If the Bluetooth link is established, the screen on both sides should change to have Send Text / Received Text boxes and Send button.
  6. Just type a string in the Send Text box and hit the Send button.  You should see the string show up in the Received Text box on the other device.

Here is a quick video demo…

The Android to Arduino Bluetooth Test

I didn’t find any documentation on the HC-06 datasheet on how to connect to a BT server so I assumed it was default set up as a BT server.  I launched my Android App and clicked “Start as Client”.  I had previously already BT paired the HC-06 on that tablet so it popped up as one of options to connect to.  I selected HC-06 and the connection was successful.  The red LED on the HC-06 went from blinking to solid on.  When I sent something from the Android App, it showed up in the Arduino serial monitor window.  Now when I typed something in the Arduino serial monitor window, it popped up in the “Received Text” box on the Android App.  Before the Arduino serial to HC-06 was for AT commands, but as soon as a BT connection established, it looks like the HC-06 automatically switched to serial pass through mode.

To better illustrate, here is a quick video demo….

Arduino + Bluetooth Module Bringup

The Plan

I wanted to add Bluetooth communication capabilities to my Arduino projects.  I found a $5.01 Bluetooth module here… http://www.banggood.com/HC-06-Wireless-Bluetooth-Transceiver-RF-Main-Module-Serial-For-Arduino-p-80364.html.  This post shows the basic setup I did to get communications started.

The Hardware Setup

The voltage for the module from the supplier listed above was set for 3.6V – 6V so the Arduino 5V supply output is ok.

I found the data sheet for the HC-06 module here: http://silabs.org.ua/bc4/hc06.pdf.  Unfortunately the Tx and RX voltage is 3.3V still so I also purchased a cheap $1.82 level shifter here: http://www.banggood.com/Logic-Level-Converter-Bi-Directional-IIC-4-Way-Level-Conversion-Module-p-938774.html.

For the basic communication, I just hooked up the TX and RX through the level shifter to a SW UART on my Arduino UNO.  Here is the Fritzing diagram…

HC06BasicConnectCorrected

DIAGRAM UPDATED: Someone noticed that I had the HV and LV supply reversed in my original diagram.  I have corrected it.

Note: I used a HC-05 Fritzing symbol here (only one I could find).  The State and Key pins are not there on my HC-06 module.  Not sure what they should be connected to if it were a HC-05.

The Arduino Code

For the basic test, I am just using a basic pass through Arduino sketch…

/*
 Software serial test
 
 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(7, 6); // RX, TX

void setup() 
{
 // Open serial communications and wait for port to open:
 Serial.begin(9600);
 mySerial.begin(9600);

 
}

void loop() // run over and over
{
 while (mySerial.available()>0 )
 Serial.write(mySerial.read());
 
 while (Serial.available()>0 ){
 mySerial.write(Serial.read());
 }
}

The Initial Test / Debug

I uploaded the Arduino sketch and opened the serial monitor and tried to send “AT” to the module.  Nothing came back.  Google’d around and found this post http://www.instructables.com/id/AT-command-mode-of-HC-05-Bluetooth-module/?ALLSTEPS.  One of the comments in the post said that you can’t send NL or CR in the serial communication to the HC-06 module.  Changed the serial monitor settings…

HC06SerialWindowBasicComm

Once I changed the serial monitor to not send any line ending, I was able to send AT+VERSION and get the response in the above screen capture.  Sending any line ending character resulted in no response.

The Next Post

I was able to Bluetooth pair the HC-06 with my Android tablet and write an Android app to send text back and forth to the Arduino.  That will have to be covered in a separate post.  I will post those development steps in my next blog post tomorrow (or sometime soon).