Eternity 2

I’ve been writing a solver for the Eternity 2 puzzle. Here’s a sample, when setting the dimensions to 4×4. The puzzle itself is 16×16.

It’s written in Python, which of course is not the optimal language, but performance wasn’t the goal anyway.

The goal, amongst others, was to explore techniques for solving the puzzle, and to get more into Python.

More to come on this…


ET2Mini16

 

ET2_Triangle

The solver now, partially at least, works in a distributed environment, using sockets for communication. Some features that might be handy, if the solver should ever find a solution are missing, but that was never the point of this project anyway. More to come on the distributed solver as well.

I’ve built a small cluster of Raspberry Pi’s for testing:

PiCluster1

Interfacing Raspberry Pi and Microchip MCP3304 SPI ADC

Alright. So a lot of people on blogs and forums have been busy interfacing the MCP 3008 DAC to the Raspberry Pi.

But when I came to need one, RS Components, where i do most almost all of my shopping for components, couldn’t supply one, I had to buy another one.

Still cheap, the MCP3304, but with some minor differences. It can be configured to take both single ended and balanced input, and it has 13 bits (12 unsigned), rather than the 10 positive signed bits the MCP3008 offers.

I used Python as language and adjusted some code i found on this blog: http://jeremyblythe.blogspot.dk/2012/09/raspberry-pi-hardware-spi-analog-inputs.html

The Python code:
SPI_MCP3308.py

#!/usr/bin/python
# -*- coding: utf-8 -*-
# mcp3008_lm35.py - read an LM35 on CH0 of an MCP3008 on a Raspberry Pi
# mostly nicked from
#  http://jeremyblythe.blogspot.ca/2012/09/raspberry-pi-hardware- spi-analog-inp$
# Changed to work w. MCP3308 by Kim H. Rasmussen, June 2013
import spidev
import time

spi = spidev.SpiDev()
spi.open(0, 0)

def readadc(adcnum):

 # read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
 if adcnum > 7 or adcnum < 0:
    return -1

 # Frame format: 0000 1SCC | C000 000 | 000 000
 r = spi.xfer2([((adcnum & 6) >> 1)+12 , (adcnum & 1) << 7, 0])
 adcout = ((r[1] & 15) << 8) + r[2]
 return adcout

while True:

   # Read from ADC channels and convert the bits read into the voltage
   ch1 = (readadc(1) * 3.3) / 4095
   ch2 = (readadc(2) * 3.3) / 4095
   # Divisor changed from 1023 to 4095, due to 4 more bits
   # Print the stuff just read
   print ('Voltages: ', ch1, ' ', ch2)

   time.sleep(1)

Prerequisites:

Install Python development package:

sudo apt-get update && sudo apt-get install python-dev

Enable SPI to be loaded into the kernel on boot:

sudo raspi-config

And enable SPI on boot in The advanced menu <8>.

Install spi-dev via a terminal:

git clone git://github.com/doceme/py-spidev

cd py-spidev/

sudo python setup.py install

Low power two harddrive server at 25 W

A small home multi purpose server or NAS using no more than 25 W.

Prelude:
I’ve been wanting to build myself a little server for months now. Ever since I’ve got rid of my old Pentium 233 MHz server with a singel 60 GiB harddrive.
It’s nice to have a machine running 24/7 so you can grab any data from any client in the house. It simplifies backup and allows for easier exchange of files.
Since I’m a student, the budget packet quite well from time to time, so economy was important. Especially in terrms of ownership. Realizing that electricity is costly these days, I’ve set a hard limit. The server couldn’t use more than 50 W/h.

The components
Intel recently released a new mainboard in the essential series. The Intel D945GSEJT desktop board. The board using the Mini-ITX form factor (170mm x 170 mm) and comes with some interresting specifications:

  • Atom N270 CPU (Single core w. hyperthreading)
  • 945GSE chipset
  • Integrated graphigs (Intel GMA950).
  • Max 2 GiB DDR2-5300 SO-DIMM RAM.
  • 1Gbps onboard ethernet
  • 2x SATA-150
  • 1x PATA
  • 1x Mini PCI-e connector
  • 1x PCI 32 bit (regular PCI v. 2.3)
  • Three onboard USB-plugs and four internal for front panel or rear panel header.
  • 2+2 Audio w. SP/DIF (requires header)
  • 2x RS232, 1x Parallel port

But what’s really interresting about the board is the power requirements. 12 Watts for the board only! Another important feature of the board is that it can be powered from a single 12 V/5A DC power brick. These are usually quite efficient (efficiency > 87%) and thus a perfectly good idea for a home server. No other motherboards that I could easily get a hold on came close to requiring this little power. I know about AMD’s Geode that uses only 5 W, but it’s also weaker in terms of processing power and only embedded HW distributers seems to be offering them, and not cheap! The Intel board however was about 120 USD, which seems fair.

You can find additional information on Intel’s website. I’m just writing why I chose the board.

I’ve also chosen to use two 1.5 TiB Western Digital Green power harddrives in RAID1 (mirror mode). I also do RAID in mirror mode as it provides the best data protection, and at a price of only about 130 USB/each, it’s arguably pretty stupid not to.

I’m also planning to buy a solid state drive (SSD) that goes into the Mini PCI-express connector, but I’m still uncertain if that would work. Google, weirdly enough, provides no answer to if it would work.

Everything is going to be put together in a Aopen A340 chassis, that I’ve also had laying around. The chassis comes with a power supply, but this is a 200 W model and will burn a lot of power into heat if you only draw like 10 % of it’s capacity, so this is eventually going to be removed and replaced by a more efficient 12 V/3.5 – 5 A power brick.

Test and assembly

The mainboard arrived in a brown bulk box, resonably protected. The board comes with two serial ATA cables, a powerplug that attaches on the mainboard and provides power to harddrives etc. when using a 12 Volt supply.

I haven’t actually bought the harddrives for the server yet, but I will in one of the coming days (or weeks). As for now, I’m just using a 300 GiB Maxtor Maxline III I found in my drawer.

Assembly was easy. Rear plate in place, four screws, plug in power, use a monitor/keyboard/mouse from another PC while you’re installing the software. I chose to install Ubuntu Linux from a bootable USB-stick. Linux is free and comes with support for sharing files/printers, well, pretty much everything with Windows clients. I also plan to install a webserver (Apache) and MySQL later.

Measurements

The only real measurement I’ve done so far is to measure the power draw. 12 W for the mainboard with no attached harddrives and about 10-13 W for each harddrive¬† (the Green power uses only about 7 W according to a lot of reviews) using a 12 V/3.5 A power brick from an LCD-screen. I have actually yet to buy one for the server, so I borrowed this one from my secondary workstation monitor.

Conclusion

A complete two disk home server for about 450 USD. Can’t say I’m not satisfied. The assembly took about half an hour while listening to music and being infocused, and the software installation about 10 minutes.

The best thing however, is the power reqirement. I don’t except the server to draw more than 25 Watts fully assembled with two modern disks. Perfect little server for the money.

Images