Hello,
The HC-05 are connected using AT commands and have a baud rate of 9600. This code below can only read 1k samples per second so we want to make it read more. We are only have to hear the beat of songs and audio but not the voices. We want to take in Audio using ADC which is sent through Bluetooth(int value) to another Bluetooth (int value). It will then go through a DAC, DAC buffer, Low Pass filter, Signal amplitude, Amplifier, DC offset then amplifier.
#include <SoftwareSerial.h>
SoftwareSerial EEBlue(10, 11); // RX | TX
uint8_t data = 0;
void setup()
{
DDRD = 255;
TIMSK0 = 0;
Serial.begin(9600);
EEBlue.begin(9600);
//set digital pins 0-7 as outputs
}
void loop()
{
if (EEBlue.available() > 0)
{
data = EEBlue.read();
PORTD = data;
}
}
We now want to go from 1k samples/sec to more using the code below but I am not quite sure where I would implement our Slave Bluetooth read that will be outputted to PORTD.
Master:
Hello,
We have two hc-05's communicating via AT commands. Baud rate: 9600
We have a DAC, DAC buffer, Low Pass filter, Signal amplitude, Amplifier, DC offset then amplifier connected to the slave Arduino and Microphone connected to Master Arduino.
The problem is we can only hear the beat of songs and audio. Anyway my code is wrong or I need to increment the baud rate? Thank you.
#include <SoftwareSerial.h>
SoftwareSerial EEBlue(10, 11); // RX | TX
unsigned char data = 0;
void setup() {
//cli();
TCCR0A = 0;// set entire TCCR1A register to 0
TCCR0B = 0;// same for TCCR1B
TCNT0 = 0;//initialize counter value to 0
// set compare match register for 1000000hz increments with 8 bits prescaler
OCR0A = 49;// = (16*10^6) / (1000000*8) - 1 (must be <65536)
// turn on CTC mode
TCCR0A |= (1 << WGM12);
// Set CS11 bit for 8 prescaler. Each timer has a different bit code to each prescaler
TCCR0B |= (1 << CS11);
// enable timer compare interrupt
TIMSK0 |= (1 << OCIE1A);
// sei();
DDRD = 0xFF;
Serial.begin(9600);
EEBlue.begin(9600);
}
void loop() {
if (EEBlue.available() > 0)
{
data = EEBlue.read();
Serial.println(data);
}
}
ISR(TIMER0_COMPA_vect)
{
PORTD = data;
//insert your code here that you want to run every time the counter reaches OCR1A
}
9600 or 9.6k is not enough to transmit music. Low quality transmission is about 60k you need about 256k for decent transmission of sound. Which isn’t that fast in the real world. I believe the HC05 wasn’t designed for streaming music. If you get it to work that would be interesting.