Today’s the last day of my summer holiday, and I had some free time on my hands. So I decided to see if I could get my Arduino Uno and Raspberry Pi to talk to each other. It turned out the task was even easier than my previous Pi to RS-232 project – all that was needed between the two devices was some jumper wire and two 1 kOhm resistors to form a voltage divider between Arduino TX pin and Pi RX pin – Arduino understands Pi’s 3.3V signal levels just fine so Pi TX to Arduino RX needed no voltage shifting at all.
IMPORTANT UPDATE! It turns out that the RX pin on the Arduino is held at 5V even when that pin is not initialized. I suspect it is due to the fact that the Arduino is programmed via these same pins every time you flash it from Arduino IDE, and there are external (weak) pullups to keep the lines to 5V at other times. So the method described below may be risky – I suggest either add a resistor in series to the RX pin, or use a proper level converter (see this post for details how to accomplish that). And if you do try the method below, never connect the Pi to Arduino RX pin before you have already flashed the program to Arduino, otherwise you may end up with a damaged Pi!!!
Setting Raspberry Pi up for serial communications
In order to use the Pi’s serial port for anything else than as a console, you first need to disable getty (the program that displays login seen) by commenting the serial line out of Pi’s /etc/inittab:
If you don’t want the Pi sending stuff over the serial line when it boots, you can also remove the statements console=ttyAMA0,115200 and kgdboc=ttyAMA0,115200 from /boot/cmdline.txt. You’ll need to reboot the Pi in order for the changes to take effect.
I’ve wanted a more unique look to the blog for quite some while now, but hadn’t found any creative talent to help me with the process. Luckily I heard about Freelancer.com, and used their service to find a designer to help me with the process.
AFter some consultation, plus 10 hours of my work time to convert the design from Photoshop file to HTML and CSS, and then another 10 hours learning to transform that into a WordPress theme, I now believe I’m more or less ready to roll out the new look.
There may be some hiccups for a few hours at most while I’m testing the theme, and the look may revert back to Suffusion while I iron out any remaining issues. Sorry for that.
On electronics front, expect some new material rather soon – the blog design work has taken my time for the last two weeks, but I should have two very interesting projects to announce quite shortly!
In this part, I’ll have a short review of the PCB ordering process with Olimex, and a bit how the boards turned out. Let’s get going!
Ordering PCBs from Olimex
Once I had the Olimex technical requirements studied forwards and backwards, and the tedious design rule check process completed, I was ready to submit my order to Olimex. It was only a matter of sending the zip file to Olimex to get a quote. They promise a quote in 1-3 working days, and surely enough, I submitted my query on thursday evening and got the response early next week.
I had asked to pay with Paypal, which is a bit extra due to Paypal charges, but it seemed the guys at Olimex had ignored this bit in my readme.txt. However, they seemed quite prudent in their credit card data handling – it could only be faxed or sent in an encrypted zip file with the password sent separately as a text message. So I chose the latter way of payment, and received a brief “Thanks!” message afterwards in my mail.
I didn’t hear anything from Olimex after the brief thank you, but since the manufacture time was promised to be a week at most and airmail delivery 2-4 weeks after that, I waited patiently. And surely enough, after three weeks, I got a notice in mail that I had a parcel to pick up! The shipment was a normal letter, slightly crumbled outside but its content in excellent condition. All 16 PCBs were tightly wrapped in plastic foil, and looked really good. The total price with extra drill holes, delivery, tax and everything was 46.20€ (about $57), making the price for individual board less than $4 a piece. Not bad!
Just a short post today to inform interested readers that my interview was recently featured in Electrical Engineering Community EEWeb‘s. So if you’re interested, you can read the full interview. I talk a bit about how I got into electronics, my favorite software and hardware tools, a bit about this site as well as few other things.
It’s time to wrap up my DipTrace tutorial series with a brief look at how to do Design Rule Check (DRC) with the PCB layout tool, and generate gerber files for board manufacture. Take a look at the previous part on how the board was done.
I chose Olimex PCB prototype service because it’s very inexpensive by itself: 30€ for a two-side 160x100mm euroboard plus 5.50€ for shipping. They also can panel your designs and I counted that 16 ATtiny2313 headers would fit into a single board while still leaving room to cut them apart. Read on what was needed to make sure my PCB design was ready for manufacturing!
Design Rule Check (DRC)
The first thing before ordering was to investigate Olimex requirements for the boards. I knew I had no overlapping drill holes and had taken care to use only drill sizes supported by them (35 and 39 mils), so the most important ones for me were:
At least 8 mils spacing between tracks/pads
At least 8 mils for pads (i.e. 16 mils larger pad than drill hole)
UPDATED: 2015-02-15! This article has been very popular, so I’ve now updated all the benchmarks using the latest firmware and library versions. The scope has also been upgraded to a PicoScope 5444B with better resolution and bandwith than the earlier models. :)
Don’t try this at home! Shorting GND and VCC with a probe might fry your Pi and more!
Method and Summary of Results
The basic test setup was to toggle one of the GPIO pins between zero and one as fast as possible. GPIO 4 was selected due to easy access and no overlapping functionality. This is basically the “upper limit” for any signalling one can hope to achieve with the GPIO pins – real-life scenarios where processing needs to be done would need to aim for some fraction of these values. Here are the current results:
Language
Library
Tested / version
Square wave
Shell
/proc/mem access
2015-02-14
2.8 kHz
Shell / gpio utility
WiringPi gpio utility
2015-02-15 / 2.25
40 Hz
Python
RPi.GPIO
2015-02-15 / 0.5.10
70 kHz
Python
wiringpi2 bindings
2015-02-15 / latest github
28 kHz
Ruby
wiringpi bindings
2015-02-15 / latest gem (1.1.0)
21 kHz
C
Native library
2015-02-15 / latest RaspPi wiki code
22 MHz
C
BCM 2835
2015-02-15 / 1.38
5.4 MHz
C
wiringPi
2015-02-15 / 2.25
4.1 – 4.6 MHz
Perl
BCM 2835
2015-02-15 / 1.9
48 kHz
Shell script
The easiest way to manipulate the Pi GPIO pins is via console. Here’s a simple shell script to toggle the GPIO 4 as fast as possible (add sleep 1 after both to get a nice LED toggle test):