Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • 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 EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

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 feed: EDABOARD.com Discussions. EDABOARD.com Discussions.

  • 2GHz, 5th-order Chebyshev Microstrip Bandpass Filter (FR-4)
  • Ring amplifier help (cadence)
  • Hls4ml and theoretical limits
  • Need Working 6 channel Transmitter and Receiver PCB
  • 1kW induction motor: IGBT vs MOSFET vs Pllel MOSFETs?

RSS feed: Electro-Tech-Online.com Discussions Electro-Tech-Online.com Discussions

  • Schematic help, odd symbol
  • Earth Ground Question
  • Will this solenoid actuator work as intended?
  • NE602/SA602 Bias and Buffer circuit
  • Rotary encoder with push function

Featured Tutorials

VHDL Series (1-24)

  • VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
    VHDL Tutorial 17: Design a JK flip-flop (with preset and clear) using VHDL
  • VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
    VHDL Tutorial 18: Design a T flip-flop (with enable and an active high reset input) using VHDL
  • VHDL Tutorial – 19: Designing a 4-bit binary counter using VHDL
    VHDL Tutorial – 19: Designing a 4-bit binary counter using VHDL
  • VHDL Tutorial – 20: Designing 4-bit binary-to-gray & gray-to-binary code converters
    VHDL Tutorial – 20: Designing 4-bit binary-to-gray & gray-to-binary code converters
  • VHDL Tutorial – 21: Designing an 8-bit, full-adder circuit using VHDL
    VHDL Tutorial – 21: Designing an 8-bit, full-adder circuit using VHDL
  • VHDL Tutorial – 22: Designing a 1-bit & an 8-bit comparator by using VHDL
    VHDL Tutorial – 22: Designing a 1-bit & an 8-bit comparator by using VHDL
More Tutorials >

Recent Articles

  • Stackpole Electronics introduces 6 W thin-film resistors
  • TDK-Lambda adds 12.5 kW three-phase power supplies
  • Signal Hound adds radar pulse generation to VSG systems
  • ITG Electronics adds 300 VAC common mode chokes
  • Morse Micro introduces USB adapters for Wi-Fi HaLow connectivity

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • 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 © 2026 Arrowfly 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 Arrowfly
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertise
  • Subscribe