2018年2月27日星期二

First Day Back to Work at Elecfreaks

Hello my dear friends! Happy new year to all of you! We have come back from our Chinese New Year Holiday. Do you miss us? We wish you have a good time like us.

Today is Feb. 26, 2018, the first work day since we were back. Usually in China, the first day when people come back from New Year holiday and start to work, it is a custom for bosses to give their staff some red pockets. Personally, I am quite lucky enough because I have received two red pockets! Dear Boss, I would like to say thank you very much!


Since we are back, the first thing we need to do is to deal with all orders placed during our holiday. Our forwarders are back to work now. Our logistic system is recovered. We will pack up your goods well and arrange delivery as soon as possible. Don't worry! You will get your goods soon! If there are some products delayed due to out of stock or still in preorder, we will inform you by email, or you can send us an email to ask the recent process. Of course, we will also arrange production as soon as possible. For these potential inconvenience caused, we would like to say "sorry" to you beforehand.

After we come back from our holiday, you may have a lot of words to speak to us. And we are very glad to receive your emails. It is a warm-hearted behavior to send us your messages. If you want to ask for more benefits(like more discount), you can email us. If you need help(no matter it is about technical or just personal), you can email us. If you find something wrong with our products(or you just need some products' suggestion), you can email us. If you want to discuss something about future cooperation, welcome email us. Here our email address: Support@elecfreaks.com. You are welcomed to send us your messages!

Spring is the beginning of a year. It is a good time to make some resolutions. 2018, is a year of challenge and hope. We will face all challenges we meet and convert them into chances. we look forward to have better cooperation with our friends, customers, suppliers and forwarders. Today is a good start. We hope to bring you more and more good changes like better products, services and user experience. With our good exceptions, let's begin to work!

Micro:bit Wire Transmission

Communicate between two micro:bits using Morse code, fishing line, a servo and a sensor! Why use micro:bit’s radio when this is so much cooler?

Goals

Use Python to programme the micro:bit Use dictionaries to encode and decode Morse code Move the servo, and detect using the crash sensor

Materials

2 x BBC Micro:bit
2 x Breakout board
2 x Micro-USB cable
1 x Servo
1x Crash Sensor Length of thin string (e.g. fishing line)
Optional: Cardboard sheet
You can’t see the string in this gif, but it’s there between the servo and crash sensor!

Why Python?

Reads like English – Python is one of the easiest languages to read, which makes it such a fantastic beginner’s language Versatile – Python is industry standard for good reason. It can be used to do so much. This is why Google and YouTube utilise the language for part of its back-end software. Active community – Python is one of the most popular languages for beginners. There are tons of resources and many more than willing to help look over your code, which will prove invaluable to helping you get over stumbling blocks in your coding journey.

How Do I Start Coding in Python?

You can write your code in Python on the official micro:bit Python editor. To run a program, click the download button, and drag the .hex file into the MICROBIT drive connected to your computer.

Overview

We’ll be using two micro:bits, one to transmit Morse code and one to receive Morse code. The transmission of data will be done over a length of string. As the servo tugs on the string (based on the encoded input), the crash sensor detects the tugging and decodes it from morse code into letters. Of course, you could transmit data over the radio component of the micro:bit, but where’s the fun in that?

Physical Assembly


Attach the servo to the cardboard sheet, and tie the string around the end of the rotor attached to the servo. Tie the other end of the string around the metal flap of the crash sensor. Attach the crash sensor at a distance such that when the servo turns, the string is pulled and the sensor is activated. If you don’t have a cardboard sheet, you could tape everything to a table. For the transmitting micro:bit, attach the servo to pin 0 on the breakout board. For the receiving micro:bit, attach the crash sensor to pin 0 on the breakout board.

What’s Morse Code?

Morse code is a type of code used to transmit text by a combination of short (“.”, or “dit”) and long (“-“, or “dah”) signals. Every letter of the alphabet and number from 0 to 9 has its own Morse code representation. Letters are separated by pauses.

Transmitter Step 1: Encoding Text into Morse Code

Suppose we are given the text “HELLO WORLD”, and would like to convert this into Morse code. First, we need to have a ‘table’ of what each letter’s morse code is, so that we could, for example, find that “E” is “.” and “W” is “.–”.
We can use one of Python’s data structures, the dictionary, which allows us to associate keys to values. In this case, the keys should be the letters of the alphabet, and the values should be the Morse code representation of the corresponding letter.

Here is a dictionary that should do the trick:
MORSE_CODE = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z': '--..', '0': '-----', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.' }
Now that we can translate each individual letter into Morse code, we should assemble the entire message, adding a space to the end of each letter to tell the receiver that a letter has been sent.

