Geek and Sundry

Once again I’ve been remiss with my updates.  I’ve been working on a mini mame cabinet, my car computer died, I’ve been searching for laser engravers and 3d printers, all of which have been proceeding at a snail’s pace.  So I wont talk about any of those projects.



I ordered a bunch of pcbs from to see what the boards look like.  Now I have 20 dice boards, 20 oled boards and 10 arcade input controller boards.  Nice!

I repurposed onc of my dice boards to control a WS2811 LED strip with the intention of making a cool solar powered yard light.  Along the way I went down another rat hole.  I’m completely interrupt driven, I hope I can pop the stack some day.  Anyway. along the way I stumbled on Gitlab, and spent a couple of weekends getting it working on my raspberry pi.  For those of you unfamiliar with it, it is like GitHub Enterprise.  You can use your own servers and have your code in YOUR own cloud.  It works not too badly, if a little slowly. I’ll throw some links in at the end of the post.  So now I have a decent source code control server, no more CVS, SVN, RCS, or just standard git.

RPi Gitlab Server

RPi Gitlab Server

I’ve done tweaks to enable https, so I can open up my router to the external world if I feel like it. Getting the config files set up was a bear, and the PI is SUPER slow.  If you want to do this, use a VM first, and then copy the config files over to your pi, once it is all working.  I mount the gitlab repository from a NAS, although you probably wouldn’t have to, since source code is small, and SD cards are big these days.  I’m toying with the idea of putting the filesystem on a usbkey because I hear those are an order of magnitude faster on the pi.  That doesn’t really make sense to me since SD cards can be interfaced in 4-bit parallel mode. Enough about Gitlab.

So once again I’ve used the arduino environment for my dice board.  I built it up with only the CPU and the reset switch (and the usb jack for power)  I’ve soldered a data line to PB0 for the LEDs (this was one of the through holes on the board) , CdS Addon I also soldered a CDS cell to PC0 (ADC0) with some minor rework to have it act as a voltage divider. Now I have a board that runs leds when it is dark out.  I’ve got a buck regulator that bucks down a car battery form 12 to 5v.  I have a big solar panel that i’ll just hook straight up to the same car battery with a diode to prevent draining the battery at night.

Dice Board Running LEDs

This is lame, but I dont think I’m in any risk of overcharging the battery.   There should be more interesting stuff coming down the pipe soon.

Set up Gitlab on the PI

Set up Gitlab with https

Do you want to see some code that I’m not proud of? No? too bad here it is anyway:

#include <Adafruit_NeoPixel.h>
#define PIN 8 // This is the dice board PB0/ i.e. pin2 on the "audio" header"

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_RGB + NEO_KHZ800);

/* hack the prescaler to be a bit faster */
#define CLOCK_PRESCALER_1   (0x0)
#define CLOCK_PRESCALER_2   (0x1)
#define CLOCK_PRESCALER_4   (0x2)
#define CLOCK_PRESCALER_8   (0x3)
#define CLOCK_PRESCALER_16  (0x4)
#define CLOCK_PRESCALER_32  (0x5)
#define CLOCK_PRESCALER_64  (0x6)
#define CLOCK_PRESCALER_128 (0x7)
#define CLOCK_PRESCALER_256 (0x8)
// Initialize global variable.
static uint8_t __clock_prescaler = (CLKPR & (_BV(CLKPS0) | _BV(CLKPS1) | _BV(CLKPS2) | _BV(CLKPS3)));

inline void setClockPrescaler(uint8_t clockPrescaler) {
  if (clockPrescaler <= CLOCK_PRESCALER_256) {
    // Disable interrupts.
    uint8_t oldSREG = SREG;
    // Enable change.
    CLKPR = _BV(CLKPCE); // write the CLKPCE bit to one and all the other to zero
    // Change clock division.
    CLKPR = clockPrescaler; // write the CLKPS0..3 bits while writing the CLKPE bit to zero
    // Copy for fast access.
    __clock_prescaler = clockPrescaler;
    // Recopy interrupt register.
    SREG = oldSREG;

inline uint8_t getClockPrescaler() {
  return (__clock_prescaler);

void setup() {
  /* go fast */
  strip.begin();; // Initialize all pixels to 'off'
void loop() {
  /* Determine if it is dark enough out to light leds */
  uint16_t k;
  k = analogRead(0);
  if (k>2){
    colorWipe(strip.Color(0, 0, 0), 50); // black

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);;

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);