Noise Crayon – Noise Amplitude to Light Spectrum Converter

Continuing on from my Ambient Noise Level Indicator, I wanted to create an enclosure and make it stand-alone – not requiring a computer to do the processing. I ended up with a little device that converts noise amplitude to the light spectrum: Noise Crayon.

The Ambient Noise Level Indicator used the MCU serial host Processing to perform a FFT and various averaging routines to create an indicator for ambient noise. The idea being that it would change colour when background levels rise above a threshold. Moving to an ATMEGA328, performing this processing – especially the FFT – is asking a little too much of it. There are libraries but I’ve heard of limited successes.

Continue reading Noise Crayon – Noise Amplitude to Light Spectrum Converter

Developing Simulink Device Drivers for ARM Cortex

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.

Continue reading Developing Simulink Device Drivers for ARM Cortex

Building Atmel Studio ASF Project using External Makefile

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.

Continue reading Building Atmel Studio ASF Project using External Makefile

Wooden Bits – Binary Clock

Wooden Bits Gif

I’ve been meaning to make a binary wall clock for a while and to also try out kerf bending with the laser cutter. What put me off creating kerf bends before I found OpenSCAD, was the manual creation of all the lines in the right places. It’s the kind of repetitive, uniform task computers were made to do.

Continue reading Wooden Bits – Binary Clock

Laser Cut Adaptable Wire Dispenser in OpenSCAD

I wanted a wire dispenser that wasn’t fixed in place so I could move it to where I was working. To my surprise, such a thing doesn’t exist (I couldn’t seem to find fixed ones either, other than using a kitchen towel rail). Keen to put my new found love for OpenSCAD to use, I set about making such a thing.

The `projection()` command in *OpenSCAD* allows one to easily create 3d objects that can be exported as 2d .dxf for printing
The projection() command in *OpenSCAD* allows one to easily create 3d objects that can be exported as 2d .dxf for printing

OpenSCAD really suits this type of design requirement; something that is going to need to scale user defined variables (the wire reel in this case). I didn’t want to create a design for 6 wire reels from a specific manufacturer, then find they change their spindle, or I decide I need more reels. It’s particularly hard scaling a laser cut box because of all the teeth/dents that slot it together. With a GUI based CAD program, you’d send hours fiddling around with the spacings/length or trying to create patterns – then still ending up with bits that don’t fit together! This is actually my second project in OpenSCAD that I’d bashed together quickly. I’ve got another more complex project to document too.
Continue reading Laser Cut Adaptable Wire Dispenser in OpenSCAD

Ambient Noise Level Indicator

As part of my work at MACH Acoustics – understanding how internal ambient noise levels affect different environments – I was inspired to create an indicator that shows when noise becomes higher than the base level. Some solutions already exist but they are pricey (because they used calibrated sound level meters), and not very engaging. I wanted something that could sit in a classroom and be a friendly indicator for the teachers and students, bringing the noise back down and perhaps learning something in the process!

The solution is a simple RGB led connected to the PWM outputs of an Arduino and uses Processing with the Minim Library to perform a FFT on the mic input – similar to a couple of other projects.

The operation is best described by the video below and commented code. I’ve added a handy GUI that allows the user to do a number of things:

  • View the mic reading, background sample, instantaneous sample, current colour and sample difference.
  • Change the threshold between colours and benchmark colour.
  • Set continuous sampling, direct LED/mic feedback
  • Resample the background
  • Set the frequency band that is used for the amplitude average – this is useful to demonstrate that it is working and also to ignore low frequency to only show speech for example; screechy children in a classroom!
The control panel when the Java applet is running.
The control panel when the Java applet is running.

Its only a prototype concept at the moment. I’d like to design an enclosure that would suit the particular environment, such as a glowing star or dragon for a classroom.

Continue reading Ambient Noise Level Indicator

MATLAB Finite Difference Time Domain Acoustic Modelling

As part of MACH Acoustics’ open window research, they wanted a FDTD model to visualise sound waves moving through various window opening scenarios. I created a FDTD function, that would create an impulse wave at a specified position then calculate discrete pressure points across a defined grid size and time step. Geometry (boundary conditions) could be loaded loaded into the function using scripts for different objects (opening, top/bottom swing window, baffle, etc), video saved and pressure, mic, time step data saved for repeat plotting (the solver took a few minutes to run so being able to plot existing data saved time). There is no currently no absorption so the sound does not decay, reflecting 100%. For short periods however this does not hinder the visualisation too drastically.

A GUI I created to control the simulation settings.
A GUI I created to control the simulation settings.

The videos below show it in action.

Opening with internal baffle plotted in isometric using surf

Opening with internal baffle plotted in isometric using surf

Boblight Web GUI Control RaspBMC

Boblight GUI Control

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: lighttpd:

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:

Change server.port = 80 to 3000. Then sudo service lighttpd force-reload

Set the permissions for the server folder:

Now all that is left is to copy my boblight control page to the /var/www directory:

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.

AirPi: DIY Airplay Speakers using Shairport and a Raspberry Pi Updated

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).

Continue reading AirPi: DIY Airplay Speakers using Shairport and a Raspberry Pi Updated

Modelling a Double Pendulum in Simulink

One module I took during the final year of my degree was ‘System Modelling and Simulation’. A well taught and great module, one of the tasks was to model a double pendulum.

The approach involved deriving the equations of from the highest order of motion for each mass then working backwards through Simulink blocks to generate each term, which could then be to solve the equation – a bit of a chicken and egg problem! It was a an excellent task as the idea seems a little backwards at first and gave me a fresh approach to problem solving a model.

Below is the method extract from my report as the YouTube demo has generated some interest in the solution.

Continue reading Modelling a Double Pendulum in Simulink