Hello AAC!
I am formulating a plan for a project that requires perfect clock synchronization between three microcontrollers. Now, when I say "perfect", I mean as close to perfect with the lowest error as is technically possible given the devices being used. Please know from the start that I am brand new to microcontrollers. I have some familiarity with electronics and programing but at a novice to intermediate level.
The goal of the project is to experiment with detecting the location of a gunshot, either through triangulation, trilateration, or some geometrical combination thereof and to accomplish this by using the light and sound of the shots fired.
Every project needs a name suitable to its intention, so I've dubbed a tidy little acronym for it. DOSAL or Direction Of Shockwave And Location. Think of it as a line-of-sight sniper detector. It may also, hypothetically, be used to detect the distance to a lightning strike, an incoming meteor, an explosion or any event that has a significant light and sonic signature.
For this project, I'll be using the Redboard Artemis microcontrollers from Sparkfun. Each microcontroller will have a connected sensor. One MC (the Master) will have a light sensor (transistor type) and two MC's (the Slaves) are equipped with digital microphones to detect the instant of a sound. A temperature sensor(s) may also be included for calculating the speed of sound. For the experiments, the MC's will be hardwired as a compact device located at a particular location. However, ideally, they would be individually powered and modularized then distributed at arbitrary locations, tracked with GPS and networked wirelessly for data communications. But for now, let's keep it simple.
Here is the algorithm. Once a shot is fired, the MC with the light sensor will log the time of initial detection and send that data to the slaves, starting a detection sequence. When the sonic wave of the shot reaches the microphone sensors of the slaved MC's; those detection times (and temperatures) are logged respectively. The slave MC's will combine the master's detection time and their own to solve for the distance to the origin of the shot with a TDOA formula. The master MC will constantly ping the slaves during the detection sequence for a solution acknowledgement and once confirmed, will request the calculated distance solutions. Each slave in turn will send their solution to the master MC ending the detection sequence. The master itself then calculates the approximate coordinates of the would-be sniper through triangulation or trilateration etc., then sends the data and displays it for user action.
From my perspective, it seems that clock synchronization is the most important aspect of the concept. Without it the slaves cannot accurately calculate the TDOA formulas, and therefore, the master cannot accurately calculate the location of the shooter.
Can synchronization be achieved and maintained during each detection sequence and without affecting timely communications, while using the master slave configuration? I have read this thread which at least partially addresses my concerns: (1) Problem: Syncing two Arduinos Master/Slave | All About Circuits. It uses a non-standard I2C configuration to create a synchronization event. Is this a concept that would work in my project? Or could I combine I2C and SPI for a synchronization solution? Or some other synchronization concept while still using the master slave relationship?
I would greatly appreciate any guidance or outside the box suggestions and or recommendations.
Thanks.
I am formulating a plan for a project that requires perfect clock synchronization between three microcontrollers. Now, when I say "perfect", I mean as close to perfect with the lowest error as is technically possible given the devices being used. Please know from the start that I am brand new to microcontrollers. I have some familiarity with electronics and programing but at a novice to intermediate level.
The goal of the project is to experiment with detecting the location of a gunshot, either through triangulation, trilateration, or some geometrical combination thereof and to accomplish this by using the light and sound of the shots fired.
Every project needs a name suitable to its intention, so I've dubbed a tidy little acronym for it. DOSAL or Direction Of Shockwave And Location. Think of it as a line-of-sight sniper detector. It may also, hypothetically, be used to detect the distance to a lightning strike, an incoming meteor, an explosion or any event that has a significant light and sonic signature.
For this project, I'll be using the Redboard Artemis microcontrollers from Sparkfun. Each microcontroller will have a connected sensor. One MC (the Master) will have a light sensor (transistor type) and two MC's (the Slaves) are equipped with digital microphones to detect the instant of a sound. A temperature sensor(s) may also be included for calculating the speed of sound. For the experiments, the MC's will be hardwired as a compact device located at a particular location. However, ideally, they would be individually powered and modularized then distributed at arbitrary locations, tracked with GPS and networked wirelessly for data communications. But for now, let's keep it simple.
Here is the algorithm. Once a shot is fired, the MC with the light sensor will log the time of initial detection and send that data to the slaves, starting a detection sequence. When the sonic wave of the shot reaches the microphone sensors of the slaved MC's; those detection times (and temperatures) are logged respectively. The slave MC's will combine the master's detection time and their own to solve for the distance to the origin of the shot with a TDOA formula. The master MC will constantly ping the slaves during the detection sequence for a solution acknowledgement and once confirmed, will request the calculated distance solutions. Each slave in turn will send their solution to the master MC ending the detection sequence. The master itself then calculates the approximate coordinates of the would-be sniper through triangulation or trilateration etc., then sends the data and displays it for user action.
From my perspective, it seems that clock synchronization is the most important aspect of the concept. Without it the slaves cannot accurately calculate the TDOA formulas, and therefore, the master cannot accurately calculate the location of the shooter.
Can synchronization be achieved and maintained during each detection sequence and without affecting timely communications, while using the master slave configuration? I have read this thread which at least partially addresses my concerns: (1) Problem: Syncing two Arduinos Master/Slave | All About Circuits. It uses a non-standard I2C configuration to create a synchronization event. Is this a concept that would work in my project? Or could I combine I2C and SPI for a synchronization solution? Or some other synchronization concept while still using the master slave relationship?
I would greatly appreciate any guidance or outside the box suggestions and or recommendations.
Thanks.
Last edited: