GithubHelp home page GithubHelp logo

vast-community-hub / carrillon Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 1.0 269.57 MB

An application to turn a bell tower into a midi instrument with a web application to play songs in it

License: MIT License

Python 6.91% Shell 0.74% CSS 1.05% Smalltalk 91.29%
smalltalk midi vasmalltalk iot vastplatform pigpio raspberry-pi gpio-library

carrillon's Introduction

El Carrillon

Powering the world’s largest MIDI instrument
Explore the docs »

Report a defect | Request feature

There’s a huge yearly event held in Argentina, called Fiesta Nacional de la Flor (National Flower Festival), organized by an NGO. Many years ago, they created hardware to control 18 tuned bells. Each bell is associated with a musical note, from A3 to D5 with all the semitones. “El Carrillón” is the spanish word for “Bell Tower”.

escobar-1

The hardware setup includes a Raspberry Pi Zero, two IO Pi Zero boards and a driver module composed of triacs. The software is developed with VA Smalltalk and some Python, and the goal is to allow playing MIDI songs on the bell tower.

El Carrillón Project History and Overview

Originally, the bell tower code was written in Assembly and there was a chip on the board labeled “Ayer” (Spanish for “Yesterday”) that held a rendition of The Beatles’ song. Unfortunately, this was the only song available for playback. At least the EPROM chip was placed in a socket, so theoretically you could change the song by swapping it.

ayer

A couple years ago, we wanted to improve the bell tower by making it easier to maintain with newer hardware and software, and have the flexibility to easily change the song that was played. So we got to work.

The first step was to examine the original design. It had a PCB controller (Printed Circuit Board) and three power driver boards, each with 8 channels. The boards were connected with 3 flat cables, 10 connectors each.

ayer

The 3 flat ribbon cables that are referenced are rainbow colored.

It was clear that the PIC microprocessor and the EPROM memory module of the original PCB would not be needed when using a Raspberry Pi. In fact, even though the PCB was left inside the enclosure, it wasn’t needed at all except for the GND connections that were reused. If desired, the PCB could be removed completely and new grounds added. Aside from a single Raspberry Pi Zero, two “hacked and stacked” IO Pi Zero boards (each with an MCP23017 GPIO expander) and the pre-existing driver module composed of triacs were all connected together.

labels

Each IO expander gave us 16 GPIOs with a total of 24 channels (18 bells, plus a general pump, and some spares). Two right-angled headers and an extra GND wire were needed also.

Luckily, the power driver board and the flat cables could remain untouched and be reused. The pinout could be easily adapted to the IO Pi Zero boards by just soldering right-angled headers to them. After that, we needed to plug all existing cables into the IO Pi Zero expanders. Once the Pi was connected to all the drivers, the hardware was done. All we needed to do now was the software.

pi

table

There is a MIDI keyboard connected to the setup too, so a user can play live, and also record songs. A USB hub was used to connect the keyboard to the Pi.

table

The Assembly code originally being run by the PIC processor was replaced with a higher-level language (Python) for ease of development. However, it was soon migrated mostly to VA Smalltalk. VA Smalltalk is a software development platform sold by Instantiations Inc. They granted us an open-source license for this non-profit project.

The web application, GPIO wrapping, MIDI interpreter/events, I2C driver for the MCP23017 chip (the IO Pi Zero) are all currently running with VA Smalltalk.

Smalltalk gave the project a pure Object-Oriented platform to run on that’s simple and powerful. We’ve found that VA Smalltalk’s live programming environment works really well for fast, iterative development and makes software updates quick and easy without the need for recompilation like lower level languages would need (Assembly, C / C++). Performance-wise, it more than exceeds the needs of this kind of project.

Now with the new hardware and software, you can play any MIDI file on the Raspberry Pi and the notes of the song will be mapped to the tuned bells. The last step was to add a web interface for controlling, configuring and playing songs, so “anyone” (a non-technical person) could play the songs from their mobile phone.

Tests, TDD and Mocking

We apply TDD (Test Driven Development) when possible and we wrote many unit tests to allow for rapid development/debugging, including basic device mocking to test the MCP23017 driver implementation, as shown in the following example:

testPulseCompleted
	port pulseForMilliseconds:5.
	out reset.
	self
		assert: out next equals: 16r12;
		assert: out next equals: 2;
		assert: out atEnd.
	(Delay forMilliseconds: 7) wait.
	out reset.
	self
		assert: out next equals: 16r12;
		assert: out next equals: 2;
		assert: out next equals: 16r12;
		assert: out next equals: 0;
		assert: out atEnd.

One particular challenge was how to test the project without needing to go to the physical bell tower and test with the real bells. To address this, we’ve built an LED piano “display” on a protoboard that resembles the exact same layout as the Carrillón. Each LED represents a note and each note is mapped to a bell, so we could play MIDI songs at home and see those on the LED piano. We also used FluidSynth (MIDI software synthesizer) to hear the songs while developing.

piano2

piano1

License

  • The code is licensed under MIT.
  • The documentation is licensed under CC BY-SA 4.0.

Installation

See this page for more details about how to setup OS dependencies, the Raspberry Pi, how to load the code, etc.

Blog posts, awards and conferences

carrillon's People

Contributors

emaringolo avatar gerasdf avatar marianopeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

emaringolo

carrillon's Issues

Rename all Gpio to Pigpio

In many places of the RaspberryHardware core refers to the word GPIO instead of Pigpiod. Examples is the classes RaspberryGpioDaemonInterface and RaspberryGpioInterface. In that case the "Gpio" is not really GPIO as the phisical pin (hardware) but the LIBRARY. Therefore, that must be Pigpio.

There are probably other places than these 2 class names where it calls "Gpio" instead of "Pigpiod". We should try to rename as much as we can see.

Better document that we cannot use RaspberryGpioInterface but RaspberryGpioDaemonInterface

We should explain better that in VAST, we can only use RaspberryGpioDaemonInterface so far and that RaspberryGpioInterface crashes the VM. We should put that as class comments or even rename RaspberryGpioInterface to RaspberryGpioInterfaceBROKEN or move it to a separate subclass or something. In addition, we can implement RaspberryGpioInterface class >> raspberryGpioStart doing a self error: 'not supported... use daemon instead....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.