Transmitter Step 2: Moving the Servo based on Morse Code

Once we’ve converted our message into the Morse code form, the next step is to move the servo based on the encoded message. In this case, dit will represent a 0.6s tug, dah a 1.2s tug, and a space a 1.6s tug.
First, we need to find the correct angles for the servos that will either tug on the sensor to activate it, or release the string to deactivate the sensor. We’ll call these values pressangle and releaseangle. For this set-up, their values are 150 and 60, but this will differ based on how you’ve positioned the sensor and servo.
To move the servo, we’ll need to use a class, which can be obtained here. To use this class with the online editor, copy and paste this code at the start of the programme.
For each character (dit, dah or space), we should tug on the string for the appropriate length of time, and then release the string for a short period of time.

Receiver Step 1: Translating Sensor Data into Morse Code

When the string tugs on the sensor, it will press the flap down, and this can be detected using analog input. Whenever the flap is down, the analog reading of the pin drops below a threshold value. In this case, we’ll use a threshold value of 100.
While we could use event listeners that trigger events when the flap is pressed, it’ll be easier to perform polling, which means checking the analog reading at a certain interval, in this case 0.1s.
If in a cycle, the flap is being held down, we’ll increase the presslength by 100, to keep track of how long the flap has been pressed so far. If the flap is found to be released, we can use presslength to figure out how long the button has been pressed, and use it to determine what character (dit, dah or space) has been transmitted. We’ll add this to the variable cur_letter, which keeps track of the dits and dahs that have been sent over so far.

Receiver Step 2: Translating Morse Code into Letters

Every time a space is detected, it should take the characters (dits or dahs) detected so far, and convert that into a letter. We’ll need to use a dictionary again. This time the keys should be the Morse code representation, and the value should be the letter of the alphabet.
Here’s the code for the decoding dictionary:
MORSE_DECODE = {'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L', '--': 'M', '-.': 'N', '---': 'O', '.--.': 'P', '--.-': 'Q', '.-.': 'R', '...': 'S', '-': 'T', '..-': 'U', '...-': 'V', '.--': 'W', '-..-': 'X', '-.--': 'Y', '--..': 'Z', '-----': '0', '.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9'}

Now, whenever a letter is detected (a space is pressed), we can look in the decode dictionary to obtain the original letter. However, sometimes the receiver may not correctly detect the sequence of string tugs, and so the sequence cannot be found in the dictionary. If we try to look for a sequence that cannot be found in the dictionary, Python will throw an error and the programme will stop executing.
Hence, we should first check if the sequence exists in the dictionary’s keys, and if it does not, we’ll set the current character to “?”. Once we have the current character, we can display it on the LEDs, by setting the cur_char variable. At each cycle, we’ll display the character detected.

Putting it all Together

If the set-up doesn’t work flawlessly at first, that’s fine! Try adjusting the positions and orientations of the servo or sensor, as well as the press and release angles of the servo. Also, you can try adjusting the durations of the tugs. Here is the full code for the transmitter and receiver.

Extensions

Although this method of data transmission isn’t used for …obvious reasons, many concepts in data transfer are relevant. Try to experiment with the length of string to see how long distance can be reliably transferred, and at what point the “signal” becomes too weak to be detected.
To boost the “signal”, a third micro:bit can be used as an amplifier that converts sensor signals into new tugs, similar to how signal amplifiers are installed every 20km in underwater fibre-optic cables.
Morse code certainly isn’t the most efficient way to transmit data, nor is it the most reliable way. Experiment with different types of encodings (binary + ASCII, Hamming codes, etc.), as well as explore some error-correcting codes to detect and fix any losses/errors in transmission.

This article comes from Tinkercademy.

Communicate between two micro:bits using Morse code, fishing line, a servo and a sensor! Why use micro:bit’s radio when this is so much cooler?

Goals

Use Python to programme the micro:bit Use dictionaries to encode and decode Morse code Move the servo, and detect using the crash sensor

Materials

2 x BBC Micro:bit
2 x Breakout board
2 x Micro-USB cable
1 x Servo
1x Crash Sensor Length of thin string (e.g. fishing line)
Optional: Cardboard sheet
You can’t see the string in this gif, but it’s there between the servo and crash sensor!

Why Python?

