Posts Tagged ‘Arduino’

This slideshow requires JavaScript.

The idea behind this little experiment (and another one that I have in mind) is to include the physical world into the guitar effects chain: usually these effects simply act to an explicit interaction, the foot movement on a pedal, but why not include the guitar movements? This first experiment, in particular, uses an accelerometer to variate the output of a Wah pedal, depending on the inclination of the neck of the guitar itself.

Collect the informations

The first part of the circuit is all about getting data from the accelerometer and sending them to drive the effect. The accelerometer (a triple-axis model) is connected to a Telosb platform through a small prototipying board; the internal software (TinyOS, of course) samples the three ADCs (one for each axis) by mediating 10 consequent samples, packs the three 2-byte values into a packet and sends them through the radio. This operation is performed about 20 times per second. No radio power management is done here (I don’t really care about batteries to last only a few hours or days).

A second Telosb receives the radio packets. Now, the natural follow-up would be for the Telosb itself to drive a digital pot (through I2C, for example), but from this point of view the MSP430, the Telosb microcontroller, sucks A LOT: it has two multi-purpose hardware ports (called USART), each of them has a UART and a SPI interface, and one of them has also a I2C interface. One SPI is not connected in the board, while the other SPI and the I2C are already used by the radio, in the same port that has one UART (the other UART goes to a FTDI chip that sends data through the USB port). This means that driving the hardware port and communicating with the radio means having to share the resources and manage them so that only one is active at a time. I have to say that I was quite scared by this, first of all because TinyOS is not easy to be used to develop applications, and secondly because I am sending so many packets through the radio that I don’t know if timing was enough to start and stop each interface every time.

Thus, I decided to use an Arduino with an USB Host shield: in this way, the Telosb simply takes the radio packets and routes them to the usual USB serial port; the Arduino receives the data, unpackets the three accelerometer values, uses them in a moving average (to avoid too sudden movements) and puts the current value to a digital pot. In the end, I am using only one of the three axes (the X axis), and discarding the other two.

Colorsound Wah

Schematic view

Schematic view

I decided to use a wah pedal as the best effect to be driven by these movements, and I decided to use this schematic, with a couple of modifications; the interesting thing about this circuit is that an inductor, usually the essential part of a wah, is not needed: it just needs a transistor and several resistors and capacitors. The modifications are the two resistors R4 and R10, and the electrolytic capacitor and the diode on the power line on top (C1 and D1).

There are two different power supplies: 9V are provided by a battery, while the Arduino is powered separately and provides the 5V needed by the digital pot; this is done to avoid introducing noise to the effect, because the Arduino is also powering the Telosb radio.


The first tests have been made with a sketch on Processing showing a 3D box moving according to the accelerometer values; I have published several videos showing all these tests, with Arduino first and with the Telosb later. The final circuit is shown here (for some reasons the video is quite accelerated, I have no idea why but I think it involves the fact that all these videos are without an audio track, and Youtube does something wrong when loading them…), and I have added a brief video showing the result down here. The audio quality is quite low, I have recorded it with a microphone and not with an acquisition device, but for now it will suffice.

Final thoughts

I am not completely satisfied with the final result: trying a guitar effect on a breadboard is quite hard, because any movement of the wires introduces some noise, and it probably also lowers the effect of having capacitors in the circuit. I would try to move the circuit at least on a prototipying board, then lower the sampling timing again, from 50 ms to maybe 25-30 ms and see if the rest of the circuit is able to cope with it; also removing the Arduino and allowing the sink to directly drive the pot would lower the latency, but again the MSP430 makes it quite difficult (and I don’t have radio devices for the Arduinos, like for example the XBee shields). Bluetooth could be a solution to use a single platform (I already have a bluetooth shield for Arduino, and the USB Host supports some dongles). Also the moving average window could be reduced, to allow the effect to act quicker.

I think I will try also using a membrane like these instead of the accelerometer, to link the wah gain to the position of the left hand on the guitar neck (the membrane would be in the back of the neck), thus to the pitch of the music (higher pitch in general means the hand is nearer to the body of the guitar, lower pitch means the hand is farther away)… will see.


Read Full Post »

