$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS micro:bit

Magnet switch lamp with micro:bit

DFRobot Dec 24 2018 1600

Magnet switch lamp with micro:bit


 
  Micro:bit
Micromate
magnet
8 x ws2812 5050 led ring
Dupont cables
Christmas Ornaments

The micro:bit measures magnetic force with microteslas (µT) (means the strength of the magnet).

  Which direction the micro:bit should measure the magnetic force?
X ( the left-right direction)
Y (the forward/backward direction)
Z (the up/down direction)
Strength

We will be using strength. We are going to use 2 variables womagnet & magnet. Womagnet will measure the initial reading when the magnet is away from the microbit.
Magnet, will be the reading, when the magnet is near to the microbit.


1. Determine the magnet force setting.

Download the program and observe the readings when we put the magnet near or away from the microbit. This is to determine the value of f in the later in the second program. Your results will be different from mine depending on the strength of your magnet.


The micro:bit has to be calibrated the first time that it is used, so that the readings that it produces are accurate.
When you load a program into the micro:bit and your program tries to read from the compass, it will scroll the words TILT TO FILL SCREEN on the screen. Hold the micro:bit horizontally and tilt it on the spot trying to fill in the screen.


Adding the led ring

How to connect?


On start, we will tell microbit which pin is connected to the ring led and the number of LED used.
We will turn off all the leds when the micro:bit is initially powered on.
We introduce a  variable f. We put a magnet near to the micro:bit, if the magnetic force strength(f) is greater than 100, a heart shape will appear and turn on the led ring. When f is less than 100, we clear the screen and turn off the led ring.



You can change to any color that you like.

 

 

REVIEW