EV3MP3 – Um MP3 Player em LEGO

Encontrei quase por total acaso um projecto muito interessante: ev3dev.

Trata-se de uma versão de Debian para o LEGO Mindstorms EV3. Não há qualquer alteração ao firmware do EV3 – o bootloader do EV3 arranca a imagem do ev3dev instalada num cartão micro-SD.

Alguras horas depois de começar (a maior parte delas apenas a fazer actualizações de sistema já que o EV3 é cerca de 4x mais lento que um Raspberry Pi e como a versão do chipset USB é apenas 1.1 por a ligação Wi-Fi nunca fará mais que 11 mbps) descobri que o ev3dev se dá muito bem com muito do hardware que utilizo com o Raspberry Pi, nomeadamente:

  • Hub USB
  • ThePiHut Wi-Fi USB card
  • Audio USB card

Com meia duzia de linhas temos um shell script que nos saúda num português macarrónico e toca uma música em formato MP3 após ser premido um touch sensor:

#!/bin/bash

# play deve usar USB sound card
export AUDIODEV=hw:1,0

# saudar utilizador

tput clear > /dev/tty0
figlet -f small "Carregue" > /dev/tty0
figlet -f small "para" > /dev/tty0
figlet -f small "ouvir" > /dev/tty0
figlet -f small "musica" > /dev/tty0

espeak -v pt-pt "olá  queres ouvir uma música?" --stdout | play -t wav -

BOTAO=0
while [ $BOTAO -ne "1" ]; do
  BOTAO=$(cat /sys/class/msensor/sensor0/value0)
done

tput clear > /dev/tty0
figlet -f small "No ar:" > /dev/tty0
figlet -f mini "Highway To Hell" > /dev/tty0
figlet -f small "(AC/DC)" > /dev/tty0

mpg321 -a hw:1,0 HighwayToHell.mp3 -g 20

tput clear > /dev/tty0

Para quem tmabém possa estar interessado, após os updates de sistema a versão do kernel é a 3.14.7:

root@ev3dev:~# uname -a
Linux ev3dev 3.14.7-2-ev3dev-pre1 #2 PREEMPT Tue Jul 15 22:29:55 CDT 2014 armv5tejl GNU/Linux

e o htop diz que estou a usar 25 dos 57 MB de RAM disponíveis além de 7 dos 63 MB de swap.

O processador é reconhecido como um ARM926EJ-S rev 5 (v5l):

root@ev3dev:~# cat /proc/cpuinfo
processor    : 0
model name    : ARM926EJ-S rev 5 (v5l)
Features    : swp half thumb fastmult edsp java
CPU implementer    : 0x41
CPU architecture: 5TEJ
CPU variant    : 0x0
CPU part    : 0x926
CPU revision    : 5

Hardware    : LEGO MINDSTORMS EV3 Programmable Brick
Revision    : 0000
Serial        : 0000000000000000

 

SmartBrick – em breve num LEGO perto de si

A campanha KickStarter atingiu o primeiro objectivo, 7 dias antes da deadline e posso orgulhar-me de ter dado o meu contributo. Espero poder ajudar ainda mais nos próximos meses, vamos a ver.

To everyone who has made this possible,

We want to thank you from the bottom of our hearts for all the help you have given us over the last three weeks. All the support you have given has led this project to success. We know the hard part only begins now, as we have just placed our order for the first shipment of BLE chips 🙂

We want to thank you for the all the work you have put into spreading the news about the project. You are responsible for the wonderful karma that has been with us all along the way!

Dear Friends,  and we think we can call you that by now, we have worked really hard over the last 8 months in building SBrick for you. Now that we have reached our funding goal, our common dream will become a reality,  and you will be there with us to enjoy all the fun that this project will bring!

Thank you again for all your support, and keep on supporting the SBrick!

Estou ansioso por poder testar um bichinho destes com o Raspberry Pi e com o LEGO Mindstorms EV3. Acho que é desta que vou aprender a programar decentemente em Python 😉