Transmit Audio Via Micro:bit Radio In MicroBlocks - bbc-microbit

I am using a BBC Micro:bit version 2 and have a program set up on an editor called Micro:blocks. The code is supposed to take input from the first micro:bit's microphone and play it out of the other one's speaker. But when I try it, all I get is an annoying buzzing noise coming out the other end.
I can play it correctly out of the first micro:bit only (not using radio) and it sounds fine. I can't figure out why the second micro:bit makes a buzzing noise.
With the program without radio, I messed around with how long before it played the noise, and none of the tests resulted in a buzzing noise, so I know it's probably not a timing or delay issue.
Anyways, here is my code.
Transmitting code:
when [button a] pressed
set radio group to (7)
set radio channel to (7)
set radio transmit power to (7)
digital pin write (on) to (28)
forever
analog pin write (microphone + 500) to (0)
radio transmit number (microphone + 500)
when [button b] pressed
stop other processes
radio transmit number (0)
analog pin write (0) to (0)
receiving code:
when program started
forever
if (new radio message)
analog pin write (0) to (radio last received number)

This is an interesting project!
Your program looks correct but the radio system may not be fast enough to send each sound sample as a separate message. As a result, you are just hearing a series of clicks, resulting in the buzzing noise.
You could check that the sound data is being sent and received by sending a second or two of sound and graphing the incoming samples on the receiving side. It will be slow, but you should see something that looks like a smooth audio waveform.
Assuming speed is the issue, you could try sending several samples in each packet by encoding them into a string. But even that may not be fast enough to create a smooth audio stream, especially since the encode/decode process will take time.
A different approach would be for the receiver to collect a second or two of sound samples in a list, then play them back in a burst. That would not provide continuous audio but might allow transmitting a sentence at a time.
Here is a record/playback project you might use as a starting point for experimentation.
Note that you can download this image and drop the .png file into the MicroBlocks IDE. MicroBlocks will read the project back from the image itself :)

Related

How do I delay video from my webcam on my own feed?

Id like to have the ability to delay the video from my webcam on. my own computer. Honestly I am using. it. as a "delayed mirror" for my golf swing. I have always recorded, then stopped, opened up the file and watched then did it again. Doing this 30 times in a session working on my swing is annoying. Id like to just take a webcam, be able to delay the video 5,8,10 seconds so I can watch and just keep moving. what is the easiest way around this. I have been told I could do this with a script but not sure where to start. Can anyone help me or send me in the right direction? Im on a Mac but also have a PC if needed.
Python + OpenCV.
First manage to show a current image from your webcam using tutorials.
Then instead of immediately showing the image you add it at the end of a buffer object, this could be a collections.deque from standard Python.
If you want to delay for say 5 seconds and you're capturing with 30 frames per second, then don't show anything until you add 5*30 images from your camera to the buffer. Now when you filled the buffer as soon as you get another image, you add it to the end of the buffer, but also remove 1 image from the beginning of the buffer and show it.

Why does my WASAPI listener fire even when nothing is playing?

WASAPI is documented as not sending audio data if nothing is playing any sound, e.g. this note about WASAPI in NAudio:
Now there is one gotcha with WasapiLoopbackCapture. If no audio is playing whatsoever, then the DataAvailable event won't fire. So if you want to record "silence", one simple trick is to simply use an NAudio playback device to play silence through that device for the duration of time you're recording. Alternatively, you could insert silence yourself when you detect gaps in the incoming audio.
I have written a WASAPI listener, but on my machine, it always fires even when nothing is making any sound. Other users indeed report that when nothing is playing, the signal stops.
So I think some process must be making Windows think that something is playing on my machine, but I can't figure out what it is.
How can I find the source of this phantom audio?
This isn't much of an answer, but when I rebooted, the issue went away. I am assuming that some application like Spotify was playing something, even though it wasn't audible.

Bluetooth HC-05 sending error 1F for INQ command only

