|
AMB23 IoT Development BoardRealtek
|
x 1 | |
|
Mini Breadboard |
x 1 | |
|
0.1 uF Capacitor (Through Hole) |
x 1 |
|
MicroPython |
DIY Function Generator in 3 Lines Code
Introduction
Make your own programmable Function Generator using only 3 lines of Python code!
Function generator comes really handy when you are testing your circuits, a professional one will cause you a fortune, but you can make by your own to save a lot.
The most commonly used waveforms are Square wave, Sine wave and Triangular wave. In this project, we will create these 3 different waveforms, change their frequency and duty cycle on the fly.
let's watch a short demo together,
Technical Details
Function generator is a very common testing tool in a electronic lab and they may be used as a signal source to test analog circuit or to introduce an error signal into a control loop to verify circuit's performance.
To DIY a function generator, there are 3 challenges,
1. Creating a repetitive signal
2. Configurable frequency of the signal
3. Configurable Waveforms
To overcome challenge 1 and 2, we can use a microcontroller with a PWM signal which is a repetitive square wave with controllable frequency. However, to do it in 3 lines of code, we must rely on the very convenient and powerful MicroPython project. It allows a microcontroller to interpret Python code and change its behaviors on the fly, which is ideal for our case. Here we are using Ameba AMB23 (RTL8722DM) with MicroPython to generate the PWM signal.
Moreover, to overcome challenge 3, we need a little help from a simple circuit, and a bit of math. As demonstrated from below, a square signal actually consist of many high frequncy components.
If we are able to remove those high frequency components, we will be able to create triangualr, sawtooth or even sine waves. Therefore, we need to design some simple Low Pass Filters to pass only the Low frequency components of a signal, here is the design,
As you can see in the picture, there are 4 sets of low pass filter, each consists of a 1K resistor and a 0.1 capacitor, and we can easily draw different waveforms from their output.
The 3 lines of code is shown in video above and in the picture down below,
PS:
To get started with MicroPython on AMB23, check out the link here:
https://www.amebaiot.com/en/ameba-micropython-summary/
DIY Function Generator in 3 Lines Code
- Comments(0)
- Likes(1)
- Engineer Oct 01,2024
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by SimonX
- Minimalist 5G WiFi & BLE microcontroller In my other projects, I have demonstrated the power of the Ameba RTL8720D based IoT microcontroller ...
- DIY Handheld Thermometer with WiFi BackgroundNow is 2022 and we are still combatting COVID and its varients, it's a long battle so we n...
- Machine Vision Trip WIre | Switch App when Motion Detected IntroductionWanna slack off abit but scared to be busted? Here is the all-in-one wireless tripwire t...
- Hand Controlled LED | OpenCV | MicroPython | IoT LED + OpenCV + MicroPython + AMB23 IoT Microcontrollers = Wireless Hand Control LEDLaziness is one o...
- 3D Printed Collapsing Light Saber with RGB LED Let's watch a demo first! ??https://www.youtube.com/shorts/7kb5SGYx1NIBackgroundRecently I got obsse...
- DIY Function Generator in 3 Lines Code IntroductionMake your own programmable Function Generator using only 3 lines of Python code!Function...
- Dual-Band Wi-Fi Toolkit | 2.4 + 5GHz | A powerful Swiss Army Knife for Wi-Fi IntroductionI have previously demonstrated a few other projects such as1) 5G WiFi Scanner2) WiFi Sig...
- BW16 Stamp - Tiny 5GHz WiFi Dev. Board Demo 1:Demo 2:Want the best of 5G WiFi connectivity while still maintain super compact form factor? ...
- The Fuxk Button | Best Desktop Tool for Linux Beginners What is this project about?When you just got started with Linux, there are a lot of commands to lear...
- DIY IoT Terminal Demo VideoIntroductionA dedicated IoT terminal can be really useful sometimes for displaying your Io...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
113 0 0 -
DIY Laser Power Meter with Arduino
163 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
156 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
564 0 3