Orange Pi One & Lite as music streamers (Part 2)

In Part 1 we installed Armbian on our Orange Pi One (or Lite) and set it up on our local network. At this point, all our work can be done on any PC that is on our network, via SSH connection (putty etc.).

Enabling I2S output
First order of business is enabling the Pi’s I2S output. To do that, we need to edit what is called a FEX file. This FEX file (script.fex) is essentially a hardware configuration file for the Pi. For example, if we wanted to enable or disable a serial port at the hardware level, we would edit this FEX file.

The problem is, this FEX file exists in binary form in our file system so in order to edit it, we need to convert it to a text file. To do that we use the bin2fex command.
So, step by step:

Log into Pi as root and type:

cd ..
cd boot
bin2fex script.bin script.fex
nano script.fex

Nano is a relatively user friendly editor for Linux, I use it for all my text editing.

Look for twi1. Change it to this:

Then look for pcm0. Change it to this:

Once we are done editing the file, we hit Ctrl-X and choose to save the file before exiting.

Then we need to convert the .fex file back to .bin. We type:

fex2bin script.fex script.bin

and we reboot.

We confirm that we have a new sound device called snddaudio by typing in aplay –l :

Network Share configuration
Now that our I2S output is enabled, we need to give our Pi access to our music. I prefer to store my music in a Synology NAS so I need to configure a network mount on the Pi.

We start by creating a mount point for our share. That can be any empty folder. I choose to mount my shares in mnt/nas-samba. Let’s create that:

cd /mnt
mkdir nas-samba

Then we install the package cifs-utils:

apt-get install cifs-utils

Now we get to the actual mounting of the share:

nano /etc/fstab

For my setup, I add this line: //192.168.0.32/Music /mnt/nas-samba cifs username=,password=,ro,iocharset=utf8,nolock,noauto,x-systemd.automount,x-systemd.device-timeout=10,sec=ntlm,rsize=8048,wsize=8096

This tells our Pi to mount the share //192.168.0.32/Music to the folder that we created above using the credentials that I have supplied. You will need to customize this command to your own network environment.

After a reboot we go to our mount point and have a look inside:

To confirm that the share has been mounted we can use the df -h command, as can be seen above.

MPD Installation

The software on our Pi that does the actual music playback is called MPD (Music Player Daemon). To install it we enter:

apt-get install mpd

This will take a while, since MPD has a bunch of dependencies that will also be downloaded and installed.

Once the installation is finished, we will need to configure it. To do that, we edit mpd.conf:

nano /etc/mpd.conf

We need to do three things:

1) Set our music directory to /mnt/nas-samba:

2) Change network binding to “any”:

3) Change the “audio” setting to select our I2S audio output:

We put in this:

audio_output {
        type            "alsa"
        name            "I2S DAC"
        device          "hw:1,0"
        format          "*:32:*"
        mixer_type      "software"
#       mixer_device    "default"       # optional
#       mixer_control   "PCM"           # optional
#       mixer_index     "0"             # optional
}

This configuration creates an ALSA device called “I2S DAC” that utilizes the Pi’s I2S output. It up-samples all files to 32bits (don’t worry, it doesn’t deteriorate the SQ in any way. It just pads with zeroes when necessary) in order to make this setup compatible with my Buffalo III. Also, it enables software volume control. You can disable it by commenting out the relevant line.

Once we are done, we save the file and quit nano. We then restart MPD to apply the changes:

systemctl restart mpd

MPD Clients Installation

Once MPD is installed, we will need a “human friendly” way of interfacing with it.
In other words, we will need to install what is called a “client”. There exist all kinds of clients, from command line based ones, to web-based environments, to apps for smartphones and tablets. In my setup I install two clients, a command-line based one (mainly for testing purposes) and a web-based one for more general use.

To install the classic command line client “mpc” we enter:

apt-get install mpc

That should take almost no time.

Now that we have at least a basic client installed, is a good time to check that MPD is actually working. To do that, I usually do this:

mpc add http://netradio.live24.gr/886radio
mpc play
mpc status

What these commands do is:

