190 | 191 | 192 | 193 |
194 |
195 |
196 | 197 |
198 |

Buy: 

199 |

This kit provides everything you need (apart from a micro:bit and batteries) to make a talking animatronic head. Its eyes move and the head speaks from a MonkMakes Speaker for micro:bit.

200 |

201 |

Instructions

202 |

The kit comes with a 30 page printed color booklet. You can also download an electronic copy here.

203 |

Software

204 |

The programs for this project are a mixture of Makecode blocks and MicroPython. MicroPython is needed for some projects as the speech module is not available as blocks code and its nice to have the robot talk.

205 |

Program 0. Eyes Front

206 |

Click on the image below to open the program ready to flash it onto your micro:bit.

207 |

208 |

 

209 |

Program 1. Crazy Eyes

210 |

Click on the image below to open the program ready to flash it onto your micro:bit.

211 |

212 |

 

213 |

 

214 |

 

215 |

 

216 |

 

217 |

 

218 |

 

219 |

 

220 |

PROGRAM 2. Robot Beeping

221 |

Click on the image below to open the program ready to flash it onto your micro:bit.

222 |

223 |

 

224 |

225 |

Program 3. Talking Head

226 |

Click HERE to open the online Python Editor delete the example text in the editor window and then copy and paste the following code into the editor window.

227 |
from microbit import *
228 | import random, speech
229 | 
230 | sentences = [
231 |     "Hello my name is Mike",
232 |     "What is your name",
233 |     "I am looking at you",
234 |     "Exterminate exterminate exterminate",
235 |     "Number Five is alive",
236 |     "I cant do that Dave",
237 |     "daisee daisee give me your answer do"
238 |     ]
239 | 
240 | lips0 = Image("00000:"
241 |              "00000:"
242 |              "99999:"
243 |              "00000:"
244 |              "00000")
245 |              
246 | lips1 = Image("00000:"
247 |              "00900:"
248 |              "99099:"
249 |              "00900:"
250 |              "00000")
251 |              
252 | lips2 = Image("00000:"
253 |              "09990:"
254 |              "99099:"
255 |              "09990:"
256 |              "00000")
257 |              
258 | lips = [lips0, lips1, lips2]
259 | 
260 | def set_servo_angle(pin, angle):
261 |     duty = 26 + (angle * 51) / 90
262 |     pin.write_analog(duty)
263 |     
264 | def speak(sentence):
265 |     words = sentence.split()
266 |     for i in range(0, len(words)):
267 |         display.show(random.choice(lips))
268 |         speech.say(words[i])
269 |     display.show(lips0)
270 |     
271 | def act():
272 |     angle = random.randint(0, 180)
273 |     set_servo_angle(pin1, angle)
274 |     set_servo_angle(pin2, angle)
275 |     sleep(300)
276 |     speak(random.choice(sentences))
277 |     set_servo_angle(pin1, 90)
278 |     set_servo_angle(pin2, 90)
279 |     sleep(1000)
280 |     
281 | base_z = 0
282 | 
283 | while True:
284 |     new_z = abs(accelerometer.get_z())
285 |     if abs(new_z - base_z) > 20:
286 |         base_z = new_z
287 |         act()
288 |     if random.randint(0, 1000) == 0: # say something 1 time in 1000
289 |         act()
290 |     sleep(100)
291 | 
292 |

With the code in the editor, click on the Download button and then copy the Hex file onto your micro:bit.

293 |

294 |
295 |
296 | 297 | 298 | 299 | 300 |