Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Voice Sampling and PWM Reproduction by GR Sakura

By Ajish Alfred October 17, 2013

 

Voice signals are continuous analog signals and the analog circuits or systems can only handle the voice signals without changing their continuity feature. There come situations in which the analog voice signals need to be applied as the input to simple digital microcontrollers. The digital devices like microcontrollers cannot handle the continuous analog signals. Most of the microcontrollers have an ADC module which can do analog to digital conversion. The microcontroller uses sampling technique to convert the continuous analog signals to discrete digital equivalent samples. 

The digital microcontrollers based devices cannot produce analog output also, since their output will be always either logic high or logic low. To generate the effect of the continuous analog signal at any output device connected to the microcontroller, they use a technique called PWM (Pulse Width Modulation).
In this project the sampling and reproduction of voice signal is demonstrated with the help of GR SAKURA board.
DESCRIPTION:
The project uses a simple condenser microphone which captures the voice input and the fetch them to one of the ADC channels of the GR SAKURA. The GR SAKURA then uses the same sampled values to generate the PWM equivalent of the analog voice signals at an output pin where the loudspeaker is connected.
The entire system can be divided into the following blocks:

Block Diagram of GR Sakura based Voice Sampler

Fig. 1: Block Diagram of GR Sakura based Voice Sampler

 

      1)   MICROPHONE AMPLIFIER CIRCUIT
The microphone used here is a small commonly found condenser microphone. The microphone captures the voice signals from the surrounding and produces the voltage equivalent of the sound signals. The amplitude of the sound signal output from the microphone is very feeble and they need to be amplified several times before they are applied to the microcontroller or any other devices. This circuit blocks uses two stage transistor based amplifier to amplify the analog voice signals to the required amplitude level for the GR SAKURA.

Circuit Diagram of Microphone Amplifier

Fig. 2: Circuit Diagram of Microphone Amplifier

Here a 2.2K ohm resistor is selected, which will allow to flow more than one mille ampere current through the transistor and the resistor itself in series with it, creating around 2.3 volts across Vce.
Vce = 5 – (2200 * 1mA) = 2.3 V; (almost quiescent voltage)
Since the expected output current Ic is fixed at 1mA, the input current at quiescent state that will produce that output current can be calculated with the help of the relation of the hfe of a transistor with the input and the output currents. The hfe is generally called the current gain and is given by the equation
hfe = Ic / Ib; where Ic is the output collector current and the Ib is the input base current
The hfe of the transistor BC548 has a maximum value of 300, and applying the values of Ic and hfe on to the above equation the Ib can be calculated around 4uA.
The voltage ‘Vb’ across base resistor ‘Rb’ will be the supply voltage minus 0.7 volts for a silicon transistor at quiescent state. Here since the supply voltage is 5V, the Vb can be calculated as 4.3 V. Now since the voltage Vb across the resistor and the current Ib flowing through the resistor is known, the required value of the resistor can be calculated using the ohms law;
Rb = 4.3 V / 4.3 uA = 1M
A 0.1uF capacitor is commonly used to couple the audio signals from the microphone to the amplifier circuit and also in between the amplifier stages. Here since the audio signal is coupled to the ADC channel of the GR SAKURA no coupling capacitor is used at the output stage. If a capacitor is used it will couple out the amplified signal which will be having both positive and negative half cycles, but the ADC of the microcontroller can convert the positive values only.

 GR Sakura and Loudspeaker Driver

      2)      GR SAKURA
The voltage at the ADC channel or the analog input of the GR SAKURA will be the sum of quiescent voltage of the transistor amplifier + amplified voice signals. The quiescent voltage is subtracted from the total voltage to get the voice signal. The GR SAKURA samples the voice signals at a sampling frequency of 20 KHz. Sampling the voice signals at 20 KHz means it converts the analog signal at the analog input pin to digital value and reads the value at every 50 micro seconds.
The TIMER 0 of the GR SAKURA is used to generate exact time intervals of 50 us at which the voice signals needs to be sampled. At the same time interval the same voice sampled value is used to modify the ON period and the OFF period of the timer in such a way that the entire sampling period is always constant. At every ON time the digital output pin where the loudspeaker is connected is turned on and at every OFF period it is turned off.
Thus the digital output pin of the GR SAKURA has a digital waveform of which the ON period and OFF period varies according to the amplitude of the input voice signals but keeping the entire (ON + OFF) period constant as the sampling period. This is nothing but a PWM equivalent of the input voice signal at that digital output pin. When this PWM wave is applied to the loudspeaker it will produce the same sound which is captured through the microphone, but which more loudness.
The code written for this uses the functions like digitalWrite()and analogRead()to write digital values to a digital output pin and read the analog input values from an analog input pin respectively. The files “intvect.c”of the Cloud Compiler IDE is modified to enable the TIMER0 interrupt.

 

      3)      LOUDSPEAKER DRIVER
The Loudspeaker used to reproduce the sound signals in this project is an 8 ohm loudspeaker. The 8 ohm loudspeaker consumes lot of current while it operates but the current sourcing capabilities of the digital output pin of the microcontrollers are limited. Here the output pin is connected to the base of a transistor and the Loudspeaker is connected to the collector of a transistor. Very low base current is required to drive the loudspeaker at the collector of the transistor with the required amount of current.
Circuit Diagram of Loud Speaker Driver
Fig. 3: Circuit Diagram of Loud Speaker Driver
The supply voltage is taken from the GR SAKURA board itself operating with USB power. To get the +5V from the 5 volt VCC pin of the SAKURA board, the jumper J2 is shorted.

 

 

Circuit Diagram

 

Circuit Diagram of GR Sakura based Voice Sampler

Fig. 4: Circuit Diagram of GR Sakura based Voice Sampler

Prototype of GR Sakura based Voice Sampler

Fig. 5: Prototype of GR Sakura based Voice Sampler

 

Project Datasheet

https://www.engineersgarage.com/wp-content/uploads/2019/10/code.zip


Project Video


Filed Under: Electronic Projects
Tagged With: GR Sakura, pwm
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Safe Current and Power Density Limits in PCB Copper(in A/m² and W/m³) simulation
  • The Analog Gods Hate Me
  • Help with hall effect sensors for a milwuakee impact driver
  • How to find the resonance frequency and impedance of a planar spiral coil in HFSS?
  • Diode recovery test Irrm timing.

RSS Electro-Tech-Online.com Discussions

  • Raise your hand if your car had one of these:
  • Simple LED Analog Clock Idea
  • Kawai KDP 80 Electronic Piano Dead
  • Tektronix 2235 channel 1 trace unstable
  • How to make string LEDs?

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • Tria modules integrate edge AI processing with multi-core processors
  • pSemi introduces RF switch with 52 dBm PMAX,PEAK and 90-dBm IIP3 linearity
  • XP Power launches 1.3 kW power supply with 58.9 W/cm³ density
  • How to enable Wi-Fi provisioning in ESP32-based IoT products
  • Amphenol RF introduces FAKRA to SMA adapters with 4 GHz operating frequency

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe