Sonar-Acoustic-Laser-Communication-System (SALCS)
GitHub Repository :

Project Overview:
The Sonar-Acoustic-Laser-Communication-System (SALCS) is a cutting-edge technology that enables the targeted transmission of human-audible audio waves in a directional beam, akin to a laser/audio gun. This provides a unique opportunity to convey information to a specific individual within a group, effectively creating an “audio spotlight.” Additionally, SALCS incorporates a real-time tracking system that allows for precise targeting and continuous following of a designated person. The system employs a Blue Pill microcontroller to modulate incoming audio signals into ultrasonic carrier signals using PWM modulation. Tracking is managed by a Raspberry Pi 3 B+ running OpenCV for motion detection and tracking, coupled with a PCA9685 I2C servo controller that directs a 1080p HD camera for visual tracking.
Key Features
- Directional Audio Transmission:SALCS enables the transmission of human-audible audio waves in a directional beam, akin to a laser/audio gun. This unique feature allows for pinpoint communication in crowded environments.
- Audio Spotlight Capability:The system provides the ability to create an “audio spotlight,” allowing information to be conveyed specifically to a designated individual within a group, enhancing privacy and focus.
- Real-Time Target Tracking:SALCS incorporates a sophisticated real-time tracking system. Utilizing a high-definition camera and motion detection technology, it precisely targets and follows a designated person or object.
- Versatile Applications:SALCS finds applications in a range of scenarios, from emergency communication in helicopters to conveying information in retail environments and cultural institutions.
- Emergency Message Transmission:The system is equipped to transmit critical messages, making it an invaluable tool in emergency situations, particularly for rescue operations or disaster relief efforts.
- Enhanced Visitor Experience:In museums and art exhibitions, SALCS offers a unique way to provide detailed information about exhibits to interested visitors, enhancing their overall experience.
- Military-Grade Communication:With its targeted communication capabilities, SALCS is a valuable asset in military settings. It allows for discreet and precise information dissemination in tactical operations.