1) Add my favorite internet radio station to MPD’s playlist
2) Start playback
3) Check that playback has indeed started.

If it all went well, you should see something like this:

If you have already connected an I2S DAC, you should be hearing music. This means that your MPD is functioning, so the hard part is done.

If by chance you’re looking for the Orange Pi One / Lite’s I2S pinout, you’re in luck. Here it is:

At this point you have a choice to make. You can either install an app on your smartphone or tablet and get things done that way, or you can install a web-based “rich” client. I like rich clients, so after a brief internet search I came across RompR.

Installing RompR

The people behind RompR have written a pretty comprehensive installation guide. All of the necessary info is there, for all platforms. But, since this post has to do specifically with the Orange Pi, I’ll give you a customized version of the installation guide. This should take you about 10 minutes. Let’s start.

First we’ll download and install all of the necessary packages:

apt-get install apache2 php5-curl php5-sqlite imagemagick libapache2-mod-php5 php5-json

Then we will download the actual binary into a temp folder:

cd /mnt
wget http://downloads.sourceforge.net/project/rompr/rompr-0.78.zip

Next step is extracting the files to /usr/bin/rompr:

unzip rompr-0.78.zip -d /usr/bin/

..and we get to the editing of .conf files part:

nano /usr/bin/rompr/apache_conf.d/Apache2.4/rompr.conf

We have to replace every /PATH-TO-ROMPR with /usr/bin/rompr:

When we’re done we exit nano, saving the file.

Then we copy this file to its final location:

cp /usr/bin/rompr/apache_conf.d/Apache2.4/rompr.conf /etc/apache2/conf-available/

We take care of a few permissions:

chmod -R ugo+rw /usr/bin/rompr/prefs
chmod -R ugo+rw /usr/bin/rompr/albumart

And we finish up:

a2enconf rompr
a2enmod expires
a2enmod headers
service apache2 restart

At last, it’s time to see if our installation works. We type into our browser our Pi’s IP followed by /rompr:

All we have to do now is update MPD’s library. We do that by hitting the red Update Music Collection Now button on the left and we’re done.

Enjoy..

Controlling an AK4490 DAC with an Arduino

These days I’m co-developing an AK4490 based DAC. The aim is to end up with a no-compromise dual mono design, one that would perform at the very least on par with my Buffalo III.

Of course, to do that one has to run the 4490s in software mode.

As a matter of fact, it is generally preferred to run a 4490 in software versus hardware mode, for several reasons.

To begin with, in software mode the 4490 supports DSD decoding. It goes as far as to support a “Volume Bypass” feature which bypasses most of the processing done on the DSD signal (a.k.a. “the ΔΣ modulator”), resulting in more pure sound. But of course we do lose the ability to do volume control in software.

Software mode also allows us to try out all of the supported SQ features, like the different “Sound Setting” modes.

At last but not least, we get digital hardware volume control.

This is the prototype that we designed, getting I2S input from an Amanero and being controlled by my custom STM32 controller (more on that in the near future).

I searched the Net for any ready-made code that would control the 4490, but I couldn’t find anything worthwhile, so I began virtually from scratch.

So, my Arduino code (a.k.a. “aKduino”) enables:

  • Controlling an AK4490 through the I2C bus.
  • Automatic switching between PCM and DSD. It does rely on getting a “DSD type signal” from our USB-to-I2S interface of choice. The 4490 by itself is not capable of determining whether its input is PCM or DSD.
  • Setting the volume (in 9 steps.. just to confirm that volume control does indeed work).
  • Selecting “Volume Bypass” for direct DSD processing.
  • Selecting the internal DSD filter’s cutoff frequency (50KHz or 150KHz).
  • Selecting one of the 4 available PCM filters.
  • Enabling or disabling the Super Slow filter.
  • Selecting one of the 3 available “Sound Quality” settings.
  • Displaying all of the registers’ settings (for troubleshooting purposes).

Software Requirements:

  • Nothing (for now)

Basic Hardware Requirements:

  • Any Arduino (*)

