7th Order Butterworth Low Pass Filter


The purpose of this blog is to design an own filter with a specific cutoff frequency by choosing one of the filter types among Butterworth, Bessel, Cheby1, and Cheby2, Elliptical filter, and its order with ideal OPAMP. Also, the implementation of the filter is given by Direct Form 1(DF1), DF2, Parallel, and other implementations. The filter characteristics are roughly divided into the Butterworth, Bessel, Cheby1, and Cheby2, Elliptical filter, and each filter has some unique characteristics.

  • Butterworth – The Butterworth filter has no ripple in both the passband and stopband and the frequency response is as flat as possible in the passband. (Maximally flat magnitude filter)
  • Bessel – The filter has amplitude characteristics similar to Butterworth characteristics but is approximated to optimize to obtain better transient response characteristics in the passband. Therefore, the amount of overshoot is small, and the rise speed is the fastest as compared with the filter having the other characteristics of the same order.
  • Cheby1 (Chebyshev) – The Cheby1 filter is a low pass filter with equiripple in the passband. A steep cutoff characteristic can be obtained by allowing ripples.
  • Cheby2 (Inverse Chebyshev) – The Cheby1 filter is a low pass filter with equiripple in the passband. A steep cutoff characteristic can be obtained by allowing ripples.
  • Elliptical – The Cheby1 filter and the Cheby2 filter have a steeper cutoff characteristic than the Butterworth filter by providing equiripples in either the passband or the stopband. On the other hand, the elliptical filter is created based on obtaining steeper cutoff characteristics by generating equiripples in both the passband and stopband.


Implementation of Python

Out of these 5 filter types, I chose 7th order Butterworth low pass filter targeting 10kHz cutoff frequency for this project because the Butterworth filter is easier to implement with no ripples in both the passband and the stopband. The 7th order Butterworth low pass filter has seven filter coefficients in the denominator and a filter coefficient in the numerator. Then, the Python code below can generate these coefficients and its Bode Plot from the obtained transfer function.

When executing the Python code, the ideal Bode Plot will be observed like the image below. As you can see, this simulation of 7th order Butterworth low pass filter in Python has 10kHz cutoff frequency, and the attenuation slope is -140dB/dec.



Implementation using a Behavioral Voltage Source

The following transfer function is generated from the filter coefficients obtained by executing Python.

Then, open the LTSpice and the Bode plot of the 7th order Butterworth low pass filter can be simulated by using an ideal behavioral voltage source based on the coefficients from the transfer function obtained in Python.

When starting to simulate the ideal behavioral voltage source using Laplace Transform function in LTSpice, the Bode plot below was observed.



Implementation using a Direct Form 2

Next, I choose the direct form 2 implementation for the 7th order Butterworth low pass filter out of these implementations. In order to design the 7th order Butterworth lowpass filter by using DF2, there are some resistors that should be determined by each coefficient in the transfer function and the resistance of Rf determined by own. This table represents all values you need for the circuit by DF2.

StageCoefficientsStage GainGain provided by SummerRf (Ω)Ra (N)Gain + side Summer
23.986E+106.283E+0410.09761.0E+059.903E+03Gain - side Summer
42.274E+206.283E+0414.5911.0E+056.854E+03Gain Difference
62.765E+296.283E+044.49391.0E+052.2252E+03R dummy

Also, this is the signal flow graph for the direct form 2 realization of the 7th order Butterworth low pass filter.

Based on the values determined and the realization, the circuit of the 7th order Butterworth low pass filter by DF2 can be finally designed like this!

When observing the voltage output in LTSpice, the Bode plot below was simulated. The magnitude of the 7th order Butterworth low pass filter is pretty close to the magnitude generated by Python implementation and by the ideal behavioral voltage source.



The cutoff frequency and phase change of the 7th order Butterworth low pass filter using ideal OPAMPs generated by Python and by the simulation in LTSpice was matched at 10kHz and -630°. In addition, the attenuation slope was -140dB/dec. It would be more fun if I have simulated my own filter with different orders and different methods of implementation on LTSpice by comparing the ideal Bode plot simulated by Python. See you for the next project!

How to Calibrate a ZED Stereo Camera

All lens have some distortion no matter how big or small, so you should correct for lens distortion by calibrating a camera in terms of software. Especially, this technique is used for robotics and the distortion effects so much while a robot is mapping some obstacles using a camera as their eyes. Today, I am showing how to calibrate a ZED stereo camera for your project.

Environments & Equipments

I assume that you already have these environments and equipment to calibrate a ZED stereo camera. Please go to these links above, and set up correctly.

