Singing Arduino Sketch

Singing Arduino Sketch

 

 

Singing Arduino Sketch?

Singing Arduino. Remember the scene in 2001 where the Hal 9000 sings Daisybell? Well now you can get a tiny microcontroller singing that famous song.

The Google group Cantarino has come up with Arduino code, listed below for your convenience, that allows the Arduino to SING. Its quality is crude, but alas, your little Arduino, the microcontroller that could, now can sing the song Daisy, or more correctly called "Daisybell."

The folks at Cantarino are using a "formant synthesis system" for creating bits and chunks of synthesized speech, while it is much worse than any computer speech you have ever heard, it WORKS!

According to hackaday.com, "The project facilitates the use of phonemes from the SAM Apple II synthesizer to build wave forms that make up recognizable speech on the Arduino platform."

Singing Arduino? Cantarino!

According to Canterino, "An interrupt on the PWM output timer calls a sample generator. This uses a synthesis similar to FOF or granule synthesis - using two sines and a square wave of adjustable pitch and amplitude, synced and enveloped by a pitch of selectable frequency. Phase modulation is added to the pitch, to allow unvoiced phonemes to be uttered."

Now what that actually mean, I don't have a clue, still it works and I can't complain about that. I suppose with a little bit of work you could code your own songs--perhaps Lady Gaga's latest.

And perhaps with a little more work, text to speech (TTS). But with all the talking shields out there, why would one bother. Still, it's so COOL to hear that kind of monotone robotic speech coming from an Arduino, a SINGING Arduino.

The Arduino, the singing arduino, never ceases to amaze me.

--Thomas

Phonemes Available for the Singing Arduino

IY f ee t
IH p i n
EH b e g
AE S a m
AA p o t
AH t a lk
AO c o ne
UH b oo k
UX l oo t
ER b i rd
AX g a llon
IX d i git
EY m a de (dipthong start)
AY h igh (dipthong start)
OY b oy (dipthong start)
AW h ow (dipthong start)
OW sl ow (dipthong start)
UW cr ew (dipthong start)
YX h igh (dipthong end)
WX h ow (dipthong end)
RX R after vowel
LX L after vowel
X H before consonant
DX flap
R r ed
L a ll ow
W a w ay
WH wh ale
Y y ou
M m usic
N ma n
NX so ng
B b ad
D d og
G g uardian
J j u dg e
Z z oo
ZH plea s ure
V se v en
DH th en
S S unday
SH fi sh
F f ish
TH th in
P p oke
T t inke
K ca k e
CH spee ch
H a h ead
Q glottal stop

Here is the code for the Singing Arduino:

// Cantario Group // Arduino Sings Daisybell // // http://code.google.com/p/tinkerit/wiki/Cantarino //

#include #include #include

uint16_t pitchPhase, form1Phase,form2Phase,form3Phase;
uint16_t pitchPhaseInc,form1PhaseInc,form2PhaseInc,form3PhaseInc;
uint8_t form1Amp,form2Amp,form3Amp;
uint8_t noiseMod=10;

int8_t sinCalc[256] PROGMEM = {
/* This table rolls a lot of functions together for speed. Extracting phase and amplitude from the nybble packed form Sine calculation Exponential amplitude mapping Scaling to appropriate range ROUND( FLOOR(a/16,1) *SIN( 2 * PI() * IF( MOD(a,16), EXP(0.18*MOD(a,16)), 0 ) /16 )*127 ,0) */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,2,3,3,4,5,6,7,8,10,12,14,17,20,24, 0,4,4,5,6,7,9,11,13,15,18,22,26,31,37,45, 0,5,6,7,8,10,12,14,17,20,24,28,34,41,49,58, 0,5,6,7,9,10,12,15,18,21,26,31,37,44,53,63, 0,5,6,7,8,10,12,14,17,20,24,28,34,41,49,58, 0,4,4,5,6,7,9,11,13,15,18,22,26,31,37,45, 0,2,2,3,3,4,5,6,7,8,10,12,14,17,20,24, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,-2,-2,-3,-3,-4,-5,-6,-7,-8,-10,-12,-14,-17,-20,-24, 0,-4,-4,-5,-6,-7,-9,-11,-13,-15,-18,-22,-26,-31,-37,-45, 0,-5,-6,-7,-8,-10,-12,-14,-17,-20,-24,-28,-34,-41,-49,-58, 0,-5,-6,-7,-9,-10,-12,-15,-18,-21,-26,-31,-37,-44,-53,-63, 0,-5,-6,-7,-8,-10,-12,-14,-17,-20,-24,-28,-34,-41,-49,-58, 0,-4,-4,-5,-6,-7,-9,-11,-13,-15,-18,-22,-26,-31,-37,-45, 0,-2,-2,-3,-3,-4,-5,-6,-7,-8,-10,-12,-14,-17,-20,-24 };