(*) I should note here that the AK4490’s datasheet states that all of its I/O pins are expecting 3.3V logic levels but there has been a large number of reported cases of 5V Arduinos working without problems. I’m too much of a coward to try that myself so I used level converters for my initial testing and eventually a custom STM32 board that uses 3.3V logic but you may want to try your luck with 5V logic levels. Just don’t blame me if your 4490 gets damaged in the process.

Currently the code is at v1.35: aKduino Code (154319 downloads )

Here is the revision history:

v1.35 20/12/2016:

  • Code cleanup for first public release.

v1.33 19/12/2016:

  • Added full control of sound parameters through serial port.

v1.27 18/12/2016:

  • First functional version.
  • Automatic switching between PCM and DSD by monitoring DSDPIN.

Orange Pi One & Lite as music streamers (Part 1)

Meet the Orange Pi One:

Orange-Pi-One-1

Orange-Pi-One-2

and its brother, the Orange Pi Lite:

orange-pi-lite

They are single board computers (SBCs) much like the Raspberry Pi, but they will set you back just over 10€ plus shipping. That is just insane value.

They offer a quad core ARM Cortex A7 processor running at 1.2GHz, 512MBs of DDR3 RAM, an Ethernet port (One) or WiFi (Lite), a couple of USB ports, an HDMI port, etc.
They run Linux (of course..) or Android.

I came across them (the One actually) while watching Dave Jones’ channel on youtube and thought I would give it a try.

I needed an inexpensive way to listen to internet radio while I was in my kitchen. I already had a low end system set up, consisting of a couple of bookshelf speakers, a power amp and a Squeezebox Classic, but I had to move the Squeezebox to another room so I needed something to take its place. The Orange Pi One plus an inexpensive I2S DAC would fit the bill very nicely.

The idea was to load a stable Linux distribution onto the One and set-up MPD to work with my el-cheapo I2S DAC.

The steps that I am about to describe took me about a day to figure out and needless to say, I learned a lot in the process.

Let’s start with the basics.

You will need an Orange Pi board, a proper power supply (USB power will not work – I suggest that you buy a bundle of Orange Pi + Power Supply from aliexpress), a 4GB (or bigger) Micro SD card and an I2S compatible DAC that does not require a MCLK signal (like an ES9023-based one with an on-board oscillator). For the initial setup you will also need a monitor with an HDMI (or DVI with an adapter) input plus a USB keyboard. If you are a bit more hardcore, instead of using a monitor & keyboard, you can just use the Pi’s serial port with a serial to USB module and putty.

The first step is getting our hands on a Linux distribution that will be a good fit to our application. You might notice that there exist a number of official One distributions: http://www.orangepi.org/downloadresources/ The Lite is not so lucky.

The general consensus is that most of them have issues. The best choice appears to be the Armbian distribution:

For the One: http://www.armbian.com/orange-pi-one/
For the Lite: http://www.armbian.com/orange-pi-lite/

Armbian is based on Debian and is very similar to Raspbian (also based on Debian), so if you’ve used Raspbian on a Raspberry Pi you will feel right at home.

For our application we are going to go with the Jessie Server image. We need to put this image file on a Micro SD card. I use Rufus.

We insert the SD card in the Orange Pi, we connect our monitor, keyboard, ethernet and power the thing up.

After about 15-20 seconds, the green power-on LED will start flashing and soon after you will see the initial login screen:

orange_pi_one_1

The default credentials are root/1234.

You need to change the default password to one of your liking. Following that, your Pi will request that you create a new user account:

orange_pi_one_2

Once you’ve done that, you will be asked whether you would like to change your Pi’s resolution to match your screen’s:

orange_pi_one_4

In my case, my lab’s monitor has a 1920×1200 resolution, so I chose to go with the highest supported resolution, so I typed:

h3disp -m 10

One reboot to go and we will be done with the initial setup.

At this point I should point out that I routinely log in to my Orange Pis as root. I can see some of you cringing but I don’t care. Security is way low on my list of concerns when it comes to my SBCs that I use for music playback. If you use a normal user (and not root) on your SBC, all you have to do is prefix the commands that I use with the command “sudo”.

So now, if you have a Pi One and it is connected to your network, it should have acquired an IP from your DHCP server. If you have a Pi Lite, you will need to do some extra work to get it to connect to your WiFi network.

To configure the Lite’s WiFi adapter you need to edit the interfaces file:

nano /etc/network/interfaces

If you would like your Pi to get an IP automatically from a DHCP server, you do this:

# Wireless adapter #1
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

If you are the more traditional type and you would like to go for a static IP, you put in:

# Wireless adapter #1
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.200
netmask 255.255.255.0
gateway 192.168.0.250
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

replacing the above IPs with ones suitable to your environment.

You might notice that in both cases we are mentioning a supplicant.conf file. This file does not exist yet, so we have to create it:

nano /etc/wpa_supplicant/wpa_supplicant.conf

and then type in:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="your_ssid"
psk="your_password"
key_mgmt=WPA-PSK
priority=99
}

Again, replace your_ssid and your_password with your actual SSID and password. Note that it doesn’t matter if you are using WPA or WPA2, the script is the same.

When you are done, save the file (Ctrl-X and then Yes a couple of times) and reboot your Lite.

When the system comes back up log in and check if you are connected to your access point by typing:

ip a

You should see something like this:

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: tunl0:  mtu 1480 qdisc noop state DOWN group default
    link/ipip 0.0.0.0 brd 0.0.0.0
3: wlan0:  mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:e0:4c:99:f8:3b brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.200/24 brd 192.168.0.255 scope global wlan0
    inet6 fe80::2e0:4cff:fe99:f83b/64 scope link
       valid_lft forever preferred_lft forever

You should see that your wlan0 interface now has an IP.

Congrats, your Lite now has network access. This means that you can put away the monitor & keyboard that you used to configure your Lite and continue on your desktop / laptop by logging in through SSH (using Putty or any other SSH compatible terminal program).

Logging in from Putty, we come to this prompt:

orange_pi_one_5

Next, we have to do a full update & upgrade of our installed packages:

apt-get update
apt-get upgrade

The update part should go pretty fast, but the upgrade part will take some time, depending largely on your SD card’s performance.

This concludes Part 1 (a.k.a. “the boring part”). Part 2 will include enabling the Orange Pi’s I2S output and setting up MPD.

Kali FIFO Buffer & Reclocker for SBCs

kali_on_bench

Back in August an interesting thread was started on diyaudio.com.

It described a FIFO buffer and reclocker, aimed at SBCs and more specifically the RPi.

Its name was Kali.

The FIFO board would be able to “fix up” the RPi’s problematic I2S output so as to improve the sound quality of the used DAC.

As the discussion progressed, more interesting details came to light.

Kali was basically an FPGA design with on-board RAM, high quality clocks and flip-flops. It would buffer the DATA stream in RAM (about 0.7 seconds of audio) and it would then reclock it using flip-flops outside of the FPGA. The clocks used for the reclocking would be high quality NDK units sporting extremely low phase noise.

It would be powered by a 5V/3A power supply and would supply filtered power to the RPi (or not, selectable by a jumper) as well to the DAC that would sit on top of Kali.

It would have a claimed 3ps of jitter, which is an impressive feat for any I2S source.

It would provide a high quality MCLK output from a U.FL jack underneath the board.

The board’s general availability was scheduled for the end of August, and its price would be in the neighbourhood of $70.

At around mid August cdsgames offered to give away a number of units to diyaudio members for testing. I took him up on his offer and he was kind enough to send me one (along with a Piano 2.1 DAC board, but that’s for another post).

Fast forward to mid-September, when I received a package from India. In it was Kali and Piano 2.1 (more about that in another post).

kali_in_packaging

On the left side of the board we can see the DC IN jacks (barrel and pin header), plus a couple of inductors that help with filtering the power lines. On the top left there is a jumper that controls whether Kali will supply power to the RPi or not. The Kali lists as minimum requirement a 5V/3A power supply. However, Kali itself will consume only about 100mA. The rest of the power is intended for the RPi and the DAC board. Note that Kali is designed so that it powers the RPi and not the other way around.

In the middle of the board the two chips that dominate are the 4Mbit SRAM chip and the Lattice MachXO3L-4300 FPGA itself.