Reads like English – Python is one of the easiest languages to read, which makes it such a fantastic beginner’s language Versatile – Python is industry standard for good reason. It can be used to do so much. This is why Google and YouTube utilise the language for part of its back-end software. Active community – Python is one of the most popular languages for beginners. There are tons of resources and many more than willing to help look over your code, which will prove invaluable to helping you get over stumbling blocks in your coding journey.

How Do I Start Coding in Python?

You can write your code in Python on the official micro:bit Python editor. To run a program, click the download button, and drag the .hex file into the MICROBIT drive connected to your computer.

Overview

We’ll be using two micro:bits, one to transmit Morse code and one to receive Morse code. The transmission of data will be done over a length of string. As the servo tugs on the string (based on the encoded input), the crash sensor detects the tugging and decodes it from morse code into letters. Of course, you could transmit data over the radio component of the micro:bit, but where’s the fun in that?

Physical Assembly


Attach the servo to the cardboard sheet, and tie the string around the end of the rotor attached to the servo. Tie the other end of the string around the metal flap of the crash sensor. Attach the crash sensor at a distance such that when the servo turns, the string is pulled and the sensor is activated. If you don’t have a cardboard sheet, you could tape everything to a table. For the transmitting micro:bit, attach the servo to pin 0 on the breakout board. For the receiving micro:bit, attach the crash sensor to pin 0 on the breakout board.

What’s Morse Code?

Morse code is a type of code used to transmit text by a combination of short (“.”, or “dit”) and long (“-“, or “dah”) signals. Every letter of the alphabet and number from 0 to 9 has its own Morse code representation. Letters are separated by pauses.

Transmitter Step 1: Encoding Text into Morse Code

Suppose we are given the text “HELLO WORLD”, and would like to convert this into Morse code. First, we need to have a ‘table’ of what each letter’s morse code is, so that we could, for example, find that “E” is “.” and “W” is “.–”.
We can use one of Python’s data structures, the dictionary, which allows us to associate keys to values. In this case, the keys should be the letters of the alphabet, and the values should be the Morse code representation of the corresponding letter.

Here is a dictionary that should do the trick:
MORSE_CODE = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z': '--..', '0': '-----', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.' }
Now that we can translate each individual letter into Morse code, we should assemble the entire message, adding a space to the end of each letter to tell the receiver that a letter has been sent.

Transmitter Step 2: Moving the Servo based on Morse Code

Once we’ve converted our message into the Morse code form, the next step is to move the servo based on the encoded message. In this case, dit will represent a 0.6s tug, dah a 1.2s tug, and a space a 1.6s tug.
First, we need to find the correct angles for the servos that will either tug on the sensor to activate it, or release the string to deactivate the sensor. We’ll call these values pressangle and releaseangle. For this set-up, their values are 150 and 60, but this will differ based on how you’ve positioned the sensor and servo.
To move the servo, we’ll need to use a class, which can be obtained here. To use this class with the online editor, copy and paste this code at the start of the programme.
For each character (dit, dah or space), we should tug on the string for the appropriate length of time, and then release the string for a short period of time.

Receiver Step 1: Translating Sensor Data into Morse Code

When the string tugs on the sensor, it will press the flap down, and this can be detected using analog input. Whenever the flap is down, the analog reading of the pin drops below a threshold value. In this case, we’ll use a threshold value of 100.
While we could use event listeners that trigger events when the flap is pressed, it’ll be easier to perform polling, which means checking the analog reading at a certain interval, in this case 0.1s.
If in a cycle, the flap is being held down, we’ll increase the presslength by 100, to keep track of how long the flap has been pressed so far. If the flap is found to be released, we can use presslength to figure out how long the button has been pressed, and use it to determine what character (dit, dah or space) has been transmitted. We’ll add this to the variable cur_letter, which keeps track of the dits and dahs that have been sent over so far.

Receiver Step 2: Translating Morse Code into Letters

Every time a space is detected, it should take the characters (dits or dahs) detected so far, and convert that into a letter. We’ll need to use a dictionary again. This time the keys should be the Morse code representation, and the value should be the letter of the alphabet.
Here’s the code for the decoding dictionary:
MORSE_DECODE = {'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L', '--': 'M', '-.': 'N', '---': 'O', '.--.': 'P', '--.-': 'Q', '.-.': 'R', '...': 'S', '-': 'T', '..-': 'U', '...-': 'V', '.--': 'W', '-..-': 'X', '-.--': 'Y', '--..': 'Z', '-----': '0', '.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9'}