Finalmente il team di lavoro di Arduino ha rilasciato un aggiornamento del loro IDE: la versione 1.0.1 contiene svariati fix a problemi riscontrati dopo il rilascio della 1.0 qualche mese fa, problemi che nel frattempo mi avevano costretto ad usare la versione Git compilata direttamente da sorgenti (altrimenti la parte Ethernet non funzionava per nulla, almeno nel mio caso; ammetto di non aver ancora verificato che tali problemi ora siano spariti, testerò appena possibile). Altre migliorie riguardano la localizzazione dell’interfaccia, particolare che nomino per secondo per il semplice motivo che a me personalmente non serve (ma sono certo che sia più che utile ad un buon numero di persone).

Un’altra succosa novità riguarda il supporto ad Arduino Leonardo, la nuova board del gruppo (già in vendita nello store): la differenza principale con gli altri modelli (e con l’Uno in particolare) sta nel fatto che ora il microcontrollore integra sia un microcontrollore analogo a quello dell’Uno con in più il chip che funge da interfaccia con il PC (attraverso il cavo USB); questo fa sì che la board appaia di default allo stesso tempo al computer cui è collegata sia come seriale che come coppia mouse + tastiera. Ovviamente, esiste già un set di classi a supporto ed una guida per i primi passi. C’è stato anche un remix di pin, tale per cui gli input analogici sono raddoppiati (alcuni di questi sono condivisi con GPIO e non a sè stanti).

Ammetto di non afferrare appieno le potenzialità di far apparire la board come tastiera e mouse, anche se suppongo quella parte del chip sia riprogrammabile (come era già nell’Uno il circuito corrispondente), se non altro l’unire i due chip in uno unico ha abbassato il prezzo rispetto agli altri di 4 € (+ IVA), quindi alla fin dei conti non è male; non ho in mente un acquisto in questo momento, ma più avanti sicuramente ci farò un pensierino.

Ora non ci resta che attendere l’Arduino Due, che ci era stato promesso in autunno, con microcontrollore a 32 bit: quello sarà sicuramente un acquisto interessante, si vociferava nel forum che sarebbe arrivato in estate, vedremo…

P.S.: ho “in canna” un paio di post hardware, in particolare su Carambola e su altri progettini, appena ho un momento mi ci dedico, promesso!

Read Full Post »

Arduino + Ethernet Shield

Arduino + Ethernet Shield

Some context

So, as I was here today with some residual traces of flu and a cold, I watched a certain (undisclosed) quantity of episodes of TBBT (yeah, yeah, I know, just a couple years later than all the others), and all of a sudden I thought of a very nerdy way of solving a little problem I had here (an idea somewhat similar to this one, at least from a certain point of view).

The problem was the following: I have an Asus Eeebox (one of the first models) that is being used with XBMC as a HTPC, of course without a mouse or a keyboard; I have a little infrared remote for navigating through the menus and stuff. Now, the problem comes when one wants to write something, for example in the search box of the Youtube plugin: neither the smartphone remote controller for XBMC nor the Web page supported those interfaces (at least in pre-11 version of the application), so the only way (besides connecting a keyboard, which I don’t want to use because I don’t want to leave it there hanging around) was to navigate between each key of a virtual keyboard that pops up when going into any search field, using navigation keys or a little surface of the remote control that simulates a mouse. Neither a good solution, would you agree.

A few months back I played with the possibility of changing the firmware of the USB part of the Arduino Uno models, and as I had an Ethernet Shield lying there, along with the Uno already with the resistor in place for placing it in DFU mode, and I had the idea that I could use the Arduino as a remote keyboard… ready for the journey?

The journey

So, the first thing has been to search if someone already modified the LUFA project for allowing an Arduino board to be recognized as a generic keyboard… and (of course) it turned out someone already did it. I downloaded the code from that Web page, installed it and tried the examples: they just work™.

Next move: I put together some code for allowing the Arduino to act as a Web server, showing just a single page with a little form with a text line; each string insterted there is then sent back from the browser to the server, which gets the parameter and sends it through the serial port, using the protocol developed for the keyboard firmware linked above. With this, if the Arduino is connected to a local network and to a computer (through USB), it receives characters from the Web and sends them to the computer as they were typed into a (USB) keyboard. The only difficulty here was that the current binary version of the Arduino IDE seems not to work at all with DHCP, I don’t know for what reason (maybe some voodoo compatibility with my avr compiler), but the git version works just fine (for me, at least).