To the right we have the two NDK clocks, one for each one of the two “families” of sampling rates.

kali_clock

The Kali comes in two versions. One with clocks at 22/24MHz, capable of supporting sampling rates up to 192KHz, and one with 44/48MHz clocks, going up to 384KHz.
Note that there are two footprints available for the clocks so that a curious (and somewhat experienced) DIYer can also try out clocks with different footprints, like for example Crystek units. If you choose to go that way, keep in mind that you will also need to change 2 capacitors from 0.01uF to 0.1uF.

At the top of the board we have the usual 2×20 header that reproduces the RPi’s GPIO pins. There is one notable exception – Kali does not supply 3.3V at the relevant pin, so if your DAC needs to take 3.3V from that pin it will not work (more on that later).

Note that even though Kali has a JTAG header, the manufacturer currently does not support firmware upgrades. That’s understandable.. JTAG is not for consumer use and the manufacturer has to protect his IP..

At the lower end of the board we have an array of LEDs indicating the sampling rate of the incoming signal, along with the status of the buffer (Empty / Full / Lock) and the selected oscillator.

kali_lights_on_44-1k

At the bottom of the board there is a U.FL socket that outputs Kali’s MCLK.

kali_mclk_out

So, we have an RPi, we have Kali, now what we need is a DAC. Kali will put a few restrictions on your DAC choices. Your DAC will have to run as “slave” to the RPi, that is it will have to take its BCLK from the RPi and not the other way around. Examples of such DACs include for example virtually all of the DACs based on ES9023 chips. DACs that are designed to run as masters (in order to battle the RPi’s legendary jitter problem), such as the Hifiberry Dac+ Pro & Digi+ will not work, at least not without some extra work.

Plus, like I mentioned earlier, Kali does not supply 3.3V on its top 40-pin header, so if your DAC requires that voltage you’ll need to find a way to supply it externally.

Straying a bit from the DAC HATs, Kali will have no problem feeding pretty much any DAC that accepts standard I2S, like for example a TPA Buffalo DAC.

kali_buffalo_iii

As a matter of fact, in my system Kali did a remarkable job of improving my RPi’s I2S output. The difference was obvious immediately. My RPi went from being a “net streamer quality” source to giving my Amanero a run for its money. Remarkable.
I am not talking about differences in bass or treble or tonality. It is like Kali manages to extract more music content from the data files. It revealed details that were there but were not audible. The music became more “real”. Imagine going from SD TV to HDTV. And that with the same 44.1K/16bit source material.

This improvement is not apparent only on expensive gear either. My first tests were done on my workbench with my RPi feeding an $8 9023-based DAC and listening through my headphones.

kali_tests_workbench

Even with this setup, Kali made a significant improvement to the sound. The $8 DAC went from sounding like an $8 DAC to performing at least decently. It was an obvious improvement.

So I can not imagine a scenario in which the Kali will not make an audible improvement to the sound.

Note that the first batch of Kalis (the ones that were sent to reviewers and a small number of units that were actually sold) had a bug that caused 16bit audio to have its channels reversed (and some more weird stuff happening with their I2S output resulting in somewhat degraded sound quality), but according to allo.com all effected units have been exchanged with fixed ones plus the ones that are shipping now to customers come with a fixed version of the firmware.

Even if for some reason you come by an affected unit, all you have to do is tell your RPi to output 32bit audio. That will fix everything.

I’d like to thank Ioan (cdsgames at diyaudio.com) for sending me the remarkable Kali. It will for sure become a permanent part of my audio chain.

At the time of this writing, Kali is being sold directly from its manufacturer’s site (allo.com) as well as from Volumio’s online shop.

uRADMonitor KIT1

About a year and a half back, while watching a mailbag clip from EEVblog, I learned about the uRADMonitor project by Radu Motisan.

The idea was to build a network of monitoring devices all around the globe that would measure radiation levels and display the results on a global map.

I noticed that there existed no data for Greece, so I thought I would fill that gap in the map. I enquired about a uRAD measuring unit but realized that it was kind of pricey (~$200 for a finished unit) so decided to wait for the Indiegogo campaign that had already been announced.

