zt07elecfreaks 发表于 2018-1-10 18:38:37

如何制作Micro:bit炫酷风火轮

Introduction



In the following, I am going to teach you how to create a cool dazzling colorful two-wheel car with micro:bit. Without complicated algorithm, we only have to make the whole weight center lower than the wheel axle center. Before we start, let's take a look at a video about our car.










Tools & Materials:



2 x Micro:bit Board

1 x 3.7V Battery

2 x 8 RGB Rainbow LED Ring

2 x 360 degree servo(55g)

1 x 8*8 Self-lock Switch

5 x 3*10 Screw

1 x DZ1117 Chip

2 x Servo Wheel

1 x Soldering Iron

1 x Hot Glue Gun



How to Make:



Step 1: Paste the bottom of two servos together.

https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC1.jpg


Step 2:Welding electric cables according to schematic diagram in the below.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC2.jpg


Step 3: Fix LED rings to the rotating shafts of the servos.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC3.jpg


Step 4: Fix battery. ( Battery shall be installed a little bit lower to the bottom of servo. )



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC4.jpg


Step 5: Fix Micro:bit.



First of all, paste an acrylic board to the surface of the servo so that we can stabilize micro:bit board more conveniently. Match the holes on the acrylic board well with holes on micro:bit board.

To install screws easier, we need to fix the acrylic board a little bit higher.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC5.jpg
https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC6.jpg
https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC7.jpg


Step 6: Install two wheels and hide the messy cables to make it looks more pretty.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC8.jpg


Now we have completed all of components installation. To make it run, we need to program for it.





https://www.elecfreaks.com/wp-content/uploads/2017/12/09.jpg


Programming



Click to open Microsoft Makecode, write your code into the edit area. I would like to suggest you to program by yourself first.

Of course, you can see the whole program in the link below. Just click Edit on the top right corner to edit your program,then click Download to store your code into micro:bit.



Code of Car:









Code of Remote Controller:









Code Explain



Code Of Wheel



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC10.png


Set P2 and P1 as control pins for servos. For 360 degree servo, 90 means servo stop rotation, 0 means rotate in clockwise direction with max speed, and 180 means rotate in anti-clockwise direction with max speed. The further it deviates from 90, the faster speed it will have. Move forward or backward, and turn left or right are realized through controlling the rotating direction and speed of two servos.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC11.png


Respond relative movement to the signal received.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC12.png


Set P0 as the control pin of RGB light. There are 16 RGB LED lights in total. Their colors are rainbow color.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC13.png


Make LED colors move in circle.



Code Of Remote Controller



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC14.png


Once vibration detected, remote controller sends number 2.



https://www.elecfreaks.com/wp-content/uploads/2017/12/121317_1040_HowToMakeAC15.png


Press different keys to send relative values.



Operation Method



Press button A, turn left;

Press button B, turn right;

Press button A+B, move forward;

Shake the remote controller, move backward.



Relative Readings:



Make A Cool Micro:bit Hovercraft Together

Micro:bit Experiment 11: Rainbow LED Ring —— Elecfreaks Mirco: bit Starter Kit Course


https://www.elecfreaks.com/11750.html
页: [1]
查看完整版本: 如何制作Micro:bit炫酷风火轮