Technologies Used
- Blue Pill (STM32F103C8T6): Role: The Blue Pill microcontroller serves as the brain of the system. It is responsible for modulating incoming audio signals into ultrasonic carrier signals through Pulse Width Modulation (PWM) modulation. Technical Aspect: The STM32F103C8T6 is a 32-bit ARM Cortex-M3 microcontroller. Its advanced capabilities include a high processing speed and a rich set of peripherals that make it ideal for complex tasks like audio modulation.
- Raspberry Pi 3 B+: Role: The Raspberry Pi acts as the central control unit for motion detection and tracking. It runs OpenCV, providing real-time feedback for precise targeting. Technical Aspect: The Raspberry Pi 3 B+ is a versatile single-board computer equipped with a quad-core ARM Cortex-A53 processor, making it capable of handling demanding tasks such as image processing and motion tracking.
- PCA9685 I2C Servo Controller: Role: This controller interfaces with the Raspberry Pi to manage the servo motor responsible for directing the 1080p HD camera. It plays a critical role in motion tracking. Technical Aspect: The PCA9685 is a 16-channel, 12-bit PWM driver designed to control servos and LEDs via I2C communication. It provides precise control over servo positions, enabling accurate tracking.
- 1080p HD Camera: Role: The camera captures visual data for motion tracking. It provides critical input for the system to identify and follow the designated target in real time. Technical Aspect: A 1080p HD camera typically features a high-resolution image sensor, capable of capturing detailed visuals even in challenging lighting conditions.
- H-Bridge Controller: Role: The H-Bridge controller is responsible for amplifying the modulated signal before transmission. It ensures a powerful and reliable transmission of audio waves via ultrasonic transducers. Technical Aspect: An H-Bridge is an electronic circuit that enables voltage to be applied across a load in either direction. In this context, it amplifies the signal from the Blue Pill microcontroller to an appropriate level for transmission.
- Ultrasonic Transducers: Role: These transducers are the hardware responsible for converting electrical signals into ultrasonic sound waves for transmission. Technical Aspect: Ultrasonic transducers typically consist of a piezoelectric crystal that vibrates at ultrasonic frequencies when subjected to an electrical signal. This vibration generates sound waves.
Code Details
#include <Arduino.h>
#include <STM32ADC.h>
// 1800 = 40Khz, 3000 = 24Khz
#define PWM_OVERFLOW 1800
#define PWM_OUT PA8 //PWM output
#define PWM_OUT_COMP PB13 //complementary output
#define ANALOG_PIN PA7
#define maxSamples 1
HardwareTimer hTimer1 = HardwareTimer(1);
STM32ADC myADC(ADC1);
char sinetable [32];
uint16_t buffer[maxSamples];
uint8_t count = 0;
uint8 pins = 7;
void isr(void);
uint8_t sine_wave[16] = {
0x80,0xb0,0xda,0xf5,0xff,0xf5,0xda,0xb0,
0x80,0x4f,0x25,0x0a,0x00,0x0a,0x25,0x4f
};
void setup() {
pinMode(PA7, INPUT_ANALOG); // setup PIN A7 for analog in
pinMode(PWM_OUT, PWM); // Uses Timer1 / Channel 3
pinMode(PWM_OUT_COMP, PWM);
pinMode(PC13, OUTPUT); // LED out
/*
* Set STM32 Timer 1 prescale factor to 1 and choose PWM overflow
* 40kHz transducers should use a PWM_OVERFLOW of 1800, while 24kHz
* transducers need to use 3000. This is based upon the 72 Mhz clock
* of the STM32. (70 Mhz / <Transducer Freq>) = PWM OVERFLOW
*
*/
hTimer1.pause();
hTimer1.setPrescaleFactor(1); // Timer PreScale Factor 1
hTimer1.setOverflow(PWM_OVERFLOW); // 72000000 / PWM OVERFLOW = 40Khz
hTimer1.setMode(4,TIMER_OUTPUT_COMPARE);
hTimer1.setCompare(4,PWM_OVERFLOW);
hTimer1.attachInterrupt(4,isr); // Attach ISR
timer_dev *t = TIMER1; //refers t to Timer 1 memory location
timer_reg_map r = t->regs;
/*
* Enable complimentary outputs for improved efficiency when driving
* the TC4427A
*
*/
bitSet(r.adv->CCER,0); //this should enable complimentary outputs
bitSet(r.adv->CCER,2);
//hTimer1.setPeriod(25); // calculate overflow based upon period
hTimer1.refresh();
hTimer1.resume();
pwmWrite(PWM_OUT,PWM_OVERFLOW/2); // 50% duty cycle
/*
* Set ADC to free running mode and transfer data via DMA
*/
Timer3.setPeriod(1000 / 200);
Timer3.setMasterModeTrGo(TIMER_CR2_MMS_UPDATE);
myADC.calibrate();
myADC.setSampleRate(ADC_SMPR_1_5);
myADC.setPins(&pins,1);
myADC.setDMA(buffer, maxSamples, (DMA_MINC_MODE | DMA_CIRC_MODE | DMA_HALF_TRNS | DMA_TRNS_CMPLT), NULL);
myADC.setTrigger(ADC_EXT_EV_TIM3_TRGO);
myADC.startConversion();
}
void loop() {
// Blink the LED so we know we haven't crashed
digitalWrite(PC13, HIGH);
delay(1000);
digitalWrite(PC13, LOW);
delay(1000);
}
/*
* Fire Interrupt on Timer Overflow
* MODULATION SCHEME - change output duty cycle based on adc reading
*/
void isr(void) {
// convert frequency to Pulse Width Modulation Duty Cycle Using DMA
// center on PWM_OVERFLOW
uint16_t pDuty = (uint16_t)map(buffer[0],0,4095,0,PWM_OVERFLOW/2-1);
pwmWrite(PWM_OUT,PWM_OVERFLOW/2+pDuty);
// alternate modulation #2 - louder but worse quality
//uint16_t pDuty = (uint16_t)map(buffer[0],0,4095,0,PWM_OVERFLOW);
//pwmWrite(PWM_OUT,pDuty-1);
// alternate #3
//pwmWrite(PWM_OUT,(((PWM_OVERFLOW-2) * buffer[0]/4096))+1);
// slower method performing an ADC on each interrupt
//int16_t pDuty = (PWM_OVERFLOW -2)/2 * sine_wave[count++]/255;
//int16_t pDuty = (PWM_OVERFLOW -2)/2 * ((float)analogRead(PA7)/4095);
//int16_t pDuty = (PWM_OVERFLOW -2)/2 * ((float)analogRead(PA7)/4095);
//pwmWrite(PWM_OUT,pDuty + (PWM_OVERFLOW / 2));
// sine wave test
//int16_t pDuty = PWM_OVERFLOW/2 * sine_wave[count++]/128;
//pwmWrite(PWM_OUT,pDuty);
//if(count >= 15)
// count = 0;
}