Now, whenever a letter is detected (a space is pressed), we can look in the decode dictionary to obtain the original letter. However, sometimes the receiver may not correctly detect the sequence of string tugs, and so the sequence cannot be found in the dictionary. If we try to look for a sequence that cannot be found in the dictionary, Python will throw an error and the programme will stop executing.
Hence, we should first check if the sequence exists in the dictionary’s keys, and if it does not, we’ll set the current character to “?”. Once we have the current character, we can display it on the LEDs, by setting the cur_char variable. At each cycle, we’ll display the character detected.

Putting it all Together

If the set-up doesn’t work flawlessly at first, that’s fine! Try adjusting the positions and orientations of the servo or sensor, as well as the press and release angles of the servo. Also, you can try adjusting the durations of the tugs. Here is the full code for the transmitter and receiver.

Extensions

Although this method of data transmission isn’t used for …obvious reasons, many concepts in data transfer are relevant. Try to experiment with the length of string to see how long distance can be reliably transferred, and at what point the “signal” becomes too weak to be detected.
To boost the “signal”, a third micro:bit can be used as an amplifier that converts sensor signals into new tugs, similar to how signal amplifiers are installed every 20km in underwater fibre-optic cables.
Morse code certainly isn’t the most efficient way to transmit data, nor is it the most reliable way. Experiment with different types of encodings (binary + ASCII, Hamming codes, etc.), as well as explore some error-correcting codes to detect and fix any losses/errors in transmission.

This article comes from Tinkercademy.
Communicate between two micro:bits using Morse code, fishing line, a servo and a sensor! Why use micro:bit’s radio when this is so much cooler?

Goals

Use Python to programme the micro:bit Use dictionaries to encode and decode Morse code Move the servo, and detect using the crash sensor

Materials

2 x BBC Micro:bit
2 x Breakout board
2 x Micro-USB cable
1 x Servo
1x Crash Sensor Length of thin string (e.g. fishing line)
Optional: Cardboard sheet
You can’t see the string in this gif, but it’s there between the servo and crash sensor!

Why Python?

Reads like English – Python is one of the easiest languages to read, which makes it such a fantastic beginner’s language Versatile – Python is industry standard for good reason. It can be used to do so much. This is why Google and YouTube utilise the language for part of its back-end software. Active community – Python is one of the most popular languages for beginners. There are tons of resources and many more than willing to help look over your code, which will prove invaluable to helping you get over stumbling blocks in your coding journey.

How Do I Start Coding in Python?

You can write your code in Python on the official micro:bit Python editor. To run a program, click the download button, and drag the .hex file into the MICROBIT drive connected to your computer.

Overview

We’ll be using two micro:bits, one to transmit Morse code and one to receive Morse code. The transmission of data will be done over a length of string. As the servo tugs on the string (based on the encoded input), the crash sensor detects the tugging and decodes it from morse code into letters. Of course, you could transmit data over the radio component of the micro:bit, but where’s the fun in that?

Physical Assembly


Attach the servo to the cardboard sheet, and tie the string around the end of the rotor attached to the servo. Tie the other end of the string around the metal flap of the crash sensor. Attach the crash sensor at a distance such that when the servo turns, the string is pulled and the sensor is activated. If you don’t have a cardboard sheet, you could tape everything to a table. For the transmitting micro:bit, attach the servo to pin 0 on the breakout board. For the receiving micro:bit, attach the crash sensor to pin 0 on the breakout board.

What’s Morse Code?

Morse code is a type of code used to transmit text by a combination of short (“.”, or “dit”) and long (“-“, or “dah”) signals. Every letter of the alphabet and number from 0 to 9 has its own Morse code representation. Letters are separated by pauses.

Transmitter Step 1: Encoding Text into Morse Code

Suppose we are given the text “HELLO WORLD”, and would like to convert this into Morse code. First, we need to have a ‘table’ of what each letter’s morse code is, so that we could, for example, find that “E” is “.” and “W” is “.–”.
We can use one of Python’s data structures, the dictionary, which allows us to associate keys to values. In this case, the keys should be the letters of the alphabet, and the values should be the Morse code representation of the corresponding letter.

Here is a dictionary that should do the trick:
MORSE_CODE = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z': '--..', '0': '-----', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.' }
Now that we can translate each individual letter into Morse code, we should assemble the entire message, adding a space to the end of each letter to tell the receiver that a letter has been sent.

Transmitter Step 2: Moving the Servo based on Morse Code

