A monitor system with multiple features using an Arduino Mega 2560
Short and quick readme until I have more time to go over this!
- Serial Communications (both for debugging and commands)
- Powermode features for low power usage/standby
- Read current and voltage every 100ms (readOnce, readAverage, readMin, readMax and reset stores)
- Read ambient light every 100ms (readOnce, readAverage, readMin, readMax and reset stores)
- Read sound signal every 100ms using fft (readFundamentalFrequency, readVolume, readAverageVolume, readMinVolume, readMaxVolume, readFrequencyWaveform and reset stores)
- Visual Basic program to interface with arduino
The arduino is designed to allow the automated testing of instrument cluster software.
Serial communication baud rate = 9600
Will add later, for now just look at the code and find online...
None
Command | Sub-command |
---|---|
PM | XX |
Sub Command | Meaning | Comment |
---|---|---|
Never Received | Power Off | Power Off |
0 | Power Off | Power Off (Low current mode) |
1 | On | Ready for use |
PM = 1
The voltage at the input pin is read every 100ms and the store values (Minimum, Maximum, Average) are updated.
The Average value is calculated by using the previous 5 scheduled read values, if less than 5 reading have been taken since power on or receipt of a "Store Reset" command then the average is calculated using only the available data. i.e. if only 3 records are available they are added together then devided by 3.
Command | Sub-command |
---|---|
MVM | XX |
Request | Response |
---|---|
Command | Meaning |
Never Received | Nothing |
MVM ,0 | Nothing |
MVM ,1 | Read Once |
MVM ,2 | Read Average |
MVM ,3 | Read Minimum |
MVM ,4 | Read Maximum |
MVM ,5 | Reset Stores |
MVM 6 -> 255 | Nothing |
Reads the current voltage (on demand) from the input and returns the value at a resolution of 0.1v per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the current stored Average value is returned at a resolution of 0.1v per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the Minimum voltage that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of 0.1v per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the maximum voltage that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of 0.1v per bit in a 16bit number (xx = MSB,yy = LSB).
Resets the stored valus for minimum and maximum to zero (Voltage), returns 1 if reset was successful, 0 if not successful.
PM = 1
The current at the input pin is read every 100ms and the store values (Minimum, Maximum, Average) are updated.
The Average value is calculated by using the previous 5 scheduled read values, if less than 5 reading have been taken since power on or receipt of a "Store Reset" command then the average is calculated using only the available data. i.e. if only 3 records are available they are added together then devided by 3.
Command | Sub-command |
---|---|
MCM | XX |
Request | Response |
---|---|
Command | Meaning |
Never Received | Nothing |
MCM ,0 | Nothing |
MCM ,1 | Read Once |
MCM ,2 | Read Average |
MCM ,3 | Read Minimum |
MCM ,4 | Read Maximum |
MCM ,5 | Reset Stores |
MCM 6 -> 255 | Nothing |
Reads the current (on demand) from the input and returns the value at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the current stored Average value is returned at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the Minimum current that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the maximum current that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Resets the stored valus for minimum and maximum to zero (Current), returns 1 if reset was successful, 0 if not successful.
PM = 1
The ambient Light at the input pin is read every 100ms and the store values (Minimum, Maximum, Average) are updated.
The Average value is calculated by using the previous 5 scheduled read values, if less than 5 reading have been taken since power on or receipt of a "Store Reset" command then the average is calculated using only the available data. i.e. if only 3 records are available they are added together then devided by 3.
Command | Sub-command |
---|---|
MLM | XX |
Request | Response |
---|---|
Command | Meaning |
Never Received | Nothing |
MLM ,0 | Nothing |
MLM ,1 | Read Once |
MLM ,2 | Read Average |
MLM ,3 | Read Minimum |
MLM ,4 | Read Maximum |
MLM ,5 | Reset Stores |
MLM 6 -> 255 | Nothing |
Reads the ambient Light (on demand) from the input and returns the value at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the ambient Light stored Average value is returned at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the Minimum ambient Light that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Reads the maximum ambient Light that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of 0.1ma per bit in a 16bit number (xx = MSB,yy = LSB).
Resets the stored valus for minimum and maximum to zero (ambient Light), returns 1 if reset was successful, 0 if not successful.
PM = 1
The Sound Signal at the input pin is read on demand and the calculated values are returned using the response message.
Every 100ms a reading of sound volume is taken and the store values (Minimum, Maximum, Average) are updated.
The Average value is calculated by using the previous 5 scheduled read values, if less than 5 reading have been taken since power on or receipt of a "Store Reset" command then the average is calculated using only the available data. i.e. if only 3 records are available they are added together then devided by 3.
Command | Sub-command |
---|---|
MSM | XX |
Request | Response |
---|---|
Command | Meaning |
Never Received | Nothing |
MSM ,0 | Nothing |
MSM ,1 | Read Fundemental Frequency |
MSM ,2 | Read Volume Level |
MSM ,3 | Read Average Volume Level |
MSM ,4 | Read Minimum Volume Level |
MSM ,5 | Read Maximum Volume Level |
MSM ,6 | Read Frequency waveform |
MSM ,7 | Reset Stores |
MSM 8 -> 255 | Nothing |
Reads the fundamental frequency of the current input signal (on demand) and returns it in the response message at a resolution of xxyy = Frequency in 1hz per bit (xx = MSB,yy = LSB).
Reads the Sound Level (on demand) from the input and returns the value at a resolution of 1 ADC count per bit (xx = MSB,yy = LSB).
Reads the Sound Level stored Average value is returned at a resolution of xxyy = Frequency in 1hz per bit (xx = MSB,yy = LSB).
Reads the Minimum Sound Level that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of xxyy = Frequency in 1hz per bit (xx = MSB,yy = LSB).
Reads the maximum Sound Level that has been seen since the "Reset Stores" command was received (or since Power On:- PM = 1), the value at a resolution of xxyy = Frequency in 1hz per bit (xx = MSB,yy = LSB).
Resets the stored valus for minimum and maximum to zero (Sound Level), returns 1 if reset was successful, 0 if not successful.
Reads the frequency and volume of the current input signal (on demand) and returns it in the response message according to the table below.
Data Item | Value | Meaning | Resolution |
---|---|---|---|
0 | MSMR6 | Id of the response message | N/A |
1 | 1 | Frequency band Number 1 | N/A |
2 | xx | Sound Level | Sound Volume in 1 ADC count per bit. |
3 | 2 | Frequency band Number 2 | N/A |
4 | xx | Sound Level | Sound Volume in 1 ADC count per bit. |
…… | |||
256 | 128 | Frequency band Number 128 | N/A |
257 | xx | Sound Level | Sound Volume in 1 ADC count per bit. |