Categories: 3d printing (14) arcade cabinet (6) arduino (2) backup (4) blogofile (4) dns (8) mailbox alert (62) making (12) projects (116) RAID (4) rants (24) raspberry pi (2) site (26) ultimaker (4)

Don't use the X725 for your Raspberry Pi

2020-09-28 | Permalink

Leaving the previous post up as a warning for future me’s.

Don’t follow it. Do not use the X725.

As it turns out, it can (and will) at some point fry the SD card, leaving you with a bricked NAS. From the looks of it, chances of this are highest when it loses main power, which you’d think would be the main point of a battery-backed UPS system.

It is not a question of whether this will happen, but when. For me it was a few months. Luckily, this was only the SD card; the RAID array and the Pi itself were fine.

Anyway, since being able to have remote and timed startups and shutdowns, I have no converted the system to one with an official PoE-Hat, and a PoE switch that can be controlled remotely. It wakes up every night for backup tasks, and then nicely goes to sleep again.

So far, amazingly, without destroying the SD card :)

Custom RAID NAS with Raspberry Pi

2020-02-28 | Permalink

Edit: WARNING Do not follow the advice in this post. Do not get the X725.

Raspberry Pi with X725 board

Recently, my old NAS system died on me, and I was in the market for something else. The only thing I use it for is backups, so I don’t really need much in terms of fancy NAS features like seamless streaming and a web-interfaces.

One thing that had been annoying me for several years (on several ready-made NAS boxes) though was the software in general: either it was propietary, or it was Linux-based but modified for the NAS hardware. In both cases the manufacturer stopped updating it, and -if at all possible- updating the firmware and OS was a major hassle.

So I was wondering: why not get a bare RAID enclosure, and make a NAS from a Raspberry Pi?

My system would have the following hard requirements:

  • RAID-1 support, with other RAID types as a bonus
  • IPv6 support
  • Accessible through ssh
  • Ability to automatically go to sleep or shut down when not in use (both because of power saving and because RAID enclosures are noisy)

Points 1, 2 andd 3 are easy: Raspbian (and many other operating systems) have decent software RAID support, and of course fully support IPv6.

Point 4 however, was an issue: Not only does the Raspberry Pi not have a real way of shutting down, it also doesn’t support wake-on-lan, which would be the easiest way to power it up again.

But there’s nothing some additional hardware can’t fix.

One way to overcome that would be to power it through a smart power hub, and simply enable/disable power as needed. But there would be a drawback: simply cutting power is dangerous when doing file-system intensive things, such as backups. I wouldn’t want to shut it down halfway through a write operation.

But I found something else: The Suptronics X725 expansion board. This provides 3 things:

  • Option to fully shut down the raspberry pi
  • Wake-on-Lan
  • UPS functionality with a few batteries

That third one is a bonus that makes this a better solution to the smart power outlet option: not only can we have controlled shutdowns, we can also have them when the power is out! Although, the most useful thing for this would be to prevent data write errors in case of a power loss, which in the current setup wouldn’t actually work, since the RAID enclosure has its own power supply (without UPS, atm).

The documentation on the X725 is a bit on the sparse side though; it has several bold-lettered but not-so-clear warnings about how to blow up your hardware. So let’s start with that.

With the board placed on the Pi, there’s three ways to power the board and the Pi. USE ONLY ONE OF THEM.

  • The USB-3 socket on the Pi itself
  • The micro-USB socket on the board
  • The power plug socket on the X725

On thing that makes this a bit scary it that there are 2 micro-usb ports on the board. The usb power socket is the one on the long side (it has the helpful text “2A CHG” next to it.

So what’s the other micro-usb for? It’s for the second network interface. Since the Pi can’t do wake-on-lan, this board adds a network interface that does support it, but it works through usb.

With that, I have a system that is low-powered, well-supported by software, and able to wake up in the middle of the night to perform backups, then go to sleep again.

Raspberry Pi with X725 board on top of RAID enclosure

LED clock

2013-11-28 | Permalink

Another project nearing comple^h^h^h good enough to hang on a wall:

A LED-based clock, with light as hands.

The Clock

It all started out when I found the awesome NeoPixel line of products from Adafruit, one of the more interesting ones being the 60-LED strip.

I picked one up (because you know, because), and the best thing to use it for for now was a clock. I had an ATTiny AVR lying around, and wanted to make something to replace my pretty boring standard clock.

Luckily I had a 3d printer to print a clock case at exactly the right size, so I ‘only’ had to make something to set the time, show it, and if possible, adjust colors etc.

Of course it wasn’t as simple as that. For starters, the led strip didn’t work out of the box. When supplied with some power, it would light up randomly for a fraction of a second, then go dark again. My first guess was that it didn’t get enough power (a full 60 LED with controllers for each led can take a bit of power that may not be supplied fully by a small chip such as an ATTiny), but as it turns out, it simply came with wires soldered on the wrong side of the strip.

Luckily it’s not that hard to resolder with the right connections, so once I had discovered that, lighting up the right LEDs was quite simple. Except for one, the last one on the strip. But 59 out of 60 is good enough for now.

It turned out to be more of a challenge to actually show the time with only one AVR that doesn’t have a very accurate internal oscillator, and worse, one that can easily run out of program stack space and start behaving eratically.

Testing the ATTiny with a rotary encoding button

After some measurements, tweaking, and rewriting, it still doesn’t serve as a clock very well; it runs fine for about 24 hours, but then it goes haywire and needs a reset.

But it does look mighty fine. It can show the time in different colors, and the second hand is completely optional.

Purple hands Yellow hands

Plans for v2 are in the works. Starting with an RTC, and I’m thinking about adding a light sensor to automatically adjust its brightness.

But first I need to figure out where to hide the electronics then. I guess I really do need to figure out how to make custom form PCBs at some point.

Philips Hue rf remote control

2013-10-01 | Permalink

The Philips Hue lights are awesome, but it can get a bit tiresome to start that phone app, probably wait for the wifi to connect, and then select your scenario.

TBH, the app serves pretty wel to configure scenarios, but I am not a really big fan of its interface.

I want buttons! Actual, physical buttons.

I also wanted to do something with RF anyway to see how it works.

Combine those to, and you get a remote for your Hues!

The receiving end it currently still just a breadboard and an Arduino, plugged into a computer running a python control script, but version 1 of the remote is finished.

Remote and Receiver

As you can maybe see, it has 5 buttons, for 5 scenarios (one being ‘off’), and one slider to set the brightness.

Here’s the ’normal’ scenario, and dimmed:

Normal light Dimmed light

And for those emergencies, all lights set to red:

Red light

I may post a larger build report later, with more details (and perhaps some code), but for now I’ll leave you with some keywords; ATTiny84, Cosa libraries, lots of wires (I really need to figure out how to make custom pcbs), and the case was printed on an Ultimaker.

On to v2 ;)

Dodecahedron speaker

2013-07-05 | Permalink

This project has been finished (well, finished-ish, as always) for quite a while now, but I just realized I never got around to writing it up. In fact, I already extended it, but that’s something for a different post.

Way, way before I even had a printer I saw this Instructable. And immediately fell in love with it. It had never left my mind as a want-to-build-at-some point thing, and some time ago I finally got around to doing it.

But of course mine is completely different ;)

For starters, I did not want ‘just’ a speaker, I wanted one that had an integrated amplifier, much like those computer speakers you see everywhere. I wanted it to have a standard jackplug so it could play from most devices, and I wanted it to have physical power and volume buttons.

After doing some (well, hours of) online browsing for parts, I settled on a parts list, with which I shall not bore you, and got to designing the shell parts. As my parts would have different dimensions and properties than the ones used in the Instructable, I had to design everything myself. Which of course is 90% of the fun. Even with the countless failed attempts.

Design of One Facet Design of The entire speaker Design of the Volume Button

(Okay I lie, only some initial designs were made at this point, somewhere along the line I changed them completely but I don’t have screenshots of the earlier attempts. Also the button came after everything was done and built. But hey, what’s a little temporal randomization among friends.)

The parts arrived and it was time to do some serious soldering, first the speaker parts.

Parts and mess

And once that was done, I could test the amplifier and all components.

test setup

(this actually has music coming out of it but that’s a bit hard to capture in an image)

Satisfied that it was working, I could assemble the main dodecahedron part:

Dodecaparts

And then it was time to make the big print, solder everything else together and shout and curse it all into one big shiny package:

dodecaspeakerfinished

It is awesome, if I say so myself, even though I did make a number of mistakes:

  • I ‘forgot’ to ground it (so depending on what is connected, it can have background static)
  • I only included simple speaker parts and forgot to add ones that are suitable for low sound waves, so it’s not really suitable for loud music with a lot of bass (but yes, it can be VERY loud).
  • I did not include a shiny “i’m on” led.
  • The dial has no numbers, so it does not go to 11.

