davidzwa / advanced-iot-lisat Goto Github PK
View Code? Open in Web Editor NEWLISAT code for Avanced IoT course
LISAT code for Avanced IoT course
Chirp and TDOA algorithm. Connect to Valin.
Specify the gaps.
Plan the approach with tasks.
struct valin_tdoa_input {
uint16_t tdoa1;
uint16_t tdoa2;
uint16_t tdoa3;
}
valin_tdoa_input processThreeLongBuffer(int16_t* micBuffer1L, int16_t* micBuffer2M, int16_t* micBuffer3R, int16_t bufferLength) {
// ... calculate tdoa's with buffers and bufferLength
// ... call processSingleBuffer x3 if wanted
return valin_tdoa_input;
}
some_return_type processSingleBuffer(int16_t* micBuffer1L, int16_t bufferLength) {
// ... extract features/validation on single buffer
}
Yesterday [10/04/2020] I did some coarse coding and measuring. I dont share the measurements as they were very unreliable.
I did the following:
So far the min/max seems at least a bit promising.
We need to scrutineer the code. A lot. Otherwise this is not gonna work on this Arduino level.
Cosine rollof before, after or without
IIR/FIR
Butter/lattice
Cutoff, falloff design
Need to test:
Yesterday [10/04/2020] I did some coarse coding and measuring. I dont share the measurements as they were very unreliable.
I did the following:
So far the min/max seems at least a bit promising.
We need to scrutineer the code. A lot. Otherwise this is not gonna work on this Arduino level.
I should find a suitable allocation where we want
Currently using
ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A15, false); // Pin A15, P6_0
ADC14_configureConversionMemory(ADC_MEM1, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A12, false); // Pin A12, P4_1
ADC14_configureConversionMemory(ADC_MEM2, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A10, false); // Pin A10, P4_3
ADC14_configureConversionMemory(ADC_MEM3, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A7, false); // Pin A7, P4_6
#defines
struct valin_tdoa_input {
uint16_t tdoa1;
uint16_t tdoa2;
uint16_t tdoa3;
}
valin_tdoa_input processThreeLongBuffer(uint16_t* micBuffer1L, uint16_t* micBuffer2M, uint16_t* micBuffer3R, int16_t bufferLength) {
// ... calculate tdoa's with buffers and bufferLength
// ... call processSingleBuffer x3 if wanted
return valin_tdoa_input;
}
some_return_type processSingleBuffer(uint16_t* micBuffer1L, int16_t bufferLength) {
// ... extract features/validation on single buffer
}
https://github.com/G6EJD/ESP32-8266-Audio-Spectrum-Display
Uses arduino FFT, so that's nice. Need to use
The ESP has a second UART which we can use to communicate. This requires a bit of work.
Communication hub:
Send MQTT messages with driving commands to test update rate and delays.
This issue might be outdated at any time. Please refer to:
https://docs.google.com/spreadsheets/d/1xfLJalJ33kFLRBhn2JFWGeNL8D0fKpyxuKJtPzLRWn8/edit?usp=sharing
function prototype to give a matching-score for the preamble
q15_t preamble_match(q15_t* mic_buffer)
{
int16_t ADC_buffer_size_short
int16_t preamble_sample_length = ADCBUFFERSIZE_SHORT;
q15_t preamble_sample [preamble_sample_length] = {sinus ....}
q15_t multiplication_array [ADC_buffer_size_short];
q15_t correlation_output;
q15_t absolute_correlation_output;
q15_t match_score = 0;
for( int16_t i = 0; i < 1/2 * preamble_sample_wave_length_samples; i++)
{
arm_mult_q15(mic_buffer, preamble_sample + i, multiplication_array, ADCBUFFERSIZE_SHORT);
for( int16_t j = 0; j < ADCBUFFERSIZE_SHORT; j++)
{
arm_add_q15(&correlation_output, &multiplication_array, &correlation_output, 1);
}
arm_abs_q15(&correlation_output, &absolute_correlation_output, 1);
if (absolute_correlation_output > match_score)
{
match_score = absolute_correlation_output;
}
// Optimally calculate what we need to know
if (absolute_correlation_output > match_score)
{
match_score = absolute_correlation_output;
}
return match_score;
}
}
We need a small sketch, a write-up/diagram for this week and simulation + C implementation before next week based on the interface discussed:
How I see it in C/C++:
MspCommandPacket* calculateDeltaTNavigation(int selfPositionX, int selfPositionX, float errorEstimate, ... other robot metadata?) {
// ... determineBest 'piecewise' approach to get us in line with 2 other robots
}
How to set up ADC at a certain pin and sample
We need to define the show of the demo:
Everything online points at that the ESP is not meant for analog sampling (also looking at the fact that there is only one ADC on it of only 10 bits). Secondly, we dont think the timer precision of the ESP is good enough due to the fact that there supposedly are only 2 priorities on the interrupts, which cannot be changed in the Arduino ESP environment. (WiFi on timer0 will go above anything on timer1). This is a blocking problem and to avoid it we need to go back to the MSP.
At least we have a point of reference now and good experiments (#14), which we should try and rebuild with the MSP432 + logic analyzer.
The final challenge is then incorporating the Serial interface in such a way that UART gets 'the right priority' on the MSP. So the ESP is silent when the MSP is listening by agreement (time slotting). We should only allows communication from Serial on high priority packets (so Stop command).
CCS10 Syscfg for final pinout
https://github.com/davidzwa/advanced-iot-lisat/blob/master/src/MSP432LISAT/MSP432P401R_LISAT_ccs/MSP432_LISAT2_new.syscfg
Written out
This is more to make sure we dont exceed the pins and avoid assigning too many to the MSP432. The ESP8266 can also do some tasks if needed.
External
Internal/chassis board
Total required:
External: 2+6+2=10
Chassis: 2+6+9=17
Total: 27 pins
Available: a lot more
Need to make a screen capture video of the FFT for silence/sound scenario for both
For the MAX* based mic.
Need to make video of sine waves in FFT as reference resource.
Report is much earlier than demo, so should contain
Goal:
Calibrate tachometers together with setting 'millimeter per second' speed of wheels. Integrate with differentialDrive calculations to drive robot straight ahead.
Formulas:
Interrupt edges per REV: gear_ratio * tacho_lines = 120 * 32 = 3840
My TICKS_PER_REV define
Wheel circumference: pi * diam = pi * 70mm
Distance per rising edge (interrupt): wheel_circumference / interrupt_edges_per_rev
Delta distance (tacho): num_interrupts * distance_per_risingedgeinterrupt
(Pinout config from O_robot):
Simple PID control, tune it a bit.
There seems to be some questions unsolved about the quadrature 2-signal encoder.
https://www.pololu.com/product/3542
Would be nice to:
Use https://www.pololu.com/product/3542 data instead of TI Module reference.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.