Once we’ve converted our message into the Morse code form, the next step is to move the servo based on the encoded message. In this case, dit will represent a 0.6s tug, dah a 1.2s tug, and a space a 1.6s tug.
First, we need to find the correct angles for the servos that will either tug on the sensor to activate it, or release the string to deactivate the sensor. We’ll call these values pressangle and releaseangle. For this set-up, their values are 150 and 60, but this will differ based on how you’ve positioned the sensor and servo.
To move the servo, we’ll need to use a class, which can be obtained here. To use this class with the online editor, copy and paste this code at the start of the programme.
For each character (dit, dah or space), we should tug on the string for the appropriate length of time, and then release the string for a short period of time.

Receiver Step 1: Translating Sensor Data into Morse Code

When the string tugs on the sensor, it will press the flap down, and this can be detected using analog input. Whenever the flap is down, the analog reading of the pin drops below a threshold value. In this case, we’ll use a threshold value of 100.
While we could use event listeners that trigger events when the flap is pressed, it’ll be easier to perform polling, which means checking the analog reading at a certain interval, in this case 0.1s.
If in a cycle, the flap is being held down, we’ll increase the presslength by 100, to keep track of how long the flap has been pressed so far. If the flap is found to be released, we can use presslength to figure out how long the button has been pressed, and use it to determine what character (dit, dah or space) has been transmitted. We’ll add this to the variable cur_letter, which keeps track of the dits and dahs that have been sent over so far.

Receiver Step 2: Translating Morse Code into Letters

Every time a space is detected, it should take the characters (dits or dahs) detected so far, and convert that into a letter. We’ll need to use a dictionary again. This time the keys should be the Morse code representation, and the value should be the letter of the alphabet.
Here’s the code for the decoding dictionary:
MORSE_DECODE = {'.-': 'A', '-...': 'B', '-.-.': 'C', '-..': 'D', '.': 'E', '..-.': 'F', '--.': 'G', '....': 'H', '..': 'I', '.---': 'J', '-.-': 'K', '.-..': 'L', '--': 'M', '-.': 'N', '---': 'O', '.--.': 'P', '--.-': 'Q', '.-.': 'R', '...': 'S', '-': 'T', '..-': 'U', '...-': 'V', '.--': 'W', '-..-': 'X', '-.--': 'Y', '--..': 'Z', '-----': '0', '.----': '1', '..---': '2', '...--': '3', '....-': '4', '.....': '5', '-....': '6', '--...': '7', '---..': '8', '----.': '9'}

Now, whenever a letter is detected (a space is pressed), we can look in the decode dictionary to obtain the original letter. However, sometimes the receiver may not correctly detect the sequence of string tugs, and so the sequence cannot be found in the dictionary. If we try to look for a sequence that cannot be found in the dictionary, Python will throw an error and the programme will stop executing.
Hence, we should first check if the sequence exists in the dictionary’s keys, and if it does not, we’ll set the current character to “?”. Once we have the current character, we can display it on the LEDs, by setting the cur_char variable. At each cycle, we’ll display the character detected.

Putting it all Together

If the set-up doesn’t work flawlessly at first, that’s fine! Try adjusting the positions and orientations of the servo or sensor, as well as the press and release angles of the servo. Also, you can try adjusting the durations of the tugs. Here is the full code for the transmitter and receiver.

Extensions

Although this method of data transmission isn’t used for …obvious reasons, many concepts in data transfer are relevant. Try to experiment with the length of string to see how long distance can be reliably transferred, and at what point the “signal” becomes too weak to be detected.
To boost the “signal”, a third micro:bit can be used as an amplifier that converts sensor signals into new tugs, similar to how signal amplifiers are installed every 20km in underwater fibre-optic cables.
Morse code certainly isn’t the most efficient way to transmit data, nor is it the most reliable way. Experiment with different types of encodings (binary + ASCII, Hamming codes, etc.), as well as explore some error-correcting codes to detect and fix any losses/errors in transmission.

This article comes from Tinkercademy.

Ringbit car

2018年2月2日星期五

Friday Product Post: TMP36 Temperature Sensor Brick & DC Voltmeter

Hello my friends! Nice to see you on Friday! Today we will continue to introduce some useful electronic components for you. Hope you like it!

New Product 1: Octopus TMP36 Temperature Sensor Brick

