Component: Sound Sensor (101020023) (Grove)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.0 (Release)
Category Grove


Image Sound Sensor (101020023) component

The Sound sensor module is a simple microphone. Based on the power amplifier LM386 and the electret microphone, it can be used to detect the sound strength of the environment.

There are component macros in flowcode 8 which allow you to read the sound as a byte, an integer, a string or as a direct voltage. As well as these, there are macros to get the average reading as a byte or as an integer. Make sure the sound sensor is connected to the right channel in flowcode.

Examples

No additional examples


Downloadable macro reference

GetString

Reads the ADC as a direct voltage and returns as as tring

Parameters

This macro has no parameters


Return value

STRING


GetAverageByte

Function call to read the ADC as a byte average sample over time

Parameters

BYTE NumSamples
BYTE DelayUs
Number of micro seconds in between taking each sample


Return value

BYTE


GetAverageInt

Function call to read the ADC as a full width average sample over time

Parameters

BYTE NumSamples
BYTE DelayUs
Number of micro seconds in between taking each sample


Return value

UINT


GetVoltage

Reads the ADC as a direct voltage

Parameters

This macro has no parameters


Return value

FLOAT


GetInt

Blocking call to read the ADC at full bit depth

Parameters

This macro has no parameters


Return value

UINT


GetByte

Blocking call to read the ADC as a byte

Parameters

This macro has no parameters


Return value

BYTE


Simulation macro reference

This component does not contain any simulation macros


Property reference

Tang Color

This property is of type Color picker and can be referenced with the variable name tang_col.

Colour of the moving part of the slider.

Marker Color

This property is of type Color picker and can be referenced with the variable name mark_col.

Colour of the marker line across the slider tang.

Scope Traces

This property is of type True or false and can be referenced with the variable name ScopeTraces.

Selects if the scope traces are automatically generated or not

Channel

This property is of type Single analog pin and can be referenced with the variable name channel.

Analogue input channel - which pin is the analogue input conected to?

VRef voltage

This property is of type Signed integer and can be referenced with the variable name vrefvol.

Used by the GetVoltage or GetString component macros to take an ADC reading and convert it into a Voltage.

+VRef voltage x 10mV

Default 500 = 5.0V

VRef option

This property is of type Fixed list of ints and can be referenced with the variable name vrefop.

Defines what is used as the ADC maximum reference. ADC Range = GND to VRef Voltage.

VDD - Defines the microcontrollers power supply pin as the max reference,

VREF+ Pin - Dedicated pin on the microcontroller to allow for a variable reference voltage.

Conversion speed

This property is of type Fixed list of ints and can be referenced with the variable name convspd.

Clock setting to select how fast the ADC peripheral will perform an ADC conversion.

The FRC setting is based on a RC time base and so will vary with temperature and pressure.

Other settings are generally based on divisions of the master clock.

Aquisition cycles

This property is of type Signed integer and can be referenced with the variable name actime.

Number of micro seconds to wait for the ACD input to charge before starting the analogue sample.

Bit Depth

This property is of type Signed integer and can be referenced with the variable name bits.

Maximum number of digital bits the ADC can sample.

8 bit = ADC range 0 - 255

10 bit = ADC range 0 - 1023

12 bit = ADC range 0 - 4095