But hey damnit, I have built my own dodecaspeaker!

Das BlinkenSphere

2013-03-30 | Permalink

zo relaxen und watschen das blinkensphere

My latest weekend project was to find a use for an Arduino that (due to some recent electromechanical fail on my part) could only be powered over USB.

After a few false starts, and with a lot of ideas left to implement, the first prototype is ready:

Das BlinkenSphere

Das BlinkenSphere

It’s a little sphere-like object that now sits quietly on my desk and emits a soothing color-of-choice.

By default, it’s blue, because, you know, everything must be blue these days.

Work in progress - the shield

But of course, just having some colored light isn’t any fun, or any use, so it’s controlled by my computer; It has a direct client to set it to any (rgb) color, but the most direct use is the ‘bs_run’ command; any command prepended with ‘bs_run’ will make it orange for the duration of the command, and either red or green when the command finishes (respectively when it succeeds or fails).

Running something

So now I can let those long compilations or test runs do their thing, and no longer have to regularly check if they are done; the light will inform me.

Ohnoes, it failed! Success

Cast your light upon us, for the code is dark and full of errors

I also built in support for light sequences and transitions, but still need to write client control code for that (and find any use for it).

Now I need to find something to compile.

Custom restrictor plates for arcade joysticks

2013-02-19 | Permalink

The joysticks I got for my arcade cabinet (http://www.arcadewinkel.nl/joysticks/balltop-arcadefighter-stick-rood) were fine, but I wasn’t entirely happy with the restrictor plates that came with it. They worked fine in 4-way mode, but the 8-way mode was simply a square and that doesn’t work nicely in most circumstances.

So I was looking around for replacement plates (preferably ones with octagons or maybe even smarter restriction holes), but couldn’t really find any. And then I realized I have an f’in 3d-printer.

So I took out one of the existing plates, measured it, and fired up openscad to create new ones.

Restrictor plates. Original on the left. Custom printed one on the right. Restrictor plate in SCAD.

If you want to build it or see more pictures, you can get it at thingiverse

I’m starting to worry, I may run out of things to tweak on my cabinet soonish. Then what will I do with it.

Arcade cabinet marquee art

2013-02-13 | Permalink

The vinyl for my custom marquee arrived! Thanks to drsticker for helping me choose vinyl type, and of course for the printing service :)

Marquee

So the final cabinet looks a little something like this:

Full cabinet

Building an arcade cabinet

2013-02-06 | Permalink

Over the past few years, the idea had already surfaced a few times, but I never actually got myself to start this little project. But a few days into January, the bug suddenly hit me hard, and I couldn’t resist anymore: I wanted to build my own arcade cabinet.

Every nontrivial endeavour starts out with a little bit of research, and luckily the idea wasn’t exactly original; there are a lot of tips and howtos, as well as some very strong opinions on How It Must Be Done to be found online.

Now one of the tips given most often is not to start from scratch, but to get an existing cabinet an repurpose it to your needs. It is less work, and much cheaper than going at it yourself.

But hey. Where’s the fun in that?

Despite not having any significant woodworking skills (and, now that I’m done, to be honest, apart from some common sense needed to keep your fingers attached, you don’t really need to be that advanced at it for a project like this), I wanted to build my own; partly because it is fun (or at least, that was what I hoped, and I was right), and partly because strangely enough, I don’t really like most cabinet designs. IMO they are often too big and too flashy, especially if they are intended to be placed in a home instead of an actual arcade.

So after some basic research (there are lots of good tips on ArcadeCab, and a couple of initial designs, I went out to the local hardware store, got a bit of wood and some tools I did not have already. And I was off!

I shall not bore you with a step-by-step guide, there are enough of those on the Internet already, but here are a few pictures:

Control Panel with about half of the buttons drilled out Initial cuts for one of the side boards

The whole process took a couple of saturdays (sorry for the noise, neighbours!), and a lot of obsessing over How To Do It, but I’m quite happy with the results:

Almost done! And the initial version is done, with a simplified marquee while the printshop is working on the final version

Some observations and lessons learned:

  • Building Stuff Is Fun.
  • I’d do lots of things completely different if I were to do it again.
  • Routers (of the woodworking, not the packet switching kind) are awesome!
  • Covering a room with plastic to paint big pieces of wood feels pretty awkward if you have just watched two seasons of Dexter.
  • The people at arcadewinkel.nl are great.

Again, I am pretty happy with how it turned out!

Now I only need to find a place to put it.

Home NAS setup with Thecus N5550

2012-08-12 | Permalink

(tl;dr: use latest rdup for backups, and thecus has problems with some drives, even from the compatibility list, if so, try updating firmware).

So I recently saw a reasonably good deal on the Thecus N5550, a 5-bay hot-swappable NAS machine. This seemed as good a time as any to finally clean up my backups and Do Them Right.

So the plan is to see how much the already excellent rdup has progressed (last time I used it was at version 0.5, it is now at 1.1.13, the version from the repositories on my systems was 1.0.5).

Initial setup for the N5550 is quite OK, I setup NTP, NFS access, Samba access, and enabled SSH login to have a lowlevel look at what’s going on inside.

Setting up the RAID array was a breeze; For my first experiment I chose a RAID-5 array of 3 Seagate 3TB disks, totalling in about 5.5TB of space.

I installed rdup on my vps, and on a local always-on machine (a lowpower fanless box acting as a fancy gateway), and initially I mounted the big drive as a samba mount (there were some unidentified problems with nfs4, see below). Read and write speed were not as high as I would have thought, about 1-3 MB/s. But that was a problem for later, and I don’t really need that much speed anyway.

I only needed simple incremental backups, so the rdup-simple script should be fine.

Then the first problem arised; there were a lot of ’no such file or directory’ errors. After retracing the steps rdup-simple takes manually, I found out that sometimes rdup-up missed creating a directory. And then of course when it tries to write files in it it fails. This happens for different directories on every run, so I suspect this is some form of race condition.

I asked around and a friend who uses it says he had never seen this with his version (1.1.11 IIRC).

Time to upgrade.

Ater getting rid of the repository versions, and building a fresh rdup from the latest release (long live apt-get build-dep!), rdup-simple proceeded without a hitch.

I also has a number of media files I wanted to copy, so I simply scp’d them to the mounted share.

And then the real trouble started.

While it was copying one of the video files, scp aborted with an I/O error. I tried to copy again, and this time the failed file worked. But shortly after that, while copying another big file, the thecus started beeping continuously.

Looking at the diagnostics, it reported a failing disk (drive 2). Since I had already run the smart checks on this brand new disk, I didn’t think it was actually dying on me, so I tried to find what was really happening. Good thing I had that SSH access; dmesg showed lots and lots of problems:

Periodic exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen from sata drive
hard resetting link

followed by a number of messages:

device reported invalid CHS sector 0

And of course the RAID was in a degraded mode. Telling it to fix itself started a rebuild. As you may now, RAID rebuilds take a long long time, and after about 10 hours (at 92 percent), disks 1 and 3 dropped with similar errors. Bye bye RAID.

This seems to be a problem with the driver, as similar problems for other systems are all over the web. It is often blamed on bad cabling, but there are no cables in this machine (the sata connections are directly wired on a board, and if that board was bad, I’d expect to see much, much more complaints on the Thecus forum).

Another thing I noticed is that these are 6GB/s disks, and the thecus should handle them fine (they are on the compatibility list), but they are connected at 3.0GB/s, not 6.0.

This might be related.

So, I almost contemplated getting rid of the firmware and trying to install a real OS on the system. But there was one thing else to try first.

The version of the disk firmware was CC4B, and there were some reports with other Thecus machines that depending on the firmware version, some disks of the same model worked and some did not.

I put my disks in another machine and updated firmware to CC4H. Fun!

Steps updating seagate disks:

  • Boot my main Linux machine to windows for Seagate firmware update tool
  • firmware update tool reboots the machine into a mini linux version
  • which updates the disk
  • then reboots the machine (defaulting to main linux)
  • Repeat for other disks

Shoving the disks back into the Thecus, I got a small disappointment; the disks were still negotiated to 3 GB/s. Oh well.

Rebuilt the RAID array (this time as a RAID-1, I care more about redundancy than write speed and size). And this time I found out the nfs problem (or at least a workaround); when mounting with nfs4, the shares got a weird UID, and Invalid Argument if you try to chown something. However, mounting it using nfs3 makes it work.

Using RAID-1 and nfs(3) gave me 10 MB/s write speed and 2 GB/s read speed. Now that is more like it! (Again, don’t care too much about write speed, but 10 MB is a lot better than 1). (EDIT: hmm, that was with a zeroed test file I just created, for normal files it appears to be about 10 MB/s read speed as well).

I have been stresstesting it all day now, and have just started the backups again. No disk I/O errors so far.

So if you get those, before doing anything drastic, check your disk firmware updates.

Happy RAIDing!