int8_t sqrCalc[256] PROGMEM ={ 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,1,2,2,2,3,3,4,5,5,6,8,9,11,13,16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16, 0,-1,-2,-2,-2,-3,-3,-4,-5,-5,-6,-8,-9,-11,-13,-16 };

// Changing these will also requires rewriting audioOn()

#if defined(__AVR_ATmega8__) #define LED_PIN 13 #define LED_PORT PORTB #define LED_BIT 5 // On old ATmega8 boards, output is on pin 11 #define PWM_PIN 11 #define PWM_VALUE OCR2 #define PWM_INTERRUPT TIMER2_OVF_vect #elif defined(__AVR_ATmega1280__) #define LED_PIN 13 #define LED_PORT PORTB #define LED_BIT 7 #define PWM_PIN 3 #define PWM_VALUE OCR3C #define PWM_INTERRUPT TIMER3_OVF_vect #else #define LED_PIN 13 #define LED_PORT PORTB #define LED_BIT 5 // For modern ATmega168 boards, output is on pin 3 #define PWM_PIN 3 #define PWM_VALUE OCR2B #define PWM_INTERRUPT TIMER2_OVF_vect #endif

void audioOn() { #if defined(__AVR_ATmega8__) // ATmega8 has different registers TCCR2 = _BV(WGM20) | _BV(COM21) | _BV(CS20);
TIMSK = _BV(TOIE2);
#elif defined(__AVR_ATmega1280__) TCCR3A = _BV(COM3C1) | _BV(WGM30);
TCCR3B = _BV(CS30);
TIMSK3 = _BV(TOIE3);
#else // Set up PWM to 31.25kHz, phase accurate TCCR2A = _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(CS20);
TIMSK2 = _BV(TOIE2);
#endif }

void setup() { pinMode(PWM_PIN,OUTPUT);
audioOn();
pinMode(LED_PIN,OUTPUT);
}

#define FORMANT_SZ 7

enum { _SP,_DOT,_QM,_COM,_HYP,_IY,_IH,_EH,_AE,_AA, _AH,_AO,_UH,_AX,_IX,_ER,_UX,_OH,_RX,_LX, _WX,_YX,_WH,_R,_L,_W,_Y,_M,_N,_NX, _DX,_Q,_S,_SH,_F,_TH,__H,__X,_Z,_ZH, _V,_DH,_CHa,_CHb,_Ja,_Jb,_Jc,_Jd,_EY,_AY, _OY,_AW,_OW,_UW,_Ba,_Bb,_Bc,_Da,_Db,_Dc, _Ga,_Gb,_Gc,_GXa,_GXb,_GXc,_Pa,_Pb,_Pc,_Ta, _Tb,_Tc,_Ka,_Kb,_Kc,_KXa,_KXb,_KXc };

uint8_t formantTable[] PROGMEM = { 0x0, 0x0, 0x0,0x0,0x0,0x0,0x0,/*00 space*/ 0x13,0x43,0x5b,0x0,0x0,0x0,0x0,/*01 .*/ 0x13,0x43,0x5b,0x0,0x0,0x0,0x0,/*02 ?*/ 0x13,0x43,0x5b,0x0,0x0,0x0,0x0,/*03 ,*/ 0x13,0x43,0x5b,0x0,0x0,0x0,0x0,/*04 -*/ 0xa,0x54,0x6e,0xd,0xa,0x8,0x0,/*05 IY*/ 0xe,0x49,0x5d,0xd,0x8,0x7,0x0,/*06 IH*/ 0x13,0x43,0x5b,0xe,0xd,0x8,0x0,/*07 EH*/ 0x18,0x3f,0x58,0xf,0xe,0x8,0x0,/*08 AE*/ 0x1b,0x28,0x59,0xf,0xd,0x1,0x0,/*09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,0x0,0x0,0x0,/*62 Gc*/ 0x6,0x54,0x5e,0x1,0x0,0x0,0x0,/*63 GXa*/ 0x6,0x54,0x5e,0x4,0x1,0x0,0xf,/*64 GXb*/ 0x6,0x54,0x5e,0x0,0x0,0x0,0x0,/*65 GXc*/ 0x6,0x1a,0x51,0x0,0x0,0x0,0x0,/*66 Pa*/ 0x6,0x1a,0x51,0x0,0x0,0x0,0x0,/*67 Pb*/ 0x6,0x1a,0x51,0x0,0x0,0x0,0x0,/*68 Pc*/ 0x6,0x42,0x79,0x0,0x0,0x0,0x0,/*69 Ta*/ 0x6,0x42,0x79,0x0,0x0,0x0,0x0,/*70 Tb*/ 0x6,0x42,0x79,0x0,0x0,0x0,0x0,/*71 Tc*/ 0x6,0x6d,0x65,0x0,0x0,0x0,0x0,/*72 Ka*/ 0xa,0x56,0x65,0xc,0xa,0x7,0x0,/*73 Kb*/ 0xa,0x6d,0x70,0x0,0x0,0x0,0x0,/*74 Kc*/ 0x6,0x54,0x5e,0x0,0x0,0x0,0x0,/*75 KXa*/ 0x6,0x54,0x5e,0x0,0xa,0x5,0x0,/*76 KXb*/ 0x6,0x54,0x5e,0x0,0x0,0x0,0x0 /*77 KXc*/ };

uint16_t pitchTable[64] = { // Covers A1 to C7 58,61,65,69,73,77,82,86,92,97, 103,109,115,122,129,137,145,154,163,173, 183,194,206,218,231,244,259,274,291,308, 326,346,366,388,411,435,461,489,518,549, 581,616,652,691,732,776,822,871,923,978, 1036,1097,1163,1232,1305,1383,1465,1552,1644,1742, 1845,1955,2071,2195 };

uint8_t frameList[] PROGMEM = { #if 1 _Da,3,0,39,_Db,1,0,39,_Dc,1,3,39,_EY,8,6,39,_YX,20,3,39, // Dai.. _Z,10,0,36,_IY,35,3,36, // ..sy _Da,3,0,32,_Db,1,0,32,_Dc,1,3,32,_EY,8,6,32,_YX,20,3,32, // Dai.. _Z,10,0,27,_IY,35,3,27, // ..sy _Ga,2,0,29,_Gb,2,0,29,_Gc,2,0,29,_IH,10,3,29,_V,5,0,29, // Give _M,2,0,31,_IY,10,3,31, // me _YX,5,0,32,_AO,10,0,32,_RX,5,0,32, // your _AH,25,0,29,_NX,5,0,29, // an.. _S,2,0,32,_ER,10,0,32,_RX,3,0,32, // ..swer _Da,3,0,27,_Db,1,0,27,_Dc,1,3,27,_UX,80,3,27,_WX,5,0,27, // do _AY,5,20,34,_YX,10,0,34,_M,8,0,34, // I'm __H,5,0,39,_AX,30,0,39,_F,10,0,39, // half _Ka,3,0,36,_Kb,3,0,36,_Kc,4,0,36,_R,5,0,36,_EY,30,0,36, // cra.. _Z,5,0,32,_IY,40,0,32, // ..zy _AO,10,0,29,_LX,5,0,29, // all _F,5,0,31,_AO,10,0,31, // for _DH,5,0,32,_AH,10,0,32, // the _L,5,0,34,_AH,20,0,34,_V,5,0,34,// love _AA,10,0,36,_V,5,0,36,// of _Y,10,0,34,_UX,80,0,34, // you _IH,10,0,36,_Ta,2,0,36,_Tb,1,0,36,_Tc,2,0,36,// It _W,2,0,37,_OH,10,0,37,_N,1,0,37,_Ta,1,0,37,_Tb,1,0,37,_Tc,1,0,37,// won't _Ba,2,0,36,_Bb,1,0,36,_Bc,2,0,36,_IY,10,0,36,// be _AH,15,0,34,// a _S,2,0,39,_Ta,2,0,39,_Tb,2,0,39,_Tc,2,0,39,_AY,1,10,39,_YX,10,0,39,// sty.. _L,3,0,36,_IH,10,0,36,_SH,2,0,36,// ..lish _M,5,0,34,_AE,10,0,34,// ma.. _R,5,0,32,_IH,60,0,32,_Ja,2,0,32,_Jb,2,0,32,_Jc,2,0,32,// ..rriage _AY,5,10,34,_YX,5,0,34,// I _Ka,2,0,36,_Kb,2,0,36,_Kc,2,0,36,_AH,20,0,36,_N,2,0,36,_Ta,2,0,36,_Tb,2,0,26,_Tc,2,0,36,// can't _AX,15,0,32,// a.. _F,5,0,29,_AO,20,0,29,_R,2,0,29,_Da,1,0,29,_Db,1,0,29,_Dc,1,0,29,// ..fford _AX,15,0,32,// a _Ka,1,0,29,_Kb,1,0,29,_Kc,1,0,29,_AE,12,0,29,// ca.. _R,5,0,27,_IH,45,0,27,_Ja,2,0,27,_Jb,2,0,27,_Jc,2,0,27,// ..rriage _Ba,1,0,27,_Bb,1,0,27,_Bc,1,0,27,_AH,10,0,27,_Ta,1,0,27,_Tb,1,0,27,_Tc,1,0,27,// but _Y,5,0,32,_UH,10,10,32,_L,5,0,32,// you'll _L,3,0,36,_UH,10,0,36,_Ka,1,0,36,_Kb,1,0,36,_Kc,1,0,36,// look _S,2,0,34,_W,2,0,34,_IY,20,0,34,_Ta,2,0,34,_Tb,2,0,34,_Tc,2,0,34,// sweet _AX,15,0,27,// a.. _Ka,2,0,32,_Kb,2,0,32,_Kc,2,0,32,_R,2,0,32,_AA,20,0,32,_S,5,0,32,// ..cross _DH,5,0,36,_AH,10,0,36,// the _S,2,0,34,_IY,10,0,34,_Ta,2,0,34,_Tb,2,0,34,_Tc,2,0,34,// seat _AA,10,0,36,_V,5,0,36,// of _AE,15,0,37,// a _Ba,2,0,39,_Bb,2,0,39,_Bc,2,0,39,_AY,5,5,39,_YX,5,0,39,// bi.. _S,5,0,36,_IH,10,0,36,// ..cy.. _Ka,2,0,32,_Kb,2,0,32,_Kc,2,0,32,_L,9,0,32,// ..cle _M,2,0,34,_EY,5,10,34,_YX,10,0,34,_Da,2,0,34,_Db,2,0,34,_Dc,2,0,34,// made _F,5,0,27,_OY,1,5,27,_RX,5,0,27,// for _Ta,2,0,32,_Tb,2,0,32,_Tc,2,0,32,_UX,50,0,32,// two #endif _Ta,0,0,61 };

int frameTime = 15;
// ms uint16_t basePitch;
int formantScale;

void loop() { formantScale = 54;
//random(20,80);
//54;
uint8_t *framePos = frameList;
while(1) { int n;
uint8_t startFormant,staticFrames,tweenFrames;
uint16_t startPitch,nextPitch;
uint8_t nextFormant;
int16_t startForm1PhaseInc,startForm2PhaseInc,startForm3PhaseInc;
uint8_t startForm1Amp,startForm2Amp,startForm3Amp;
uint8_t startMod;
uint8_t *formantPos;

// Read next framelist item startFormant = pgm_read_byte(framePos++);
staticFrames = pgm_read_byte(framePos++);

if (!staticFrames) break;
// End of phrase

tweenFrames = pgm_read_byte(framePos++);

startPitch = pitchTable[pgm_read_byte(framePos++)];
nextFormant = pgm_read_byte(framePos);
nextPitch = pitchTable[pgm_read_byte(framePos+3)];
pitchPhaseInc = startPitch;
formantPos = formantTable + startFormant * FORMANT_SZ;
form1PhaseInc = startForm1PhaseInc = pgm_read_byte(formantPos++)*formantScale;
form2PhaseInc = startForm2PhaseInc = pgm_read_byte(formantPos++)*formantScale;
form3PhaseInc = startForm3PhaseInc = pgm_read_byte(formantPos++)*formantScale;
form1Amp = startForm1Amp = pgm_read_byte(formantPos++);
form2Amp = startForm2Amp = pgm_read_byte(formantPos++);
form3Amp = startForm3Amp = pgm_read_byte(formantPos++);
noiseMod = startMod = pgm_read_byte(formantPos++);

for (;
staticFrames--;
) delay(frameTime);
if (tweenFrames) { uint8_t* formantPos;
int16_t deltaForm1PhaseInc,deltaForm2PhaseInc,deltaForm3PhaseInc;
int8_t deltaForm1Amp,deltaForm2Amp,deltaForm3Amp;
int8_t deltaMod;
uint8_t nextMod;
int16_t deltaPitch;
tweenFrames--;
formantPos = formantTable + nextFormant * FORMANT_SZ;
deltaForm1PhaseInc = pgm_read_byte(formantPos++)*formantScale - startForm1PhaseInc;
deltaForm2PhaseInc = pgm_read_byte(formantPos++)*formantScale - startForm2PhaseInc;
deltaForm3PhaseInc = pgm_read_byte(formantPos++)*formantScale - startForm3PhaseInc;
deltaForm1Amp = pgm_read_byte(formantPos++) - startForm1Amp;
deltaForm2Amp = pgm_read_byte(formantPos++) - startForm2Amp;
deltaForm3Amp = pgm_read_byte(formantPos++) - startForm3Amp;
deltaMod = pgm_read_byte(formantPos++) - startMod;
deltaPitch = nextPitch - startPitch;
deltaMod = nextMod - startMod;
for (int i=1;
i<=tweenFrames;
i++) { form1PhaseInc = startForm1PhaseInc + (i*deltaForm1PhaseInc)/tweenFrames;
form2PhaseInc = startForm2PhaseInc + (i*deltaForm2PhaseInc)/tweenFrames;
form3PhaseInc = startForm3PhaseInc + (i*deltaForm3PhaseInc)/tweenFrames;
form1Amp = startForm1Amp + (i*deltaForm1Amp)/tweenFrames;
form2Amp = startForm2Amp + (i*deltaForm2Amp)/tweenFrames;
form3Amp = startForm3Amp + (i*deltaForm3Amp)/tweenFrames;
pitchPhaseInc = startPitch + (i*deltaPitch)/tweenFrames;
noiseMod = startMod + (i*deltaMod)/tweenFrames;
delay(frameTime);
} } } delay(300);
}

SIGNAL(PWM_INTERRUPT) {

int8_t value;
static int8_t noise;
int16_t phaseNoise = noise * noiseMod;
noise += noise<<2;
noise++;
// noise' = 5*noise+1 form1Phase += form1PhaseInc;
value = pgm_read_byte(sinCalc+(((form1Phase>>8) & 0xf0) | form1Amp));
form2Phase += form2PhaseInc;
value += pgm_read_byte(sinCalc+(((form2Phase>>8) & 0xf0) | form2Amp));
form3Phase += form3PhaseInc;
value += pgm_read_byte(sqrCalc+(((form3Phase>>8) & 0xf0) | form3Amp));

value = (value * (0xff^(pitchPhase>>8)))>>8;
pitchPhase += pitchPhaseInc;
if ((pitchPhase+phaseNoise) < pitchPhaseInc) { form1Phase = 0;
form2Phase = 0;
form3Phase = 0;
} PWM_VALUE = value + 0x80;
}

 

// Now there you have a Singing Arduino



New! Comments

Have your say about what you just read! Leave me a comment in the box below.

Recent Articles

  1. Stu the AI Robot

    Jul 23, 16 12:26 AM

    Stu the AI Robot - Debugging

    Read More

  2. Best Game Camera Security Box

    Jul 07, 16 10:47 PM

    Camera stolen again? This is the best Game Camera Security Box on the market. It...

    Read More

  3. Robots and Androids

    Jul 03, 16 12:50 AM

    A site with information on robots and androids including their history, building them, and so much more.

    Read More

Robot-Android-Blog  Read our blog about robots, building robots, and easy robot building.

How to Build a Robot How to Build a Robot takes you through each step required to build a robot.

Build an Arduino Robot Yes you CAN! We get you started.

Robot Comics Robot Comics are HERE! We start off our comics with...

Virtual Steve Jobs Virtual Steve Jobs? Steve Jobs is gone and we missed him so much we re-created his essence in software...

The EZ Robot Review The EZ Robot Review. This article reviews the EZ Robot building system, the robot board and system for beginner's robot building.

Medical Robots Medical robots are now showing their silver faces in hospitals and doctors' offices across the world.

Roomba Repair Quick and Simple Fixes for Your iRobot Roomba vacuum

Roomba Batteries How to extend the life of your Roomba's battery. Buy replacement batteries here.

Robot Cars - Yesterday’s Vision, Today’s Reality Are robot cars 'on track' to becoming the way of the future? What issues are at stake at their current level of development?

Robot Car Safety - The Future of Today’s Vehicles

Robot Car Safety can be identified by two main technological components - lacking in human drivers -a (1) instant reaction time and (2) 360-degree awareness of the road.

Educational Robots Learn robotics with these educational robots..

Robot People Robotic replicas of people - robot people - are starting to pop up here and there. We even visit a company who is today making them to order.

Hacking Elvis - The Alive Elvis Animatronic Robot In these articles we show you how to run your Alive Elvis from a microcontroller such as the Arduino and the Basic Stamp. Hacking Elvis...

Wall-e toy robots from Disney Wall-e toy robots are still popular this year

R2D2 Toy Robot : Interactive-Astromech Droid Here's a review of the high-end R2D2 toy robot, the interactive astromech droid.

Toy Robot Dogs Toy Robot dogs: In the robot pet store, you will find toy robot dogs - robomuts if you will - of all sizes, shapes and prices.

Wowwee Robotics Wowwee Robotics has been building toy robots for years.

Lost in Space Toys : The Robot Lost in Space Toys : There have been scores of toys built resembling the Lost in Space Robot, sometimes call by his model number "B9"...

Tribot Robot The tribot robot is one of the most entertaining toy robots that has come from Wowwee...

Terminator Robots Terminator Robots : The Terminator movies and television show brought robots to...

Artificial Intelligence: Our Brain In That Small Chip Artificial Intelligence was once thought of as an impossible feat. Now, with modern advancements in robotic technology, machines can be made to think like humans.

R2D2 - An Adventurous, Resourceful, and Loyal Robot R2D2 demonstrates several notable characteristics every human can learn from, in spite of the fact that he is, a robot. Read his biography here.

Anybots Vistual Assistant Robots - The Coming of Age in Telepresence Robotics Anybots Virtual Assistant Robots are expected to grow in a few years, or perhaps sooner.

BlueBiped: Propelled by it's Own Weight BlueBiped uses no power source to walk. This robot has set a Guinness World Record, walking nonstop for a distance of 15 km (9.32 miles), the longest distance ever walked by a bipedal robot

EZ-Robot May Be the Easiest Way to Build a Robot EZ-Robot May Be the Easiest Way to Build a Robot. The EZ-Robot is a $235 kit that includes everything you need to transform one of your old toys into a functional robot.

Introducing MorpHex, a Spherical Hexapod Robot Introducing MorpHex, a Spherical Hexapod Robot. Imagine a robot shaped like a ball which transforms into a walking six-legged contraption. That’s a description of MorpHex, created by Kare Halvorsen.

Recovering Kids Monitored by Robots After Surgery Recovering Kids Monitored by Robots After Surgery. A Boston, Mass. hospital introduces a sci-fi worthy caregiver system, where patients can go home and stay monitored by robots after surgery.

iCub the "Baby Robot" - Learns to Crawl Like a Baby Have you heard of the iCub? It is a one-meter high android originally developed by the Europe-based RobotCub Consortium. The iCub strongly resembles

Dongbu Robot HOVIS Kits Allow Users to Build An Android Phone Powered Robot Dongbu Robot HOVIS Kits Allow Users to Build An Android Phone Powered Robot

Search
Robots and Androids

Bing

CLICK HERE

to read about the

ROBOT COLLEGE

Build an Arduino Robot!

Get the ebook.

Only $.99!