The campaign ran successfully, so I ended up owning a uRADMonitor KIT1. These are the contents of the kit:

uRAD_KIT1_01

The smaller components come nicely sorted and taped to a piece of paper:

uRAD_KIT1_02

The PCB itself is of typical quality:

uRAD_KIT1_03

You might notice that there is no silkscreen detailing the names of the components. I hope Radu changes that in future revisions of the KIT1.. It would make building the kit a lot easier.

The kit comes with a pretty nice manual. In the manual among other useful info you can find a parts placement diagram:

uRAD_KIT1_04

..and a BoM:

uRAD_KIT1_05

You will notice that I have added a couple of transistors to the bottom of the BoM. They appear to have been left out of the BoM by accident. No biggie.

To actually build the kit one has to correlate info from the parts placement diagram and the BoM. It’s not really difficult to do, but it might trouble a novice in electronics.

We start by soldering on the lowest-profile components. That means the resistors, the diodes, the inductors, the ceramic capacitors, the IC’s socket, the crystal and the push-button.
We continue with the transistors and the voltage regulator IC. Take care to follow the instructions here – R7 should be left open (no component) and R13 should be shorted.
Next up is the on/off switch and the terminals that will hold the Geiger tube.
We then move on to the piezo speaker (be careful, it is polarized!), the pin headers for the display and the ethernet board and the power input jack. Regarding the ethernet board, you will need to take care to mount it properly on the first try because it will be soldered in place. You are supposed to mount it in such a height and angle so that it is perpendicular to the main board:

uRAD_KIT1_06

You can power the board with the supplied power supply or any 5VDC power supply. The power switch turns on when it is toggled towards the Geiger tube:

uRAD_KIT1_07

The Atmega328 that comes in the kit is already pre-programmed with a unique identifier for your unit so all you have to do is connect the kit to your router with an ethernet cable and it should get an IP from your DHCP server. Once that is done, it will automatically appear on uradmonitor.com:

uRAD_KIT1_08

Here is my unit powering up:

uRADMonitor may have begun with measuring radiation levels but it is evolving into a more diverse platform, measuring several other pollution factors. I’ll be happy to incorporate more sensors into my KIT1 in due time.

Dimdim vs. The Ball Screw

I know what you’re thinking. What the heck is a ball screw and what am I doing with one.

This is a ball screw, complete with ball nut and supports:

ball_screw_1

What a ball screw does is convert rotational motion (like from a motor) to linear motion (movement, like front-to-back). Looking at the picture above it is pretty simple to see how that works.

The ball nut contains a number of ball bearings that are used to minimize friction and pretty much eliminate “backlash” (slop).

The screw rotates, but the nut is bolted on to some other surface so it can not turn. Instead it “travels” along the length of the ball screw.

I know that so far I haven’t really given you much useful info, at least nothing that you can’t find on Wikipedia, but bear with me.

Ball screws can get very expensive, if you buy them from the local market, so I opted for a Chinese one off of Ebay. The upside is the cost – the downside is the varying build quality. This particular ball screw had one issue: One of its ends was a very tight fit into the support’s bearing and when I say very tight I mean that I actually had to hammer it in. I know, not the best thing to do to a precision mechanical part, but that is what I had to do. Problem is, the next day I realized that I had forgotten to put in my nut housing. As Murphy would dictate, to put it in I would have to disassemble the tight side of the support. After some swearing and kicking of things, I began to examine my options. I could hammer the ball screw out of its support but I didn’t feel like putting the bearings through yet another ordeal. My other option was to unscrew the ball nut, put in the nut housing and then screw the ball nut back on. Sounds simple, right? Wrong! The problem is the bearings inside the ball nut. These bearings have no support. There is nothing keeping them from dropping out of the ball nut once I have taken it off the ball screw. Knowing that, I looked for a way to put the thing back together properly. Sure enough, I came across this video:

Everything shown on this video is spot-on. You should definitely count your balls and split them into groups of equal number of balls. Getting the first set of balls in is pretty easy. The problems start once you have completed the first set. Now you have a somewhat functioning ball nut. It will rotate with one set of balls, but you need to put in the other sets too.