And, dulcis in fundo: using the Web page was fine, but of course I want to send commands from my Android smartphone, so I wrote some other code packed in a tiny Android application showing basically the same form and directly sending POST requests to the Web server. The entire application does not perform very accurate controls over inputs, it’s a little project in the end and it is supposedly used in a local network (your house’s), where no one should want to crash your Arduino…

Final thoughts

Next week I will get a little enclosure for the Arduino pictured at the beginning of this post; the sketch does not support all possible keybaord symbols, just letters, numbers and a couple of useful punctuation marks, because I think I will just use it for doing searches where I should not need strange things. I also want to add: screw the Eclipse update system, it never works.

As a side note, the Eeebox does not shut down the USB ports when shutted down, so the Arduino remains on and connected even if the computer is not running.

I also took the opportunity to put together some little projects I had on Github in one single repository instead of n repositories: it seems to make more sense.

Read Full Post »

Wave Shield

Wave Shield

Come prima parte di un progettino “da ufficio”, ho passato la serata a saldare il Wave Shield di Adafruit, ed ho testato il tutto con il brano “Europa” di Santana, codificato a 16 bit e 22050 Hz mono (quindi un po’ distorto sugli acuti rispetto all’originale).

Qui sotto, il video con tale test: verso 0:30 si può sentire in lontananza la canzone di cui sopra, col volume piuttosto basso dato che veniva riprodotta tramite auricolari.

Read Full Post »

SooperLooper è un simpatico programmino per Linux, compatibile con Jack, che permette di registrare loop e riprodurli istantaneamente; è piuttosto utile quando volete suonare qualcosa ad esempio con una chitarra, ma ha ovviamente il difetto di aver bisogno di un supporto hardware con cui attivare la registrazione, dato che se state suonando avete probabilmente le mani occupate.

Bè, nulla di più facile: basta avere un pedale “vergine” (come quelli per il sustain delle tastiere), che generalmente ha un’uscita con un jack da 6.3″, da collegare (con un circuito piuttosto semplice, in cui il pedale di fatto funge da interruttore) ad un Arduino. A questo punto, con una decina di righe di codice ed il firmware MIDI, l’Arduino stesso sarà in grado di trasmettere i messaggi CC giusti al looper, che ad ogni pressione del pedale avvierà alternativamente la registrazione di un loop o la sua riproduzione.

Nel video vedete un esempio del circuito e del looper (escludendo un momento di defiance del tutto nella parte centrale, forse dovuto alla poca pressione che si esercita con una mano rispetto ad un piede); non ho una chitarra con me, ma l’insieme nel complesso sta comunque funzionando correttamente.

Read Full Post »

E’ arrivata la strip di LED (3 metri!) da Adafruit, e nel video potete vedere l’esecuzione del programmino di esempio pubblicato tra le istruzioni per l’uso; il circuito è piuttosto semplice, l’unica necessità è avere un alimentatore per Arduino in grado di produrre un’adeguata corrente (quello qui usato può arrivare a 1.5 A). Ora devo solo decidere dove piazzare questi metri di luci in casa…

Read Full Post »

ADK DemoKit

ADK DemoKit

Con l’aggiornamento del mio HTC Wildfire S ad Android 2.3.5, finalmente ho la possibilità di sfruttare le possibilità offerte dall’Open Accessory kit (ADK), ed ho quindi testato subito l’applicazione demo (ridotta) supportata dalle librerie ufficiali per l’USB Host Shield per Arduino. Il sistema completo richiederebbe un Arduino Mega ed il kit ufficiale distribuito da Google, ma è possibile effettuare qualche progetto più “in piccolo” anche con il semplice Arduino Uno e lo shield offerto da SparkFun, con qualche leggero aggiustamento hardware per rendere compatibile il tutto.

Nella foto il risultato del primissimo esperimento: l’applicazione Android riconosce l’accessorio collegato via USB, anche se nessuno degli elementi previsti (LED, pulsanti etc) non sono collegati al momento… è stato un test rapido, l’esplorazione più approfondita verrà più avanti (appena ho un po’ di tempo da dedicarci).

Read Full Post »

« Newer Posts - Older Posts »