January 30, 2013

Fritzing - Veroboard and Breadboard design software


If you are looking for a free tool to create schematics and documentation for your prototypes, Fritzing may be right for you. It can also be used to created and manufacture PCBs from your design. Frtizing has three views that share and automatically update a netlist so that if a component or connection is made in one of the views it is also added in the other two. The views are called Breadboard, Schematic and PCB.


In the Breadboard view your design look and feel like physical objects. It has regular components like resistors, capacitors, inductors and ICs. It also has cables, Veroboard, Breadboard and blocks like an Arduino, sensors, servos, motors and many more.

The Schematic view is a traditional electronics schematics editor. As mentioned Fritzing has the most commonly used components and modules in the built in library but if your favorite part is missing it can easily be added. I added the JY-MCU Bluetooth module from my previous post by modifying an existing component within minutes.Download it here.

I felt that Fritzing is easy to use and learn. But it was not obvious to me how to cut the lines on a strip board. It turned out that it is quite simple, right click betweens the holes as illustrated with the arrow in the figure below.
I did not try the PCB design part at this time. Fritzing installer package are available for download from: http://fritzing.org

January 25, 2013

Bluetooth with Arduino

I recently purchased a low cost Bluetooth module with serial interface. I decided to hook it up to my Arduino.

Arduino UNO does only have one UART that is used for the USB serial terminal so it can't be used but there is a Software UART available that uses regular I/O-pins. For details see:
http://arduino.cc/en/Reference/SoftwareSerial

It works well at 9600 baud but when i tried 115200 the reception failed and received characters was corrupted. This worked in my previous test both with an FTDI cable and a Bus Priate.

The baud rate of the module can be changed by sending a AT command before connecting to the module to a Bluetooth device. The command is:

AT+BAUD<index>

Where <index> is an hexadecimal number from 1 to C. The rates are: 1:1200, 2:2400, 3:4800, 4:9600, 5:19200, 6:38400, 7:57600, 8:115200, 9:230400, A:460800, B:921600, C:138240

WARNING: Do NOT set it higher than your device is capable of since you will need to communicate at the new rate after sending this command. I used an FTDI cable for changing back the configuration. 

The board is marked "JY-MCU BT_BOARD v1.03". The supply voltage is stated to 3.6 - 6 V on the board. But the RX and TX terminals are 3.3 Volt logic. Therefore a voltage divider as shown in the figure below is need for the TX output on the Arduino when connecting it to RX on the module. The TX on the module can be connected directly to the RX on the Arduino. I have put the two resistors on a veroboard.The values are R1=10k and R2=20k.

Below is the Arduino code I used for the tests. It transmits received Bluetooth data to the USB terminal and vice versa.


#include <SoftwareSerial.h>
const int RxPin = 10;
const int TxPin = 11;

SoftwareSerial Bluetooth(RxPin, TxPin); // RX, TX

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect.
  }
  Serial.println("Init done!");
  // set the data rate for the SoftwareSerial port
  Bluetooth.begin(9600);
}

void loop() // run over and over
{
  int data;

  if ((data = Bluetooth.read()) != -1)
   Serial.write(data);


  if ((data = Serial.read()) != -1)
   Bluetooth.write(data);
}