This is one of our newly developed octopus series of bricks. It is compatible with BBC micro:bit. By its name, we know this brick has something to do with temperature. Yes, it is a component used to test your surrounding temperature. It has low voltage comsuption and accurate centigrade output. You don't have to do any external calibration before use. Just connect it to your device directly and see its read. Don't just look at its small size! It is powerful enough to help you test the temperature range from -40 °C to +125 °C!

New Product 2: 0.28 Inches LED Display Digital Voltmeter

This is a small component too! From its outlook, you might think of it as a simple digital tube display. But it is a small voltage meter. You can use it to test the voltage range from 0V to 100V. It is quite stable with good accuracy. With the standard overall dimension, you can easily install it to your device. Besides, it has reverse polarity protection, which means it can protect your electric components from short circuit or damage when the positive and negative polar are wrongly connected. Isn't it powerful?
The above all are our new products today. Which one do you like most? If you feel like to know more about our products, you can visit our store. I am sure you will find more useful products there!

https://www.elecfreaks.com/12478.html

2018年2月1日星期四

Friday Product Post: TMP36 Temperature Sensor Brick & DC Voltmeter

Hello my friends! Nice to see you on Friday! Today we will continue to introduce some useful electronic components for you. Hope you like it!

New Product 1: Octopus TMP36 Temperature Sensor Brick

This is one of our newly developed octopus series of bricks. It is compatible with BBC micro:bit. By its name, we know this brick has something to do with temperature. Yes, it is a component used to test your surrounding temperature. It has low voltage comsuption and accurate centigrade output. You don't have to do any external calibration before use. Just connect it to your device directly and see its read. Don't just look at its small size! It is powerful enough to help you test the temperature range from -40 °C to +125 °C!

New Product 2: 0.28 Inches LED Display Digital Voltmeter

This is a small component too! From its outlook, you might think of it as a simple digital tube display. But it is a small voltage meter. You can use it to test the voltage range from 0V to 100V. It is quite stable with good accuracy. With the standard overall dimension, you can easily install it to your device. Besides, it has reverse polarity protection, which means it can protect your electric components from short circuit or damage when the positive and negative polar are wrongly connected. Isn't it powerful?
The above all are our new products today. Which one do you like most? If you feel like to know more about our products, you can visit our store. I am sure you will find more useful products there!

Make An Ultrasonic Distance Tester with Micro:bit

Today, we are going to make an ultrasonic distance tester with micro:bit and ultrasonic sensor module.

Materials Needed


Background Knowledge

 

HC-SR04 Basic Principle

HC-SR04 is a kind of ultrasonic distance measuring modules. With this module, we can detect the space time between ultrasonic send and return, then convert it into distance. Here's the basic principle:
  • Use the IO port TRIG to trigger distance measure with 10us high electric level at least.
  • Automatically send 8 40kHz square wave and check if a signal returns.
  • If a signal has returned, then output a high electric level through the IO port TRIG. The duration of high electric level is the time from ultrasonic send and return.
Distance=(high electric level time x sound space (340m/s))/2
Note: Find in the MakeCode for the already sealed ultrasonic library. You don't have to write any complicated drive code but just simplly invoke the library.

Hardware Assembly

 

Step 1

You can refer to the column below for the connection between ultrasonic module and octopus:bit:
ultrasonic moduleoctopus:bit
VCCVCC
GNDGND
TRIGP14
ECHOP15
1

Step 2

Since the driving voltage of SR04 ultrasonic module is 5V, so we must slide the voltage switch on octopus:bit to the end of 5V.
1a

Step 3

Plug OLED module into IIC cpnnector on octopus:bit.
2
Once connected, you can see the following picture showed:
3

Programming


Step 1

Click to open https://makecode.microbit.org/ and enter the programming interface.

Step 2

Search sonar in ADD Package, then add the ultrasonic library.
4

Step 3

Search OLED in ADD Package, then add the library for OLED module.
5

Step 4

Initialize OLED screen.
6

Step 5

Set the pin trig to be P14 and the pin echo to be P15 with cm as unit. And display the data returned on the OLED screen.
7

Step 6

When you finished your program, you can get the whole code from this link:https://makecode.microbit.org/_CtF2K5HTkarf
Or you can download the code into micro:bit directly through the web page below.

 

Result

Now you have already successfully created a set of ultrasonic measuring device. Point the ultrasonic head to the object you would like to test, then you will see the distance between on the OLED screen.
8

精选博文

How to Make a Counter with microbit

How to Make a Counter with microbit When we have boarded airplane, we often encounter a situation like this: a beautiful stewardess ca...