Carambola

28.05.2012 18:45

Small, very cheap computers running Linux seem to be all the rage these days. Everyone is talking about Raspberry Pies and announcements for similar hardware from various vendors keep appearing in my RSS reader. FreedomBox community has a thread on their mailing list that mentions most of them.

These devices are interesting both from the software and hardware standpoint. Raspberry Pi is often seen as a modern day equivalent of home microcomputers like Sinclair Spectrum, where children can learn to program in an environment where it's hard to destroy something important or expensive. But I think the hardware perspective is also important: most of these computers come with user-accessible, simple hardware interfaces, like GPIO pins, RS-232 ports and even low-level buses like I2C and SPI. Modern desktop computers have dropped these in favor of very complicated interfaces like USB that make it disproportionally hard to attach simple home-made electronics to them. Combine this with the simplicity that a multi-tasking, network operating system like Linux can offer in terms of Internet connectivity and it's not unlikely that the next hugely-popular hardware tinkering platform after Arduino will be running on one of these simple computers.

Carambola from 8devices is a relatively unknown computer from the lower end of this class. Since it is quite similar to the TP-Link TL-WR703N I saw at 28C3 I decided to get one and try it out.

8devices Carambola on a development board, top

By the way, in Slovene language number 8 is pronounced the same as English awesome. I wonder if something similar is the case in Lithuanian and if that is the story behind this company's name

8devices Carambola on a development board, bottom

Carambola comes in an Arduino-like form factor which you can see sitting on top of the larger development board on the picture above. It consists of a Realtek RT3050 system-on-chip that includes a MIPS CPU, 802.11b/g/n radio, 2 wired 100 Mb/s Ethernet interfaces, USB controller and a few other details. Also on board, but in separate packages are 32 MB of RAM and 8 MB of flash ROM. Apart from Wi-Fi which uses an on-board chip antenna, everything is available on two lines of pins. In contrast to Arduino, Carambola uses a male connector. Unfortunately pins are 2 mm apart, which means you won't be able to simply plug it into a standard protoboard. I guess the development board is pretty much a must for any prototyping.

First of all, while this is advertised as an open hardware platform, the schematic of Carambola itself has not been disclosed (development board design is available though). I haven't yet looked deep enough to check what is the status of the software running on Carambola. There does appear to be a datasheet available for RT3050 and 8devices also has a GitHub account.

Speaking of software, my Carambola came preloaded with OpenWRT Linux (bleeding edge, r30001). Default settings configured eth1 with a static IP 192.168.1.1 while eth2 used DHCP auto-configuration. ssh was installed and running, but since there was no password set for root it would not let me in. I connected a serial terminal to the RS232 port (running at 115200 baud), where I found a shell that allowed me to set the root password. After that I could connect to Carambola through one of its LAN ports via ssh.

Here is the output of a few commands that should give you an idea of what kind of system this is:

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    4.6M    276.0K      4.3M   6% /
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                    14.7M     40.0K     14.7M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock5            4.6M    276.0K      4.3M   6% /overlay
overlayfs:/overlay        4.6M    276.0K      4.3M   6% /
root@OpenWrt:~# cat /proc/cpuinfo
system type		: Ralink RT3350   id:1 rev:2
machine			: CARAMBOLA
processor		: 0
cpu model		: MIPS 24Kc V4.12
BogoMIPS		: 212.58
wait instruction	: yes
microsecond timers	: yes
tlb_entries		: 32
extra interrupt vector	: yes
hardware watchpoint	: yes, count: 4, address/irw mask: [0x0000, 0x0018, 0x0c90, 0x0810]
ASEs implemented	: mips16
shadow register sets	: 1
kscratch registers	: 0
core			: 0
VCED exceptions		: not available
VCEI exceptions		: not available
root@OpenWrt:~# free
             total         used         free       shared      buffers
Mem:         30176        14236        15940            0         1760
-/+ buffers:              12476        17700
Swap:            0            0            0

The pre-loaded system looks pretty complete, so I didn't bother with building a custom firmware image yet. gpioctl tool was already installed, which meant I was able to play with GPIO ports (nicely exposed on the development board in a small prototyping area) directly from the shell.

For instance, running this:

root@OpenWrt:~# while true; do gpioctl set 1; gpioctl clear 1; done

produces a square wave with approximately 60 Hz on the first GPIO port, which also gives you a rough estimate of the performance of shell scripting for embedded programming.

In conclusion, this is an interesting piece of hardware, but for which I don't currently have a concrete application. The documentation is somewhat chaotic, with useful information appearing on the wiki, forum and 8devices web site.

I wonder how this hype with small Linux computers will turn out. It reminds me of netbooks in some ways and that didn't turn out all that well, with vendors dropping the light-weight, Linux running solid state computers when their customers realized they couldn't run full-blown Windows software on them.

Posted by Tomaž | Categories: Digital | Comments »

Seeed PCB service

