Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Voice Sampling and PWM Reproduction by GR Sakura

By Ajish Alfred

 

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
 

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.

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!


Featured Tutorials

  • PS2 Keyboard To Store Text In SD Card Using Arduino Circuit Setup On Breadboard
    How To Use PS2 Keyboard To Store Text In SD Card Using Arduino- (Part 42/49)
  • Wireless Path Tracking System Using Mouse, XBee And Arduino Circuit Setup On Breadboard
    How To Make A Wireless Path Tracking System Using Mouse, XBee And Arduino- (Part 43/49)
  • How to Make a Wireless Keyboard Using Xbee with Arduino- (Part 44/49)
  • Making Phone Call From GSM Module Using Arduino Circuit Setup On Breadboard
    How to Make Phonecall From GSM Module Using Arduino- (Part 45/49)
  • How to Make a Call using Keyboard, GSM Module and Arduino
    How To Make A Call Using Keyboard, GSM Module And Arduino- (Part 46/49)
  • Receiving SMS Using GSM Module With Arduino Prototype
    How to Receive SMS Using GSM Module with Arduino- (Part 47/49)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Renesas delivers intelligent sensor solutions for IoT applications
  • Microchip Technology releases AVR-IoT Cellular Mini Development Board
  • Qualcomm acquires Cellwize to accelerate 5G adoption and spur infrastructure innovation
  • MediaTek’s chipset offers high-performance option for 5G smartphones
  • Nexperia’s new level translators support legacy and future mobile SIM cards

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • lna+mixer noise figure problem
  • Using LTspice to check Current sense transformer reset?
  • Reference driver for negative/above rail voltages.
  • SMPS topology 24v 10A (prefer simplicity, cost-effective, and high efficiency)
  • Thermal pad

RSS Electro-Tech-Online.com Discussions

  • How is this tester made?
  • undefined reference header file in proteus
  • Capacitor to eliminate speaker hum
  • Identify a circuit.
  • Control Bare LCD With ATmega328p
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 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 | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering