A need popped up at work for a data logger for various lab tasks. Quickly looking at the market, I failed to identify a lab tool for data logging (cheap, easy but powerful setup, remote access); something for researchers and scientists. I decided a Raspberry Pi with some input buffering would be ideal for the task. This is my roll your own data logger, put together on Saturday – showing what is possible quickly and potential with more development time.
Following on from adding support to wiringPi for the MCP4725 DAC, I wanted to add driver blocks to Simulink such that one could use them to create graphical models for the Raspberry Pi that could interface with the real-world – a workable alternative to expensive real-time targets.
The Raspberry Pi lacks a DAC but using the I2C bus, one can easily add a device like the 12bit MCP4725. The GPIO library wiringPi provides support for I2C devices, however, getting the MCP4725 working with it isn’t a simple as one might hope. The device is 12bit but the I2C protocol works on bytes (8bits). To send 12bit data, the Microchip designed the message transfer like this:
Simulink Embedded Coder offers an ARM Cortex-M support toolbox, which includes code optimisation for the MCU and QEMU emulation but lacks any S-Block drivers for the device. The lack of drivers limits the Simulink development to merely number crunching. You can create
cevel blocks that execute external C functions but this requires separate source files with a shared header and pre-defined initialisation, leaving the model without full control of the hardware. In this post, I go over the process of creating hardware driver S-Blocks.
The Atmel Studio IDE is a useful tool thanks to the comprehensive debugging support and management of project drivers via the Atmel Software Framework (ASF) – coming from a hardcore Vim advocate. One thing I dislike about IDEs is the fact they hide the make process from the user making it difficult to break a project away from the software. On wishing to develop code on different operating systems (being Visual Studio based, Atmel Studio is limited to Windows), and outside the IDE, I set about creating a Makefile for an Atmel Studio project built around the ASF.
Since setting up an boblight on my RaspBMC, I’ve been wanting a nice gui to manage it; turn it on and off, change colours.
I was going to make a plugin to improve my Python knowledge but decided a web plugin would be more flexible as it would be controllable from any device. Using Chris Oattes’ TV Control page as base, I moulded the PHP to be compatible with the standard RaspBMC setup, which currently uses the
boblight-dispmanx service. The standard XBMC web server doesn’t support PHP and I couldn’t figure a way of getting it to, so my solution requires setup of another lightweight webserver:
sudo apt-get update sudo apt-get install lighttpd sudo apt-get install php5-common php5-cgi php5 sudo lighty-enable-mod fastcgi-php
You’ll get an error as
lighttpd will try to assign to the default web port 80 but
libmicrohttpd will already be running on that. You could disable it but I use for remote control. Instead change the default port to something else, I use 3000:
server.port = 80 to 3000. Then
sudo service lighttpd force-reload
Set the permissions for the server folder:
sudo chown www-data:www-data /var/www sudo chmod 775 /var/www sudo usermod -a -G www-data pi
Now all that is left is to copy my boblight control page to the
wget http://engineer.john-whittington.co.uk/boblight.tar.gz tar -zxvf boblight.tar.gz mv -r boblight /var/www chmod -R 775 /var/www/boblight
Visit http://[your raspbmc ip]:3000/boblight to set any static LED colour, disable the dynamic lights or turn off the lights all together. I plan on adding function to edit the
boblight.conf settings and implementing some more visual effects.
When I first started seeing the Ambilight (Philips’s lighting system that allows the display to bleed out) clones popping up I knew I wanted to create one myself. The open-source system has been fairly well refined to this point, such that it is pretty much plug and play with Raspbmc (XBMC for the Raspberry Pi). ‘nadnerb’ has already created a tutorial for the process, which I followed, so I won’t go into the process here. This post is just to share my results.
My last AirPi post has been popular – and still is – but part of why of like Arch linux is that it is constantly updating so you must be hands on, learning a new part of the OS the hard way!
Since my post a year ago, Shairport has some new features and dependencies, and Arch has moved to the systemd service manager, changing the tutorial process somewhat. In order to update it, I have run through the process with the current build (2013-02-11).
I’ve had a BootCamp partition on my Macbook since it bought it; I waited specifically for the Intel CoreDuo Macbooks. Sometimes I don’t want to restart just to run an app or test something out, so developed this bash script to boot it using Virtual Box.
Why Replace My 2006 MacBook HDD with SSD
My MacBook is the 2006 original; the white Core Duo 32bit. I got it upon starting University and that ended up taking six years. Amazingly, it is still going strong and whilst I want a nice retina MBP, it would be truly frivolous, given how well this one still runs.
Over the years I have given it a number of upgrades: 70GB > 500GB HDD, 512MB > 2GB (max for Core Duo) ram, new battery and a complimentary top deck from Apple (long story). Now I was turning to an SSD.