You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PIR-sensor.md
+8-7
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,8 @@ cats: external
25
25
# Name of Component for index page
26
26
simple-description: "PIR Sensor"
27
27
28
-
date: 2016-12-23T10:20:00Z
28
+
date: 2016-12-23T10:20:00Z
29
+
date-updated: 2016-12-23T10:20:00Z
29
30
---
30
31
31
32
The PIR sensor module will detect movement and report it to the microbit as a digital signal. There are many PIR sensor modules on the market but the most common one is based on the DYP-ME003 PIR sensor module by Open Impulse. This module runs at 5v so requires _some_ hacking to work with the microbit.
@@ -52,7 +53,7 @@ Confirmed PIR sensor modules with two sets of header pins:
52
53
53
54
#### Using a Sensor with 2 x Header Pins
54
55
55
-
Attach the microbit's `3v pin` to the header pin on the PIR sensor labelled `H`.
56
+
Attach the microbit's `3v pin` to the header pin on the PIR sensor labelled `H`.
56
57
57
58
Attaching it to the H pin bypasses the voltage regulator on the sensor and enables it to run on 3.3v. The jumper attached to these pins can be discarded.
58
59
@@ -62,12 +63,12 @@ There is more about this process and its discovery on [tech gurka](http://techgu
62
63
63
64
There are two potentiometers labelled TIME (or T) and SENSITIVITY (or S) on the sensor module. Adjusting SENSITIVITY changes the detection range from 3m to up to 7m. As the range increases, the more sensitive to movement it becomes.
64
65
65
-
TIME represents the duration of the output signal. If it detects movement, the TIME parameter controls how long the sensor will output HIGH. This can be changed from 5s through to 300s.
66
+
TIME represents the duration of the output signal. If it detects movement, the TIME parameter controls how long the sensor will output HIGH. This can be changed from 5s through to 300s.
Any coloured light can be made by varying how bright the red, blue and green LEDs are lit. This can be done with `pin0.write_analog(n)` where *n* is a value between 0 (off) and 1023 (on full).
45
+
Any coloured light can be made by varying how bright the red, blue and green LEDs are lit. This can be done with `pin0.write_analog(n)` where *n* is a value between 0 (off) and 1023 (on full).
45
46
46
47
47
48
{:.ui .dividing .header}
@@ -72,7 +73,7 @@ blue = pin1
72
73
green = pin2
73
74
74
75
while True:
75
-
76
+
76
77
# Make Yellow
77
78
red.write_digital(1)
78
79
green.write_digital(1)
@@ -109,4 +110,4 @@ while True:
109
110
110
111
### Experiment
111
112
* Use `random.randrange(start, stop, step)` to generate a random colour every few seconds
Copy file name to clipboardExpand all lines: button.md
+3-4
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,8 @@ simple-description: Push Button
27
27
28
28
acknowledgements: SMD push button switch by Sparkfun (CC-BY-2.0)
29
29
30
-
date: 2016-12-23T10:20:00Z
30
+
date: 2016-12-23T10:20:00Z
31
+
date-updated: 2016-12-23T10:20:00Z
31
32
---
32
33
33
34
A small push button can be used to provide an external input into your circuits.
@@ -39,7 +40,7 @@ This is a small, SMD-mount tactile switch identical to the ones on your microbit
39
40
{:.ui .dividing .header}
40
41
### Electronics
41
42
42
-
One of the button's pins is connected to 3V. The corresponding pin to `pin0` of the microbit. When the button is pressed, `pin0` reads `True` or `1`.
43
+
One of the button's pins is connected to 3V. The corresponding pin to `pin0` of the microbit. When the button is pressed, `pin0` reads `True` or `1`.
43
44
44
45
{:.ui .image .centered}
45
46
@@ -81,5 +82,3 @@ while True:
81
82
<p>The microbit has internal pull-up and pull-down resistors. When a digital input is read by the microbit, the pull-down resistors are turned on so there is no need for an external one. </p>
82
83
<p>This behaviour can be modified in PXT but not Python. </p>
Neopixels are RGB LEDs sold by an electronics company called Adafruit. The modules come in different shapes and can contain any number of RGB LEDs. Each LED can be controlled (or addressed) individually. The microbit can drive around 8 LEDs; to control modules with more LEDs you'll need to use an external 5v power source.
39
+
Neopixels are RGB LEDs sold by an electronics company called Adafruit. The modules come in different shapes and can contain any number of RGB LEDs. Each LED can be controlled (or addressed) individually. The microbit can drive around 8 LEDs; to control modules with more LEDs you'll need to use an external 5v power source.
39
40
40
41
You can get generic, Neopixel-style modules by searching for 'ws2812 LED' on eBay or Amazon.
41
42
@@ -47,7 +48,7 @@ Most neopixel modules require the user to solder on their own connections. This
acknowledgements: potentiometer image by budgetronics.eu (CC-SA 2.0)
29
29
30
-
date: 2016-12-23T10:20:00Z
30
+
date: 2016-12-23T10:20:00Z
31
+
date-updated: 2016-12-23T10:20:00Z
31
32
---
32
33
33
34
Potentiometers are a type of resistor. The incoming voltage is divided between the middle and the GND pin. How this is divided depends on the rotation of the knob.
@@ -115,4 +116,3 @@ Rotate the knob to fill the microbit display with lit pixels. Note the potentiom
Copy file name to clipboardExpand all lines: rain-sensor.md
+8-7
Original file line number
Diff line number
Diff line change
@@ -25,10 +25,11 @@ cats: external
25
25
# Name of Component for index page
26
26
simple-description: Rain Sensor
27
27
28
-
date: 2016-12-23T10:20:00Z
28
+
date: 2016-12-23T10:20:00Z
29
+
date-updated: 2016-12-23T10:20:00Z
29
30
---
30
31
31
-
A rain sensor will detect droplets of water when they fall on the sensor board.
32
+
A rain sensor will detect droplets of water when they fall on the sensor board.
32
33
33
34
{:.ui .dividing .header}
34
35
### Component
@@ -40,16 +41,16 @@ The sensor board has two traces on it and the microbit can measure the resistanc
40
41
#### Which Sensor?
41
42
A search for 'FC-37' or 'YL-83' or 'Arduino Raindrop Sensor' will yield the sensor that's required.
42
43
43
-
The sensor usually comes with two modules. One part detects the raindrops, the other takes a signal from the sensor and outputs it as an analog or digital signal. It's possible to use the big raindrop detector module on its own; see the _Soil Moisutre Sensor_ entry on how to do it.
44
+
The sensor usually comes with two modules. One part detects the raindrops, the other takes a signal from the sensor and outputs it as an analog or digital signal. It's possible to use the big raindrop detector module on its own; see the _Soil Moisutre Sensor_ entry on how to do it.
44
45
45
46
#### Setting Sensitivity
46
47
First we need to provide power to the sensor to set its sensitivity:
47
48
48
49
* Connect the two modules together
49
-
* Connect the `GND` pin on the small module to the microbit's `GND` pin.
50
+
* Connect the `GND` pin on the small module to the microbit's `GND` pin.
50
51
* Connect the module's `VCC` or `+` pin to the microbit's `3v pin`.
51
52
52
-
An LED will light on the module.
53
+
An LED will light on the module.
53
54
54
55
There is a small potentiometer on the module. This sets the level of sensitivity required for the sensor to output a digital signal to say it has detected water.
Copy file name to clipboardExpand all lines: servo.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,8 @@ simple-description: Servo
27
27
28
28
acknowledgements: Servo teaser & diagram by [Upgrade Industries](https://www.upgradeindustries.com/licensing/)
29
29
30
-
date: 2016-12-23T10:20:00Z
30
+
date: 2016-12-23T10:20:00Z
31
+
date-updated: 2016-12-23T10:20:00Z
31
32
---
32
33
33
34
The __Tower Pro SG90__ is a small, 9 gram servo that can run directly from the microbit power supply. This is a 180° servo meaning it can turn from 0° to 180°. It has many applications: open a flap to dispense treats for to a dog, create a robotic walker, or to drive window wipers on a car.
@@ -68,7 +69,7 @@ Servos are difficult to control in Python on the microbit. I've tried to make it
A module must be installed to tell Python how to use the servo.
72
+
A module must be installed to tell Python how to use the servo.
72
73
73
74
#### Steps
74
75
@@ -95,7 +96,7 @@ while True:
95
96
96
97
{% endhighlight %}
97
98
98
-
The angle of the servo is controlled by `Servo(pin0).write_angle(30)`. If you want to control a servo attached to pin1 as well, it would be:
99
+
The angle of the servo is controlled by `Servo(pin0).write_angle(30)`. If you want to control a servo attached to pin1 as well, it would be:
99
100
100
101
{% highlight python %}
101
102
Servo(pin1).write_angle(30)
@@ -122,4 +123,3 @@ sv2.write_angle(0)
122
123
123
124
### Experiment
124
125
* Play with the [sweep example](https://github.com/microbit-playground/microbit-servo-class/blob/master/examples/twist-example.py) to rotate the servo through 180°
acknowledgements: Teaser image by Adafruit (CC-BY). Sensor image by spark fun (CC-BY). Dupont connector by Adafruit (CC-BY).
29
29
30
-
date: 2016-12-23T10:20:00Z
30
+
date: 2016-12-23T10:20:00Z
31
+
date-updated: 2016-12-23T10:20:00Z
31
32
---
32
33
33
34
A soil moisture sensor module is designed to measure the amount of water in the soil by reading its resistance. It passes an electric current through the two prongs and measures the resistance of the soil.
0 commit comments