This is a Math & Automatic expansion board for micro:bit. Easy to use, and suitable for a wide range of applications. We designed this board for two sorts of application: fun math games and automation control. There are following multiple functions integrated on the board:
- 16 touch control keyboards
- 16 RGB LEDs
- 2 Motor Ports
- 1 Vibration Motor
- 1 Buzzer
- 6 IO, 2 I2C, 1 UART Port
- 2 Servo PortS
- 2 Power supply methods, 3.5~5V
We add a acrylic cover at the bottom of the board to make it more durable and delicate, which is also perfect for using in class.
This product supports makecode graphical programming and Mind+ platform.
- Power Supply: 1. PH2.0, 3.5-5V(three 4.5V battery box or 3.7V li-ion battery); 2. External power via USB (3.5-5V)
- Buzzer ×1
- Vibration Motor ×1
- Servo ×2
- Motor ×2
- Touch Key ×16
- RGB LED ×16
- UART ×1
- I2C port ×2
- IO Expansion: P0, P1, P2, P8, P12, P16
- Dimension: 136×65mm/5.35×2.56"
- Programming Platform: Mind+, makecode
Makecode Online Graphical Programming
Makecode Library Address: https://github.com/DFRobot/pxt-Math-Automatic. About how to install a software library?
RGB LED is composed of three basic colors: red, green and blue. There are 16 RGB LEDs integrated on the top-left corner of every touch-key on the board. Connect the RGB LED to p15 of micro:bit.
- Set the brightness of RGB (0~255)
Result: the brightness of the whole LEDs is 138
- Set the LED No. 0 to blue
Result: the LED 0 lights up in blue.
- Set the LED 4 to 8 to yellow.
Result: the LED 4 to 8 light up in yellow.
- Set LED 3 to purple
Result: the LED 3 lights up in purple.
- Light up RGB Matrix Pixel
Result: Light up the LED in form of a matrix in purple. X=1, Y=2. (The original point of the matrix is the upper-left corner.)
- RGB LED show Rainbow
Result: the LED 0 to 15 show rainbow color.
Read Keyboard Value
To let users programme the touchkeys flexibly, we set two modes to read the keyboard: basic mode and math mode.
- Read Keyboard Data (Basic mode)
Basic Mode: in this mode, press a key then you will get the related key value. For instance, press key 2, then you get its value "2". This mode is suitable for password input, game controlling, etc.
Key Value in basic mode:
|Key Label||Value (numerical)|
- Read Key Value (Math mode)
In math mode, the keyboard has the similar function with calculator. For example, when press down key 2, you get a number "2", then press down key 3, you get a number "23". This mode is perfect for math calculation.
We can divide the keyboard into two parts in math mode: numerical key and function key. The former returns numerical value while the latter returns char-type data. Refer to the following chart:
|Key Label||Value (numerical)|
|Key Label||Vlaue (char)|
Example Code in Math mode: calculator
Key Detection Function
- Trigger Event: by reading the returned key value, judge if the returned key value is the same as preset key value, if it is, trigger the event, otherwise, not.
Result: show a "heart" pattern on micro:bit LED matrix when key 3 is touched.
- Query: by reading the returned key value, query if the touched key value is the same as the preset key value, if it is, do the related actions, otherwise, not.
Result: show a "heart" pattern on micro:bit LED matrix when key 2 is touched.
Motor speed range: 0~255
Result: when key 1 is touched, Motor connected with pin M1 rotate at full speed for 1 second.
Result: when key 3 is touched, vibration motor vibrates for 1 second.
Servo rotating range: 0~180 degree
Result: when key 5 is touched, servo S1 rotates 180 degrees and backs to 0 degree 1 second later.
Automation Control Applications
- Colorful Waterfall Light
Result: at first, RGB LEDs of the first row light up in different colors from left to right in turn, when all LEDs turn on, make them go off orderly from the first row. After that, RGB LEDs of the first column light up in various color from top to bottom in turn, and then dies off from bottom to top. LEDs of each column turns on repeatedly in the preset order.
Waterfall Light Code Download: https://makecode.microbit.org/_EXAWj47md5MU
- Touch Music
Result: touch key 1~7, the buzzer makes different sounds; touch the rest to play different music.
Touch Music Code Download: https://makecode.microbit.org/_aEtYReVjt63P
- Countdown Timer
Result: Every RGB LED shows random color in each turn. When all LEDs turns off in one turn, we mark it as 16s. The related time will be displayed on micro:bit LED matrix.
Countdown Timer Example Code Download: https://makecode.microbit.org/_YmzamCJypcYk
- Motor Control System
Result: use touchkey 0~9 to conctrol the speed of M2 motor. When key 0 is touched, motor stops; key 9 touched, motor rotates at full speed. Motor speed range from 0 to 255.
Motor Control System Example Code Download: https://makecode.microbit.org/_9f5F2zVUFX1T
- Remote Wireless Handle
Result: two micro:bit boards will be used in this tutorial. One for touch keypad, one for Maqueen car. Programme the key 2, 4, 6, 8 to control the car to move forward, backward, left, right respectively.
Remote Wireless Handle Example Code Download: https://makecode.microbit.org/_MTwFj1TTvHE3
- Anti-thief Lock
Result: touch Key DFlogo to enter 3-digit passward, if the passward is correct, the micro:bit LED matrix show "√" pattern, the buzzer plays the "correct beep sound", and the servo rotates 180 degrees and backs to 0 degree 1s later. Otherwise, micro:bit displays "×" pattern, the buzzer makes the "error beep sound", and the servo keeps still. Press the DFlogo key to enter passward again. Initial passward: 726.
Anti-thief Lock Example Code Download: https://makecode.microbit.org/_Lmb5vgT8t5yJ
Math Game Apllications
- Lucky Number
Result: shake the expansion board, then one of the 15 RGB LEDs "jump" up and down, and the buzzer makes "jump down sound". At last, the LED will stops at a key. The corresponding key number will be displayed on the micro:bit LED matrix. This is your lucky number. Shake the board again, you can get the another one.
Lucky Number Example Codes Download: https://makecode.microbit.org/_W6vemK5fR48k
- Comparing Number
Result: press down button A on micro:bit, a countdown will appear on micro:bit LED panel, and it shows a random number; Touch the DFlogo key, the RGB LEDs 0~9 "jump" randomly and then generates a random number. Compare the two numbers. If the former one is bigger, micro:bit LED displays a left arrow; if the latter one is bigger, display a right arrow; if equal, display a "heart" pattern.
Random number range: 0~9
Comparing Number Example Code Download: https://makecode.microbit.org/_TWCdYPdF7dU2
- Number Guessing
Result: touch the DFlogo key, and RGB LEDs flash twice, then the game begins. RGB 0~15 shines randomly for 15 times, meanwhile, micro:bit LED panel displays a countdown and buzzer makes sounds. Players guess which number the RGB LED will stop at, and press down that key before the end of countdown. If you guess right, the buzzer plays "correct beep sound" and LED panel displays the right number. The game goes on. Otherwise, the buzzer plays "game over sound" and LED panel shows the right answer. Game over. You have to touch the DFlogo key to restart. The micro:bit LED matrix will display times of guessing right first when you touch the DFlogo key again, then the game starts again.
Number Guessing Example Code Download: https://makecode.microbit.org/_08sMiFbjxA06
- Whack a Mole
Result: touch the DFlogo key, and RGB LEDs flash twice, then the game begins. The RGB LEDs on the keyboard will light up randomly in random color. When the LED turns on, players have to touch the corresponding key within preset time, by which to simulate the process of whack a mole. If users hit the right mole, the viration motor vibrates and the buzzer makes sound effect. Once players missed the moles for 10 times continuously, game over. Every time you hit a mole, you get a point. Your final score will be displayed on the micro:bit LED panel. Touch the DFlogo key again to restart the game.
Whack a Mole Example Code Download: https://makecode.microbit.org/_exeFtvTpgCga
- Blackjack (Twenty-One)
Result: two players battle mode. The micro:bit LED matrix displays "0", which is the intial points of both players. Touch the DFlogo key to deal card, at the same time, the total card points will constantly showed on the micro:bit, the player can press the DFlogo key to ask for more cards if he thinks his points are not high enough. Touch the "=" key to stop dealing cards, and wait for another player to finish. Compare the players' point. The one who get the most point will be the winner and his micro:bit LED panel will display "WIN", the another one gets "LOSE". The micro:bit boards display "=" when both of them get same point. Please note that if the player's point is over 21, he will lose the game. The micro:bit will display "0" when one turn is over.
Point for each card: 0~9
Blackjack Example Code Download: https://makecode.microbit.org/_Wq2c7fhyD3i2
- Math Calculator
Result: use the expansion board as a calculator to do math calculation. Press the key to input the data, and the related RGB will light up, which represents you successfully input the number. The input number will be displayed on the micro:bit LED panel. After the key"=" is pressed, the program will judge which operator you have input first, and then do the math calculation. The result will be circularly displayed on the micro:bit LED matrix for 4 times, waiting for the next calculation.
Math Calculator Example Code Download: https://makecode.microbit.org/_4H0VEYTuo0hA
Calculation Competition: +, -, ×, ÷.
- Addition operation result: generate random A and B within 0~50. Then the micro:bit LED matrix displays A+B for once. Players have to input the correct answer in 10 seconds. If the input answer is right, micro:bit displays "√", if it is not or timeout, display "×".
Addition Opeation Example Code Download: https://makecode.microbit.org/_Wos7jJWVrVyK
- Subtraction operation result: generate random A and B within 0~50. Then the micro:bit LED matrix displays A-B for once. Players have to input the correct answer in 10 seconds. If the input answer is right, micro:bit displays "√", if it is not or timeout, display "×".
Subtraction Operation Example Code Download: https://makecode.microbit.org/_MECYEzF147DP
- Multiply operation result: generate random A and B within 0~10. Then the micro:bit LED matrix displays A*B for once. Player have to input the correct answer in 10 seconds. If the input answer is right, micro:bit displays "√", if it is not or timeout, display "×".
Multiply Operation Example Code Download: https://makecode.microbit.org/_7sEY7Mh166Wm
- Division operation result: generate random A and B within 0~10. Then the micro:bit LED matrix displays A/B for once. Players have to input the correct answer in 10 seconds. If the input answer is right, micro:bit displays "√", if it is not or timeout, display "×".
Division Operation Example Code Download: https://makecode.microbit.org/_544dyFTy9X2L
For any questions, advice or cool ideas to share, please visit the DFRobot Forum
Get Math & Automatic for micro:bit from DFRobot Store or DFRobot Distributor.
Turn to the Top