I have a problem with my new bluetooth HC-05 module. In AT-mode it works perfectly with all commands that I need... exept INQ.
I have tried to send whole bunch of other commands beforehand:
AT+INIT
OK
AT+ORGL
OK
AT+ROLE=1
OK
AT+CLASS=0
OK
They all are working just fine. I tried to change IAC and INQM settings as well... but the answer from module is always the same:
AT+INQ
ERROR:(1F)
I read related topic here and tried to push the button at HC-05, as it recommended there, but -- no result either.
I have three modules from the same shop, and they all are working the same way
I have a HC-05 with 3.0-20170601 that I managed to bind to a slave last night. It turns out that the v3 has two AT-modes.
The first is when you hold the button while you connect power. The led will blink slowly and you can connect at 38400 baud. But this is like a configuration mode, where AT+INQ is not available.
In this mode I did these commands:
AT
AT+UART
AT+RMAAD
AT+ROLE=1
(Press and hold the button)
AT+RESET
(Release the button after device restarts and led is slowly blinking)
AT+CMODE=1
AT+INQM=0,5,5
AT+PSWD="9999"
AT should give OK as answer to know connection is working
AT+UART will show configured baudrate. Default is 9600.
AT+RMAAD clears all saved connections
AT+ROLE=1 sets it as master
AT+RESET restarts the device to change to master
AT+CMODE=1 accepts all kinds of devices
AT+INQM=0,5,5 inquires in standard mode, with 5 max connections or 5 secs
AT+PSWD="9999" sets the pin code 9999, change to the pin you need
After this it is time to update the arudino code so that it connects to the configured baud rate. It will be something like
BTSerial.begin(9600);
...or what ever value you might have set the baud rate to. Then reflash your arduino.
Now enter the very irritating second AT command mode.
Power up without holding the button. You will get the fast blink speed. When its powered up, press and hold the button. The led will continue blinking fast, but while the button is pressed you can now connect to the device on the configured baud rate. So open the serial monitor and type AT to verify.
Remember that the mode is only active while the button is pressed. So keep it pressed. I had a small clamp I put on there.
Then I entered these commands:
AT+STATE
AT+STATE will show current state, should be inquiring
Then power up the slave device and the adress should start popping up. It will be something like xyz:xy:xyzw,931F00,7FFF
The first part is the address you want (xyz:xy:xyzw)
Change : to , and get xyz,xy,xyzw
Check that you connecting to the correct device
AT+RNAME?xyz,xy,xyzw
Then bind
AT+PAIR=xyz,xy,xyzw,5
AT+BIND=xyz,xy,xyzw
AT+LINK=xyz,xy,xyzw
The AT+LINK command gave me FAIL as output. But it did not matter.
I restarted and did not press any button before or after. Just normal start.
After 5-10s serial data showed up in my serial monitor.
Modules are bound. And will automatically connect at power up. If not you might have the wrong pincode. Make sure to change 9999 above to 0000 or 1234 or what ever it may be. When I hade the wrong pin I still got OK from the AT+PAIR and AT+BIND commands... It didnt work for me until I entered the correct pin.
Sorry for long post, but I wanted to be thorough since info about HC-05 v3 is very scarce on the internet right now.
A reference to all commands can be found here:
http://www.electronicaestudio.com/docs/istd016A.pdf
(Link valid 2018-08-13)
We have same problem and you can see the answer in here.
The conclusion of problem is about the firmware on HC-05 you use. If you use firmware version 3.0, you will get error 1F in AT+INQ. Maybe HC-05 with firmware version 3.0 has different parameters to run AT+INQ. Now I'm confused about how to find HC-05 with firmware version 2.0. That HC-05 have push button or not.
In short, the answer is: The (B) module with firmware version 2.0-20100601 works ok with the following commands (set PIN34 high at power-up, or press button on module and keep pressed during commands).
So HC-05 with version 2.0 use push button or not, it's the same.
If you have some information about the different between HC-05 version 3.0 and version 2.0, please let me know.

My Arduino Serial Monitor is Displaying My IMU Gyro/accel board data as Gibberish

I am running windows 8(64) and am using Arduino Uno for the first time. I downloaded the IDE and plugged in my arduino. I'm using a IMU 6050 Accelerometer Gyroscope Breakout Board and am using the first MPU6050 DMP6 example program to test it out. I open up the serial monitor and instead of displaying the text like it should, it only displays a line of weird symbols(cross,box, y with a dot over it, Germanic alphabet letters) and then nothing else. I am brand new to ardruino and can't figure out what to do. I checked the Uno driver and everything is fine. All the arduino files are downloaded, I have downloaded both the MPU library as well as the I2C library. The Uno is blinking, the data is coming through (I think) for some reason its just not displaying right. I have been searching all over the web for days now and I can't find anyone with the same problem.
It sounds like a baud rate mismatch issue. Try to change the baud rate from the drop-down and make sure that it matches the rate passed to Serial.begin in your sketch.

In-band DTMF tones

As I understand pressing a button on your phone's keypad sends an in-band DTMF tone to the other party. This is not actually sending a telephone signal of any sort, just sends the respective DTMF sound over the voice path.
When an IVR prompts me for entering DTMF tones - instead of pressing a button on the phone, what if I played pre-recorded .WAV files containing the DTMF sounds real loud at my end? Assume these files have excellent quality audio in them.
Is that technically the same thing? Can it be expected to work?
Yes, that will work fine. If you could hum accurately enough, that would work too, but I wouldn't recommend it!