diff --git a/docs/projects.md b/docs/projects.md index 9bc7300c..9ed7f230 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -66,6 +66,10 @@ Fun games to build with your @boardname@. ```codecard [{ + "name": "Inchworm", + "url":"/projects/inchworm", + "imageUrl":"/static/mb/projects/inchworm.jpg" +}, { "name": "Timing gates", "url":"/projects/timing-gates", "imageUrl":"/static/mb/projects/timing-gates.jpg" diff --git a/docs/projects/inchworm.md b/docs/projects/inchworm.md new file mode 100644 index 00000000..10ff740e --- /dev/null +++ b/docs/projects/inchworm.md @@ -0,0 +1,40 @@ + +# Inchworm + +### @description A inchworm like robot built with the micro:bit + +### ~avatar avatar + +Make a funny inchworm robot! + +### ~ + +https://youtu.be/BiZLjugXMbM + +## Duration + +3 Activities, approx 30-45 min each based on familiarity with the coding concepts + +## Materials + +* Cardboard pieces (recycle!) +* Glue gun or Tape (masking, duct tape, and/or packing tape) +* Scissors that can cut cardboard +* 1 @boardname@, battery holder and 2 AAA batteries +* 3 Crocodile clips +* 1 micro servo 9g SG90 +* 1 paper clip + +![Materials](/static/mb/projects/inchworm/materials.jpg) + +## Activities + +* [Servo](/projects/inchworm/servo) +* [Chassis](/projects/inchworm/chassis) +* [Code](/projects/inchworm/code) + +### ~button /projects/inchworm/servo + +Let's get started! + +### ~ diff --git a/docs/projects/inchworm/chassis.md b/docs/projects/inchworm/chassis.md new file mode 100644 index 00000000..1668ec63 --- /dev/null +++ b/docs/projects/inchworm/chassis.md @@ -0,0 +1,88 @@ +# Chassis +### @description Building the cardboard inchworm + +### ~avatar avatar + +Turn a piece of cardboard into an inchworm! + +### ~ + +## Duration: ~45 minutes + +## Materials + * Cardboard + * Scissors or cutters + * glue gun or tape + * 1 paper clip + +## Step 1: cardboard + +Cutout a cardboard rectangle. You can use the @boardname@ as a ruler to figure out the size. + +![](/static/mb/projects/inchworm/chassis1.jpg) + +## Step 2: center fold + +Fold the cardboard in half over the short edge. + +![](/static/mb/projects/inchworm/chassis2.jpg) + +## Step 3: legs + +Fold each end so they rest flat on the ground. + +![](/static/mb/projects/inchworm/chassis3.jpg) + +## Step 4: front teeth + +Fold each corners on one end of the cardbard. This will be the front of the inchworm which is supposed to grip the ground. + +![](/static/mb/projects/inchworm/chassis4.jpg) + +## Step 5: back teeth + +Using a scissor or a cutter (watch the fingers!), cut out various strips in the other edge. Fold one after the other. + +![](/static/mb/projects/inchworm/chassis5.jpg) + +## Step 6: mounting the board + +Using tape or a glue gun, mount the @boardname@ on one side and the microservo on the cardobard. + +![](/static/mb/projects/inchworm/chassis6.jpg) + +## Step 7: mounting the servo + +Attach the servo on the **edge** of the other cardboard side. + +![](/static/mb/projects/inchworm/chassis7.jpg) + +## Step 8: Cable clean up (optional) + +Use tape to route the cables nicely on the inchworm. + +![](/static/mb/projects/inchworm/chassis8.jpg) + +## Step 9: attaching paper clip to servo + +Unfold a paper clip and attach it to the servo arm. + +![](/static/mb/projects/inchworm/clip2.jpg) + +## Step 10: attaching paper clip to cardboard + +Slide the folder paper clip into the cardboard, and use tape to secure it. +You might need to toy around with the size of the clip so that the servo rotation opens the inchworm sufficiently. + +![](/static/mb/projects/inchworm/clip3.jpg) + + +## Step 11: it's ready! + +Your inchworm is ready! + +![](/static/mb/projects/inchworm/ready.jpg) + +### ~button /projects/inchworm/code +NEXT: Code +### ~ \ No newline at end of file diff --git a/docs/projects/inchworm/code.md b/docs/projects/inchworm/code.md new file mode 100644 index 00000000..fa8d9135 --- /dev/null +++ b/docs/projects/inchworm/code.md @@ -0,0 +1,48 @@ +# Code +### @description code to make the inchworm alive + +### ~avatar avatar + +Add code to make the inchworm move. + +### ~ + +## Duration: ~30 minutes + +## Step 1: walk forever + +In order for the inchworm to move, the @boardname@ needs to command the servo to go between ``0`` and ``180`` degrees +at a certain pace. In the code below, the user pressed button ``A`` to launch the inchworm. + +```blocks +input.onButtonPressed(Button.A, () => { + pins.servoWritePin(AnalogPin.P0, 0) + basic.pause(500) + pins.servoWritePin(AnalogPin.P0, 180) + basic.pause(500) +}); +``` + +### ~ hint + +You may have noticed that the inchworm can be rather slow or simply won't move. Try to improve the design of your legs, teeth +so that the inchworm goes as fast as possible. Trying it on carpet also great helps avoiding skidding. + +### ~ + +## Step 2: radio controlled inchworm + +You will need 2 @boardname@ for this part. By using the radio, we can make the inchworm controlled by another @boardname@. +Download the code below to the @boardname@ on the inchworm and another "controller" @boardname@. Whenere A is pressed, the inchworm will move once. + +```blocks +radio.onDataPacketReceived(({receivedNumber}) => { + pins.servoWritePin(AnalogPin.P0, 0) + basic.pause(500) + pins.servoWritePin(AnalogPin.P0, 180) + basic.pause(500) +}) +input.onButtonPressed(Button.A, () => { + radio.sendNumber(0) +}) +``` \ No newline at end of file diff --git a/docs/projects/inchworm/servo.md b/docs/projects/inchworm/servo.md new file mode 100644 index 00000000..489f3d5e --- /dev/null +++ b/docs/projects/inchworm/servo.md @@ -0,0 +1,130 @@ +# Preparing the servo +### @description Connecting the servo to crocodile clips + +### ~avatar avatar + +Equip the microservo with crocodile clips. + +### ~ + +## Duration: ~30 minutes + +## Materials + * Cutting pliers or wire cutter + * Tape (masking, duct tape, and/or packing tape) + * 3 crocodile clips, yellow, red and black. + * 1 micro servo 9g (SG90) + +## Using a microservo with the @boardname@ + +The @boardname@ provides just enough current to operate the SG90 microservo. +The servo requires 3 connections: GND, 3V and a logic pin. +In this tutorial, we will equip the servo with crocodile clips to make it easier to use. +However, you could also use a shield or female to crocodile clips to acheive the same effect. + +If you are running a class or activity, you should consider preparing all servos before hand. + +### ~ hint + +Kitronik wrote an excellent in-depth guide about using servos with the @boardname@. +Check it out at https://www.kitronik.co.uk/blog/using-bbc-microbit-control-servo/ . + +### ~ + +## Step 1: cutout the connector + +Using the cutting pliers, cut out the dark plastic connector. + +![](/static/mb/projects/inchworm/servo1.jpg) + +## Step 2: strip out cables + +Using the plier or a wire stripper, strip the plastic from the cables. + +![](/static/mb/projects/inchworm/servo2.jpg) + +## Step 3: threading the servo cablers + +Thread the servo cables. + +![](/static/mb/projects/inchworm/servo3.jpg) + +## Step 4: crocobile clip claps + +Cut a crocodile cable in two and strip out the casing. +If possible try to use the same cable colors as the servo! + +![](/static/mb/projects/inchworm/servo4.jpg) + +## Step 5: thread cables together + +Place the cables next to each other + +![](/static/mb/projects/inchworm/servo5.jpg) + +... and thread them together. + +![](/static/mb/projects/inchworm/servo6.jpg) + +### ~ hint + +It is very **important** to ensure that there is a good connection between the 2 cables. +If the connection is weak, the microservo will not receive enough current and it will not work. +If you have access to a soldering iron, we strongly recommend to solver this connection. + +### ~ + +## Step 4: protect the connection + +Protect the connection with electrical or duct tape. + +![](/static/mb/projects/inchworm/servo7.jpg) + +## Step 5: repeat for all cables + +Repeat the same process until all cables are connected. + +![](/static/mb/projects/inchworm/servo8.jpg) + +## Step 6: testing! + +It's time to test that your connection are all proper and that the servo will function **when the @boardname@ is powered by battery**. + +* Connect the microservo to the @boardname@. Black cable on ``GND``, red cable on ``3V`` and remaining cable on ``P0``. + +![](/static/mb/projects/inchworm/circuit1.jpg) + +### ~ hint + +When attaching the crocodile clips to the pins, don't hesitate to grab the side of the board with the jaws. + +![](/static/mb/projects/inchworm/circuit2.jpg) + +### ~ + +* Download the following code to your @boardname@ + +```blocks +let a = 0 +basic.forever(() => { + a = input.acceleration(Dimension.X) + pins.servoWritePin(AnalogPin.P0, pins.map( + a, + -512, + 512, + 0, + 180 + )) +}) +``` + +* When powered by USB, make sure that the servo moves when you tilt the board. +* When powered by batteries **only**, make sure that the servo moves when you tilt the board. + +If your servo seems to sutter and stay stuck at a particular position, it means that it is not receiving enough power. +This is probably due to a weak connection or low battery level. Check each connection and check your batteries. + + +### ~button /projects/inchworm/chassis +NEXT: Chassis +### ~ \ No newline at end of file diff --git a/docs/static/mb/projects/inchworm.jpg b/docs/static/mb/projects/inchworm.jpg new file mode 100644 index 00000000..d984848e Binary files /dev/null and b/docs/static/mb/projects/inchworm.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis1.jpg b/docs/static/mb/projects/inchworm/chassis1.jpg new file mode 100644 index 00000000..9fa7c4e6 Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis1.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis2.jpg b/docs/static/mb/projects/inchworm/chassis2.jpg new file mode 100644 index 00000000..4f588e63 Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis2.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis3.jpg b/docs/static/mb/projects/inchworm/chassis3.jpg new file mode 100644 index 00000000..c6d7ab1d Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis3.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis4.jpg b/docs/static/mb/projects/inchworm/chassis4.jpg new file mode 100644 index 00000000..edd77352 Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis4.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis5.jpg b/docs/static/mb/projects/inchworm/chassis5.jpg new file mode 100644 index 00000000..0e037e8f Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis5.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis6.jpg b/docs/static/mb/projects/inchworm/chassis6.jpg new file mode 100644 index 00000000..5e0f86dd Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis6.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis7.jpg b/docs/static/mb/projects/inchworm/chassis7.jpg new file mode 100644 index 00000000..61f09b1f Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis7.jpg differ diff --git a/docs/static/mb/projects/inchworm/chassis8.jpg b/docs/static/mb/projects/inchworm/chassis8.jpg new file mode 100644 index 00000000..be50c03a Binary files /dev/null and b/docs/static/mb/projects/inchworm/chassis8.jpg differ diff --git a/docs/static/mb/projects/inchworm/circuit1.jpg b/docs/static/mb/projects/inchworm/circuit1.jpg new file mode 100644 index 00000000..6d10d8dc Binary files /dev/null and b/docs/static/mb/projects/inchworm/circuit1.jpg differ diff --git a/docs/static/mb/projects/inchworm/circuit2.jpg b/docs/static/mb/projects/inchworm/circuit2.jpg new file mode 100644 index 00000000..c051c01c Binary files /dev/null and b/docs/static/mb/projects/inchworm/circuit2.jpg differ diff --git a/docs/static/mb/projects/inchworm/clip1.jpg b/docs/static/mb/projects/inchworm/clip1.jpg new file mode 100644 index 00000000..fd3f11c2 Binary files /dev/null and b/docs/static/mb/projects/inchworm/clip1.jpg differ diff --git a/docs/static/mb/projects/inchworm/clip2.jpg b/docs/static/mb/projects/inchworm/clip2.jpg new file mode 100644 index 00000000..f4b14bad Binary files /dev/null and b/docs/static/mb/projects/inchworm/clip2.jpg differ diff --git a/docs/static/mb/projects/inchworm/clip3.jpg b/docs/static/mb/projects/inchworm/clip3.jpg new file mode 100644 index 00000000..978e8e57 Binary files /dev/null and b/docs/static/mb/projects/inchworm/clip3.jpg differ diff --git a/docs/static/mb/projects/inchworm/materials.jpg b/docs/static/mb/projects/inchworm/materials.jpg new file mode 100644 index 00000000..1675c27b Binary files /dev/null and b/docs/static/mb/projects/inchworm/materials.jpg differ diff --git a/docs/static/mb/projects/inchworm/ready.jpg b/docs/static/mb/projects/inchworm/ready.jpg new file mode 100644 index 00000000..2f28f2c0 Binary files /dev/null and b/docs/static/mb/projects/inchworm/ready.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo1.jpg b/docs/static/mb/projects/inchworm/servo1.jpg new file mode 100644 index 00000000..0d101f1b Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo1.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo2.JPG b/docs/static/mb/projects/inchworm/servo2.JPG new file mode 100644 index 00000000..844d3b9e Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo2.JPG differ diff --git a/docs/static/mb/projects/inchworm/servo3.jpg b/docs/static/mb/projects/inchworm/servo3.jpg new file mode 100644 index 00000000..1cfb72fa Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo3.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo4.jpg b/docs/static/mb/projects/inchworm/servo4.jpg new file mode 100644 index 00000000..68d5a41c Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo4.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo5.jpg b/docs/static/mb/projects/inchworm/servo5.jpg new file mode 100644 index 00000000..89f1c177 Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo5.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo6.jpg b/docs/static/mb/projects/inchworm/servo6.jpg new file mode 100644 index 00000000..9e52cb44 Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo6.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo7.jpg b/docs/static/mb/projects/inchworm/servo7.jpg new file mode 100644 index 00000000..9aa13b61 Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo7.jpg differ diff --git a/docs/static/mb/projects/inchworm/servo8.jpg b/docs/static/mb/projects/inchworm/servo8.jpg new file mode 100644 index 00000000..8f53c725 Binary files /dev/null and b/docs/static/mb/projects/inchworm/servo8.jpg differ diff --git a/package.json b/package.json index 7508f710..714121f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-microbit", - "version": "0.7.14", + "version": "0.7.17", "description": "micro:bit target for PXT", "keywords": [ "JavaScript", @@ -34,6 +34,6 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.8.3" + "pxt-core": "0.8.5" } }