2016-03-23 19.33.39

When you try putting in the second set of balls, you will realize that you can not. The machined end of the ball screw is blocking the way. You need another strategy.

I looked far and wide for a solution (ok, I Googled it for like 10 minutes). What you need is a tube that has the proper outside diameter to keep the balls supported inside the ball nut, but also has a proper inside diameter to allow the ball screw’s end to go through it so that it can enter the ball nut.

Some people went as far as machining new parts to aid in this procedure. I did not have that luxury, so I looked around the house for a proper tube. I came close with an old flashlight, but its diameter proved to be slightly too big. By that time I was beginning to regret ever having unscrewed the ball nut, but then it hit me: All I had to do is wrap some paper a few times around the shaft and use some tape to make a custom tube.

ball_screw_2

I then inserted my tube into the ball nut and proceeded to feed the balls. I did the first set, then the second, and then the third. I had to be careful since the tube was flexing a bit. Still, I got it right on the first try.

2016-03-23 22.30.50

Then I took the ball screw and inserted it into the ball nut with my tube still in it. I began screwing in the ball nut, until the tube came out the other side.

2016-03-23 22.31.53

That was it! My ball screw was as good as new!

So, to summarize, if you have to take a ball nut off a ball screw, prepare yourself for some tedious work putting it back on. Do make a paper tubing. Learn from my experience.

Fixing startup issues with Arduino DUEs

If you’ve had a lot of Arduino DUEs go through your hands (or if you are just unlucky), chances are you’ve come across at least one that does not start-up properly.

The symptom is simple: you power up the Arduino but it doesn’t appear to “boot”. Your code simply doesn’t start running.

You might have noticed that resetting the board (by pressing the reset button) causes the board to start-up normally.

I had come across such a board a while back, and had thought to myself “cheap generic, probably faulty” and had just put it aside. At ~13€ it was no big loss.

A few days ago a fellow tinkerer (thank you Alex!) alerted me to a fix for this problem.

It appears that the problem was first spotted on Freetronics’ forum and was dealt with swiftly.

The problem occurs only on some DUE boards and is due to some undocumented behaviour of the ATSAM3X8E processor combined with the behaviour of some MOSFETS installed on the DUE boards. So its occurence is largely a matter of luck.

The fix is simple: you just solder a 10K resistor across the top of this mosfet:

DUE-Fix-culprit

This is a 10K 0805 resistor that is about to be soldered:

DUE-Fix-1

..and after soldering:

DUE-Fix-2

The discovery of the problem prompted a new revision of the reference design by the Arduino team.

This is what the Rev 2’s relevant part of the schematic looks like:

Arduino_DUE_Rev.2_sch

and the PCB:

Arduino_DUE_Rev.2

And this is what Rev 3 looks like:

Arduino_DUE_Rev.3_sch

Arduino_DUE_Rev.3

You will notice a new component, R99, plus the mosfet is now mounted vertically.

So, if you are shopping for a DUE, look for one with this mosfet mounted vertically, just to be on the safe side.

Universal Signal Isolator Shield: Rev. 1.2

Since there has been a lot of interest in my Isolator shield these past few months, I have been optimizing its design.

The result of this optimization is this PCB:
Rev.-1.2-pic
It’s called “the Rev. 1.2”.

Nothing major has changed. The pinouts are still the same, the major components are the same, the functionality is essentially the same.

The changes are as follows:

  • New SPI header. It just passes through the SPI signals, nothing more. It does not connect to anything on the board.
  • New SPI_CS header. Useful only if / when connecting SPI peripherals.
  • Reset button. Because you never know..
  • New circuitry for the POWER_RELAY header. It now uses a MOSFET and it includes a diode for the reverse current coming back from the relay’s coil.
  • Decoupling cap for the IR receiver. Not absolutely necessary, but good to have.
  • More decoupling for the DC_UNR input.
  • Ground planes. Lower Arduino noise, at least in theory.

Here is the updated parts placement:
USI-parts-placement-rev1.2

And this is the updated BoM:

[table “” not found /]

Soon I will update the shield’s page with the new info.