Pages

Monday, November 24, 2014

A Xively logger library for Spark Core

Xively (formerly Cosm and before that Pachube) is an on-line database service allowing developers to connect sensor-derived data (e.g. energy and environment data from objects, devices & buildings) to the Web and to build their own applications based on that data.


This library is a modular and configurable Xively data logger, built for Spark Core, usefull to send datapoints to your xively feed.

It comes with a configurable web page, user can set Xively API Key and feed id by browsing the setup page.

One can extend the sample snippet code to create a custom logger using sensors connected to Spark.


Code

Notes
  • read risk disclaimer
  • excuse my bad english

Friday, November 14, 2014

An op-amp based Electret Condenser Microphone Preamp for microcontrollers

This is an op-amp Electret Condenser Microphone Preamp board design for the use with microcontrollers ADC.



For the NPN version of this board, an for more information about microcontroller ADC and microphone input, please refer to this page:
http://davidegironi.blogspot.it/2014/11/a-npn-transistor-electret-condenser.html


The proposed circuit is just a revision of a pretty usually op-amp electret mic preamplifier.
The selected op-amp is the TLC272, because it can be drive in single rail operation, it's common mode input range, and has good noise performance. Also other op-amp could work.
The op-amp is configured in non inverting mode.


C3 is a power supply stabilization condenser.
R4 helps remove noise from the power line, but it can also be omitted.
R5 is used to polarize the microphone.
C5 is a low pass filter, it helps to remove board noise.
C4 is the input DC blocking capacitor.
R3 and R9 sets the circuit gain.
R9 loads the NPN collector.
R3 bias the signal using the collector feedback bias design, it prevents thermal runaway and stabilize the operating point, in conjuction wht R9 resistor, this sets the gain of the board.
C2 is a low pass filter.
C1 reduce dc "noise gain" by capacitively coupling the feedback, it also act as an high pass filter
R6 and R7 does a voltage divider to perform the bias on the signal.
C6, R1 and R2 also is an input voltage divider, and the cap here is is the output DC blocking capacitor, this design has input and ouput voltage diveder cause one can supply the opamp with a voltage, and the R6/R7 divider with the ADC reference voltage, with a single supply voltage, one can remove those last components.

Tested on ATmega8 and STM32F103 ADC, loaded with 5v or 3.3v (i'm using the C suffix TLC272 that has 3v as minimum recomanded), it has a little noise and it a good response even on low sound, sliglty better than the NPN version.

Wednesday, November 5, 2014

A NPN transistor Electret Condenser Microphone Preamp for microcontrollers

This is a NPN Electret Condenser Microphone Preamp board design for the use with microcontrollers ADC.



In order to make an electret condenser microphone signal "readable" by a microcontroller ADC, it has to be matched the ADC specification of the microcontroller. Most of the time it means, add some gain to the signal, reduce his impedance, and bias it.


Most microcontrollers ADC can convert signal from 0v to a their positive reference value.
So the input signal must be biased between the ADC max and mix voltage. Also, to obtain the maximum accurancy from the ADC, the signal should not exceed the max and min ADC voltage.
For ATmega8 with an ADC reference voltage of 5v, it means more or less at 2.5v, with an amplitude of 2.5v. Given the ATmega8 ADC accurancy of 10bit, that means 1024 points.

The proposed circuit is just a revision of a pretty usually NPN electret mic preamplifier.


C1 is a power supply stabilization condenser.
R5 is used to polarize the microphone.
C5 is a low pass filter, it helps to remove board noise.
C3 is the input DC blocking capacitor.
R9 loads the NPN collector.
R3 bias the signal using the collector feedback bias design, it prevents thermal runaway and stabilize the operating point, in conjuction wht R9 resistor, this sets the gain of the board.
C6 is the ouput DC blocking capacitor.
R6 and R7 does a voltage divider to perform the bias on the signal.

Tested on ATmega8 and STM32F103 ADC, loaded with 5v or 3.3v, it has a little noise and it a good response even on low sound.