23.05.2012 22:29

Remember back in February when I was writing about an PM-OLED display I got from Farnell? I recently learned about Seeed, a cheap PCB manufacturing service in China, through Dangerous Prototypes. Since I was not optimistic that I can make a usable footprint for the display with a home-made board I decided to order the design at Seeed and test the display as well as this new manufacturing service.

Ordering a PCB through Seeed Fusion PCB service is quite simple and worked without a hitch for me. You order a correct manufacturing option in the web shop and send the design files (Gerber for artwork and Excellon for drills) in a zip file to their e-mail address. The basic offering is 10 pieces of a two-sided board with silk, solder mask and copper layers on both sides, green finish and a 50% electrical test. You can also add a few options that cost extra, like different solder mask color or RoHS-compliant finish. Price increases in steps in relation to the board dimensions, with the minimum at 5 x 5 cm.

They have a few special requirements that you need to watch for when making design files though. You have to have a board outline on one of the layers and you have to include the order number they send you on the design somewhere. Other than that, the design rules are pretty standard. Minimum trace width is 6 mil. There's also an excellent guide to using the service which goes step by step using CadSoft Eagle.

I used gEDA PCB to make the artwork for this particular board and I didn't have any special problems. Seeed expects the files to be named in the same way Eagle does (foo.GTL versus foo.front.gbr), so you need to do some renaming after exporting the design to Gerber in PCB.

PCBs for an Arduino shield with an OLED display

So how did it work in practice?

The cartoon box I received by mail contained 11 boards, one extra over my order of 10 pieces. Perhaps because my Arduino shield design was just a little bit too large for the 5 x 10 cm and I had to pay for 10 x 10 cm. It also appears that all of my boards have been electrically tested, not just 50%, since all of them have markings on the side. Nice surprise there.

I have no complaints over the manufacturing quality. I inspected all eleven boards and I can see no apparent defects (compared to some other cheap PCB manufacturer that managed to botch one board out of four) and drills are perfectly aligned.

If you look closely, straight lines on the silk screen layer have a somewhat jagged, pixelated appearance, which might be because of some calibration procedure (the effect looks similar to what you get on a projector where you correct the perspective in software). But this is just a very minor cosmetic problem and copper layers do not have any such effect. Seeed also inserted some kind of a batch number in small print on the bottom side stop mask layer. In my case it's over the ground fill so I guess they position it in a way that does not affect any artwork.

OLED Arduino shield with components soldered on.

From the day I sent the email with the order it took 22 days before the package turned up at my local post office. The total cost for the PCB which is the size of a typical shield for Arduino Duemilanove was 26.05 €. I think this is an excellent value for the price. The long turn around time still makes it more practical to make simpler one-off boards at home, but for multiple pieces or smaller dimensions I will definitely use this service again.

And I guess another good thing about dealing with Chinese is that they do know their Unicode and don't mangle my non-ASCII name in their correspondence.

Posted by Tomaž | Categories: Life | Comments »

Fixing the ground loop

19.05.2012 13:49

The building I live in has very old electrical wiring and doesn't have safety grounds in the wall sockets. When I moved in I connected all ground pins of Schuko sockets to the neutral wire. My computer is powered from such a socket as well as anything electrically connected to it, so all devices share a common ground point. This ground however is above the real ground potential because of the voltage drop on the neutral line from all the electrical appliances in the building.

I also have a TV receiver connected via HDMI to the computer and that is connected to a coaxial cable from the cable TV system. The cable system as it turns out has a different grounding point, which means that current flows between the TV antenna connector ground and the Schuko ground pin.

This is annoying since it causes mains hum in my speakers and makes it possible to hear my neighbor's washing machine ramping up RPMs from the interference it causes on the ground line.

Today I finally found time to make an end to all of this and made a galvanic isolator for the antenna. I took the coaxial cable, cut away the original connector and replaced it with this hand-crafted thing:

Galvanic isolation for a coaxial cable

I isolated the ground ring from the connector's metal body via strip of insulating tape and bridged the gap with capacitors. I didn't have 10 nF 500 V capacitors handy, so I used two 5.6 nF in parallel. The only problem I had was that the shield of this coaxial cable is from an alloy that can't be soldered, so I just tightened the clamp around the exposed braiding. The core wire was made out of copper though, so there were no problems soldering that to the central pin through another pair of capacitors.

If you have similar problems, there is a nice web page that explains all the different approaches you can make when isolating an antenna connection.

Posted by Tomaž | Categories: Analog | Comments »

Theory and Practice of Cognitive Radio

14.05.2012 11:32

Last week I attended a three day course at Aalborg university on cognitive radio. Cognitive radio research is the reason behind the development of spectrum sensing hardware for VESNA. Since I haven't encountered this field before joining the Jožef Stefan Institute I decided to go to this course to get some background and to better understand what is the state of the art in radio communications.

Aalborg university

It turns out cognitive radio means many things to many people. In the most broad sense it's an autonomous device that can optimally use the electromagnetic spectrum for communication by being aware and capable of adapting to its environment. This idea is then developed by some to an extreme, where the radio contains strong artificial intelligence that has perfect knowledge of its surroundings and is capable of predicting future events and the wishes of the user. For instance a mobile phone that learns your daily commute and plans ahead in cooperation with base stations on how to optimally use the cells on your way to the office. The personal digital assistant idea is strongly coupled with this and sometimes cognitive radio device is even described as being capable of communicating with the user through speech and natural language.

But such visions I only see as a thought experiment, as I can see no indications that such machines will be possible anytime soon. On the other hand however there is a more pragmatic approach to cognitive radio that concerns itself mostly with how to more efficiently use the limited amount of usable frequencies and overcome the spectrum crunch. This research covers for instance new ways to dynamically allocate frequency bands beyond very static licensing regulation that is in use now, how to enable secondary use of frequencies that are unused by people that initially licensed it for exclusive use and how to decentralize frequency allocation. It is also tightly connected to software defined radio technology that enables this kind of quick reconfigurability of radio devices.

USRPs, part of the ASGARD test bed at Aalborg university.

Besides lectures that covered information theory, networks, game theory, machine learning, software radio and economics we also had a practical demonstration of the ASGARD software radio platform. Guys from Aalborg university demonstrated three pairs of USRP devices that were dynamically and autonomously selecting radio channels in a shared 5 GHz ISM frequency band so that the interference between them was minimized.

The course concluded with a poster session where I also presented the spectrum sensing expansion for VESNA with the following poster (PDF version).

UHF spectrum sensing with VESNA, poster

Posted by Tomaž | Categories: Life | Comments »

White box model

06.05.2012 20:50

In a month or so, we will be deploying around 50 VESNAs to a wireless sensor network in one of Slovenian smaller cities. VESNA boards, sensors and other electronics will be mounted in white plastic boxes and fixed on top of light poles alongside public streets. It will look somewhat similar to this temporary mock-up we set up in the Jožef Stefan Institute courtyard the other day:

VESNA sensor node mounted on a light pole

While these boxes are certified to be resistant to the elements and provide adequate shielding for sensitive electronics within, one question remains open. In the summer the air temperature can reach 40°C and with the boxes exposed to direct sunlight the inside could get uncomfortably warm. The ARM microprocessor on the VESNA core module only dissipates around 100 mW at worst, however my UHF spectrum sensing receiver, which is also going to be inside the box, has to shed close to 1.5 W of heat while not heating up over 120°C. If the air inside the box is at 80°C from the sun alone, this requirement might require some extra measures to meet.

Unfortunately, there are no exact specifications on how the boxes behave in this respect. To get a rough estimate of the situation I defined the following thermal resistance model of the box and performed some experiments in an attempt to determine some limiting values on the environment my electronics will have to endure.

White box thermal resistance model

Here, Ta is the environment air temperature, Tb is the temperature of the box itself and Tc is the temperature of the air inside the box.

First experiment was to determine the contribution of the sun (Psun). I put a VESNA node running on batteries inside the box which was mounted in a sunny position on a south-facing balcony. VESNA was running a temperature logging application which recorded the ambient temperature every few minutes.

Temperature inside the box, exposed to direct sunlight

In the ten days the experiment was running we had 8 sunny days. If you look at the highest peak, the temperature inside the box was somewhere in the vicinity of 55°C, while the air temperature outside the box (not drawn on the graph) was around 25°C. So, in early May the sun already heated up this white object to 30 K above the ambient.

The second experiment was to determine the contribution of the UHF scanner's power dissipation on internal air temperature. I placed a ceramic resistor inside the box and set up a lab power supply so that 2 W were dissipated on the heater (Pc). This time I used two battery-powered VESNA nodes to log the air temperature inside and outside the box.

Temperature inside and outside the box, with 2 W heater inside.

While this experiment was performed inside and in the shade, the daylight still somewhat affected the ambient temperatures by heating up the room, so the thermometer outside the box recorded a slight increase during the day. During the day I also turned on the heater (I didn't want to leave it running over the night), which resulted in around 5 K increase in the internal air temperature.

If you look at the model I pictured above, these measurements are unfortunately still inadequate to determine both thermal resistances. From the second experiment you can calculate that Rab + Rbc is around 2.5 K/W, but to get individual resistances you would need to know the thermal input from the sun, which depends on the unknown albedo of the box.

However, at this point this detail is irrelevant. From the first experiment in know that the sun will contribute around 30 K and from the second experiment I know that internal power dissipation with add another 5 K above the ambient. If I take the worst case air temperatures outside to be 40°C, this adds up to 75°C inside the box. From this I can now calculate the maximum allowed thermal resistance between the tuner IC's silicon and the inside ambient and from that choose the appropriate cooling solution.

Posted by Tomaž | Categories: Life | Comments »