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



August 19, 2012

Power supply quality impact on RF noise

I suspected that the PSU that came with the MK802 generate a bit of noise so I decided to compare it with a high quality PSU. Measurements with an oscilloscope on the USB port power line indicated that it seem to be true. So I prepared some python scripts to collect RF data from my RTL-SDR device to see how it affected the RF noise. The plot below shows the result. Red is the original power supply for MK802 and the blue is a "Nordic Power" high quality power supply. As seen it does get a few dB better with high quality power supply.

August 7, 2012

RTL-SDR Current Measurement

I was curious to know how much power the RTL-SDR (RTL2832 and E4000) dongle required since the setup in my previous post with an MK802 has limited ability to power USB devices. I modified an hub to break the Vcc line so that I could hook up an multimeter. With the dongle inserted and no software running it showed ~100mA. Running rtl_test with varying sample rate from 1 to 3 MSPS resulted in 180-190mA.

July 29, 2012

RTL-SDR on MK802


I wanted to see if it was possible to build a small and low cost embedded receiver with an ARM based Linux computer and a USB DVB-T tuner. The idea was to capture the signal and do some simple processing and monitoring. For the computer part a decided to go for the Rikomagic MK802 since it had a fairly fast CPU at 1 GHz and low price. I got some of my inspiration from this article:

 
MK802 runs Android on an internal flash but can also boot Linux from an microSDHC card. All my experiment where done under Linux. To find Linux images and installation guides go here: https://www.miniand.com
I used the image: Lubuntu 12.04

After preparing the Linux image and having a running system I needed to add development packages for C++ like build-essential, cmake, libusb-1.0.0-dev...

I used the graphical tool Software Center to add packages. To install it run the commands:

sudo apt-get update
sudo apt-get install software-center

(The default password is: miniand)

Building RTL-SDR

The build steps a described here:

I built it with cmake since the autotools gave me problems with libusb for some reason. After a successful build i ran the program rtl_test. It gave some promising results. Note that to access the device I needed to run it as root. I was able to run at 2.048 MSPS.

miniand@miniand:~$ sudo rtl_test -s 2048000 -t

Found 1 device(s):
0: Generic RTL2832U (e.g. hama nano)

Using device 0: Generic RTL2832U (e.g. hama nano)

Found Elonics E4000 tuner

Supported gain values (18): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0 21.5 24.0 29.0 34.0 42.0 43.0 45.0 47.0 49.0

Benchmarking E4000 PLL...

[E4K] PLL not locked for 51000000 Hz!
[E4K] PLL not locked for 2186000000 Hz!
[E4K] PLL not locked for 1093000000 Hz!
[E4K] PLL not locked for 1258000000 Hz!

E4K range: 52 to 2185 MHz

E4K L-band gap: 1093 to 1258 MHz

For a more substantial test i decide to try to receive a narrow band FM signal. There is a simple FM receiver included in the build. The command to use is:

sudo rtl_fm -f 155.5e6 -s 12000 -g -1.0 -l 150 - |play -t raw -r 12k -e signed-integer -b 16 -c 1 -V1 -
I transmitted with a Puxing PX777 at 155.5 MHz (that is a license free frequency in Sweden). I was able to hear the transmission. The audio was some what distorted but I was able to hear it. I decided to go to the next step by installing the python wrapper (some more software packages was also needed). It can be found here:

There are a few examples provided. I did successful runs of demo_waterfall.py and test.py (after some hacking in the scripts to get the settings right for frequency and sample rate). See the screen shots below.

To be continued...

I got the hardware from ebay.

MK802 ebay seller: http://stores.ebay.com/tomtopdigitalshop
Item name: "Mini Google Android 4.0 TV Box HD Player WIFI PC Allwinner A10 MK802 1GB White"

DVB-T USB TV dongle from ebay seller:http://stores.ebay.com/runteck88
Item name: "White USB DVB-T RTL2832U + E4000 for Windowns XP/ Vista/ Seven PC SDR GPS P335"

April 16, 2012

Problem with Windows update after replacing disc with clone

The past days I been struggling with replacing the hard drive on my laptop. At first everything seemed to work fine. But soon I discovered that Windows update wasn't working. The computer is Fujitsu ESPRIMO Mobile U9200 with Vista x86 (32-bit).

So why did Windows update fail to work? My conclusion is that in this case it because the new drive is a Advanced Format drive that the Windows device driver has problems with.

What is Advanced Format? Short explanation is that the physical sector size are different. To read more here:

http://en.wikipedia.org/wiki/Advanced_Format

Old disc: 120 GB OEM
New disc:WESTERN DIGITAL SCORPIO BLACK 750GB

This guide describes how I solved with Windows update failing after replacing the disc.
(This worked for my system. I will not take any responsibility if this fails for you.)

1) Prepare the system before cloning.
Make sure that you have all updates including SP2 installed.

Download and Install (Not sure that these are need but many forums suggest this. I did not try without them.):
http://support.microsoft.com/kb/2470478
http://support.microsoft.com/kb/2553708

2) Clone the disc with a clone tool. I used a Sandberg Hard Disk Cloner. It copies the disc without a computer. The process took less than an hour. Read more here:
http://www.sandberg.it/sv-se/product/Hard-Disk-Cloner

3) Install the new drive in the computer.

4) Align data (if your clone tool didn't do it for you. This tool will tell you if it is needed.)
Download WD Align Windows(AcronisAlignTool_s_e_2_0_111.exe) from http://wdc.com. Please note that you will need to create a login and provide the model number of your drive to download it.

5) Updating the Windows device driver.

Download the Intel Rapid Storage Technology driver. From intel.com (iata_cd_10.8.0.1003.exe)

My disc Controller chip (Intel 82801/HEM) was listed as supported but not included in the automated installation package so try to install iata_cd_10.8.0.1003.exe. If it is not working replace the driver manually. With these steps:

Take owner ship and rights for the file. Open a cmd window as administrator and type:

takeown /f C:\Windows\System32\drivers\iaStor.sys

cacls C:\Windows\System32\drivers\iaStor.sys /G MyUserName:F

Extract driver files:
iata_cd_10.8.0.1003.exe -a -a -p c:\Drvtmp

copy and replace c:\Drvtmp\Drivers\x32\iaStor.sys to C:\Windows\System32\drivers\

6) Reboot

7) Check that windows update is working.

December 6, 2011