Tuesday, 6 November 2018

Micro:bit Express 2.0 'adjustable speed'



This is an incremental improvement to the original Micro:bit Express which went via remote control fwd and back and stop. The next project the Micro:bit controlled Ferris Wheel allowed you to adjust the speed within a small range. This project applies the same logic to the train with a greater range of speed.

You will need all the same kit as in the original blog here is the key info:


  • A video of the updated train in action link
  • Code for the updated remote link
  •  Code for the updated motor controller link 
Enjoy :)

If you like this blog check out all the others here

Monday, 29 October 2018

Micro:bit Controlled Lego Ferris Wheel


Micro:bit Controlled Lego Ferris Wheel 

Here is the basics of what you need to create your own remote controlled Micro:bit Ferris Wheel. You will need:

  • 2 x Micro:bits
  • 1 x Lego Ferris Wheel
  • 1 x 4.5 battery box
  • 1 Kitronic motor controller link 
  • 1 Lego motor

Here are photos of the set up.






Video of action

link

remote code link

motor controller code link

Over :)

If you like this blog check out all the others here

Harry Potter sorting




This code consolidates:

  • Lists
  • Count controlled loops
  • Conditions 
  • IF Then Else 
  • Random and time libraries.
I've used this with year 9 who have just done basics with input, loops, basic conditions etc. This takes their learning a little deeper without killing it.

Here is the link to the code: link

Here is the code:


import random
import time

Students_List = ["Harry","Ron","Dave","Hermione"]

Slytherin_Students = [] # stores s students
Hufflepuff_Students = [] # stores hp students
Ravenclaw_Students = [] # stores rc students
Gryffindor_Students = [] # stores g students

House_Names = ["Gryffindor", "Ravenclaw", "Hufflepuff", "Slytherin"] # list of house names to randomly select.

#create a variable to store current position in student list
Current_Student = 0

while Current_Student < len(Students_List) :
#randomly choose a house for the 1st student
House = random.choice(House_Names)
time.sleep(5)
print("Your house is",House)
#add student to correct house list
if House == "Gryffindor":
Gryffindor_Students.append(Students_List[Current_Student])
print(Gryffindor_Students)#show house population

elif House == "Ravenclaw":
Ravenclaw_Students.append(Students_List[Current_Student])
print(Ravenclaw_Students)#show house population

elif House == "Hufflepuff":
Hufflepuff_Students.append(Students_List[Current_Student])
print(Hufflepuff_Students)#show house population
elif House == "Slytherin":
Slytherin_Students.append(Students_List[Current_Student])
print(Slytherin_Students)

else:
print("You have chosen a house that doesn't currently exist")


#add one to current position in student list
Current_Student = Current_Student + 1



If you like this blog check out all the others here

Python programming resources



Here are a links to any Python resources that do not involve any hardware such as Raspberry Pi or Micro:bit.


Blog 1 Harry Potter sorting
link


If you like this blog check out all the others here

Sunday, 21 October 2018

Lego hacking: RaspPi Ferris Wheel


I bought my daughter a basic Lego Friends Ferris Wheel.

Insert image

I reused the code from Raspberry Express:

link

I have modified the GUI to include new speed range which is more in keeping with the speed a Ferris Wheel should go. Essentially the main speed scale is from 0.1-0.2. Due to the weight issues you have to run the Ferris Wheel at 0.3 speed to pick up enough momentum to get it to turn at all.

I have also cut down the bulky code from the Raspberry Express so that it is less hefty.

here is the code:

link

I will update this blog over the next few days with more detail.

Enjoy!

Chris

Sunday, 29 July 2018

Lego + Code blog 3: The Raspberry Express


Lego + Code blog 3: The Raspberry Express

Here is a demo of 'turtle mode': Link
I have tried to recreate the Micro:bit express but simply swap in Raspberry Pi 3b+ currently. This is not a comprehensive blog just a few notes on how to get yourself started.

Raspberry Pi connected to the Lego Power functions motor:

Closer look at the train:

A few notes:
  • I used a cheap £1 rechargable battery to run the Pi.
  • I used a 4.5 volt battery and motor controller found in the Raspberry Robot kit which you can get here called EduKit 3. Link   
  • Again I have used Python 3 to code the train.
  • To create the remote I have used a GUI library for called GuiZero written by Laura Sachs and contributed by Martin O'Hanlon. Link
  • To connect to the Pi attached to the train and use the remote I have used a free app called RealVNC. Link
  • I think thats the nuts and bolts of it.
  • Here is a screen grab of the really simple remote controller.  
  •  I have managed to code it to use scalable speed both forward and back using GPIO zero. Link which is managed by Ben Nuttall.
  • The turtle option allows you to code a 'coded path' if you look my code below it should be fairly clear.
  • Finally here is the code in its current version: Link
Enjoy :)

If you like this blog check out all the others here

Lego Hacking: Lego + Code



Lego Hacking : Lego + Code

Blog 1: Lights on: Link


Blog 2: The Micro:bit Express V1 : Link

Blog 2a: Edublocks Micro:bit Express V1 version(simple motor control)  link

Blog 2b: Edublocks Micro:bit Express V1.5 Remote controlled link

Blog 3: Micro:bit Express 2.0 'adjustable speed' : Link 

Blog 4: The Raspberry Express : Link  

Blog 5 : Micro:bit controlled Lego Ferris Wheel : Link


Blog 6: Raspberry Pi powered Lego Ferris wheel : Link 

Blog 7: 3D printed Lego Christmas Tree / coded light : Link

Blog 8:Lego RC "car" with Raspberry Pi : Link

Blog 9: Blocks controlling blocks: 'Using Minecraft to control Lego motors' : Link


Blog 10: Raspberry Zero Express Link

Blog 11: Stop frame animation with Lego : Link

Blog 12:  Micro:bit controlled Rollercoaster Link

Blog 13: Micro:bit Express EduBlocks simple Link

Blog 14: Micro:bit Express EduBlocks remote controlled Link

If you like this blog check out all the others here