How to make a catkin workplace for ZED



Open another tab on terminal

For the calibration, I used calibration checkboard (6×4, square size 35mm). When you use another checkboard, you will just change the command after –size and –square.


Do NOT forget the command of

The driver does not support set_camera_info service. Without this command, you might have got this error message after rosrun.

There are active topics while roslaunch zed_wrapper zed.launch

Calibration Result



Configuration of RN52 through Simblee (RFD77101)

Simblee (RFD77101) is one of the best BLE (Bluetooth Low Energy) chip that turns your project into the IoT. Since I have learned how to use the Simblee, I have come up with the idea that I connect Simblee into RN52 (Audio Bluetooth) to make my project more fun. The first step that I needed to do was whether I could do the configuration of RN52 through a Simblee chip, so I will introduce how to configure it by using UART and display the configuration on the Simblee App based on the commands you input.

Normal Configuration

In order to do the normal configuration that you can find in Sparkfun tutorial of RN52, you need to use a FTDI chip with USB to communicate with a serial UART through a USB port.

You are supposed to get the configuration like this (From Sparkfun).

Configuration on Simblee App

However, what if you would like to display the configuration of RN52 on Simblee App through RFD77101, the process will be different. Here is the simple sketch of this project. FTDI chip is connected to RFD77101 using UART (RX is 25 pin & TX is 23 pin as a default), and by connecting RFD77101 and RN52 using GPIO17 & GPIO19 as RX & TX), you could do the serial communication between these chips.

Source Code



This is the UI on Simblee App.

When SMD mode started (GPIO9 pin shorted to GND).

When a command “D” was input in field1. However, I was supposed to get more than 68 bytes (As you can see, when you do the normal configuration on Terminal, the number of characters is more than 68 characters.) I need to study more about how to use a buffer, and fix this problem.

When a command that does not exist was input.

There are a lot of available commands that you can see. This project succeeded! Thanks.


Multiple LiPo Batteries Charger with a micro USB connector

After I received the acceptance of Maker Faire Bay Area 2018, I had to prepare a multiple lipo batteries charger because in Maker Faire Bay Area 2017, I had five lipo batteries and a lipo battery charger with a micro USB connector, but lipo batteries were dead faster than I expected, and only one lipo battery charger could not cover all dying lipo batteries. Therefore, I decided to make my own lipo charger rather than buying one.


These are the parts that I used for a PCB. The total cost for a multiple lipo batteries charger with a micro USB connector was only $11, so it must be cheaper than other products you can buy in online store.


This is the schematic that I designed. It was based on the Sparkfun lipo battery charger, but it could become multiple lipo batteries charger by connecting a micro USB and IC chips for lipo charge management control as a parallel circuit. When I tested how much voltage was supplied to each branch by a multimeter before I soldered all parts, around 5v was supplied from a micro USB connector, so it theoretically worked!


This is the PCB layout that I designed.


In this test, I wanted to check if LEDs were correctly turned off when one of these lipo batteries or all lipo batteries were fully charged. Initially, all lipo batteries were not charged.

After a couple of hours, all batteries were fully charged, and LEDs were also turned off correctly!!!

This project was completed!

Arduino Nano + RN52 + TPA2016D2 Experiment

It has been over a year since I have been working on the audio things. The previous experiment, I used an amplifier called TPA2016 which can amplify an audio data from a 3.5mm headphone wire connecting a phone. However, I really wanted it to be a wireless which can send the audio data, and I finally found the one called “RN52” which is an audio bluetooth module.

RN52 Test

In the Fritzing image above, I did an initial test with this RN52 module and an 8Ω speaker ( 16Ω speaker should have been used according to the data sheet, but it is actually not big deal.) with an Arduino Nano for UART communication and as a voltage supplier from my computer which is 5V. The initial test worked perfectly and I heard sounds, but there were some problems.

  1. The sounds were NOT really amplified.
  2. It could not control a gain from your Phone.

In order to solve these problems, I decided to use an TPA2016 which is the stereo class D amplifier with a gain control. By using the amplifier, I could amplify the audio sounds to around 30 dB, and I could control the gain from my phone which means I could adjust the sound volume in my phone. The TPA2016 module could solve these problems once.

Here is the new Fritzing image.

Fortunately, RN52 had 4 pins audio outputs and TPA2016 had 4 pins audio inputs, thus by connecting between these modules, the audio data coming from RN52 as outputs is going into the TPA2016 as inputs. In this video, I am showing how to connect the Bluetooth module and your phone, and how it works.