Programming LEDs to power on through voice activation

What are some options to program LEDs to power on through voice activation (using micro:bit). Are there any links to good tutorials?

1 Like

Hi

Welcome !

Are you using a V1 or V2 micro:Bit please?

LEDs on the Micro:Bit 5*5 display or External?

Using external LEDs, and open to using V1 or V2 micro:Bit

So sorry for the delay in getting back to you!!

Using a V2 Micro:Bit is the easiest way to do this as it has a Microphone Built in & MakeCode has the blocks to support it.

Here i have connected Led ( & current limiting resistor ) to PIN1 & GND on the Micro:Bit…

The Pin:Bit connector is NOT necessary it just makes accessing the pins easier i find - you can just use Alligator clip wires or whatever you have just as well.


Here is the code I used - not the best way of doing it i admit but hopefully easy to understand?

The code 1st sets a variable i use to decide if LED is to be turned on or off ( false = off . True = on )

It then Sets PIN1 to 0 which has the effect of ensuring the LED connected to PIN1 is turned off as soon as the code is run.

When a “LOUD” sound is detected the code inverts the value of ONOff - if False it sets it to True , If True it sets it to False.
This results in LED being turned on / off alternately each time a “LOUD” sound is detected

The code the turns on the LED ( by setting PIN1 to 1) if OnOff is True otherwise it turns it off ( by setting PIN1 to 0 )


I hope this helps , please feel free to ask any further questions

Finally here is the link to my code…

https://makecode.microbit.org/_h5zgojapYadd

Thank you!

You are most welcome .

I realise you may want “full” voice control -
Such as "turn on light " , " turn off light " etc ?

This code just reacts to any loud noises in the room …

If you want fuller voice control let me know , you will need extra hardware such as …

I’ve had good success with this device & would be only too glad to help in any way …

Just ask as many questions as you need , as often as you need to ask them .

Please let me know how you get on ?

Regards

Thank you for this! I think I will want to do the voice recognition.

Hi again

Yes a voice recognition system will give you more control

The offline device I recommended before is very useful & easy to use .
No need for complicated programming or any internet connectivity

Here is a very short video I did show the basic usage of it

If you’d like any more information or help please just ask

Regards

Hi, it’s Mikki again. Is the expansion board necessary for just when coding, or does it need to be attached at all times?

I want to use gravity voice recognition system with a battery powered micro bit to have a led light attached to a hand-made lantern turn on and off. Will the expansion board need to remain attached to the microbit once coded for the light to turn on and off?

I’m very new to all of this! Thank you for your help.

Hi

Great to hear from you again!

I used the expansion board shown before PURELY as a simple way to connect the Voice Recognition board to the Micro:Bit,

There are various other expansion boards available that give access to the pins on the Micro:Bit, many are smaller if space is a concern in your project, or indeed , with a bit of imagination & some wires you could connect BOTH the Voice Recognition Board & the Lantern DIRECTLY to the Micro:Bit

It needs to connect to 3V , GND,SDA & SCL pins on the Micro:Bit
** * Pin 19: The SCL (clock) pin

  • Pin 20: The SDA (data) pin**

With this connection method you also need to ensure the Voice Board Mode Selection Switch s set to I2C

Again the expansion board i used plays no part in the programming / operation but just acts as a relatively simple way to connect it all together

Hope this helps - if not please free free to ask

Let us know how your project is coming along

Regards

Good day!

Do you know of 1-3 other manufacturers other than DF Robot that make an offline language learning voice recognition sensor for micro:bit?

I appreciate your help.

Hi

The only other similar device I know that has Makecode support is …

There was another device by kittenbot called “Koi v1” but the newer V2 version has had voice recognition removed .

The other device I know of does not have Makecode support so may not be suitable…

Regards

Hi dsssssssss9,

I’m Mike, and I’m collaborating with Mikki on this project. As I’m also new to coding, I would appreciate any guidance. Could you walk me through the initial setup of the DFRobot voice recognition module? Thank you!

HI Mike
Great to meet you even if only virtually

Would be glad to help in any way i can

Do you have The DFRobot module yet or are you just looking at how to set it up so you can decide if it is the right module for your project???

If you could give me a day or 3 i’ll get a quick guide put together for you
Would you prefer written or video guide ( or both of course)?

Regards

It’s great to meet you as well,

I have the DFRobot module, microchip, expansion board, and all the necessary wires and I connected them according to the instructions on the DFRobot website.

I copied the microchip code from the website and uploaded it (not sure if it’s correct). When I say, “hello robot,” the blue light on the voice activation module lights up, but it doesn’t respond to the command.

I’ve attached a photo of the module connected to the microchip, showing the blue light activation. Additionally, I’m including a screenshot of the code I copied. In the second serial write line in the “on start” block, I input 18 equal signs. I suspect this might be part of the issue.

I would prefer a written and video guide

Thank you in advance for your help!

Here is the code.