Posted on — Leave a comment

What are Computer vision libraries?

Computer Vision is a rapidly growing field that deals with enabling machines to interpret, analyze, and understand digital images and videos. Here are some of the top computer vision libraries that can help developers to build powerful computer vision applications.

OpenCV

OpenCV is a widely-used open-source computer vision library that provides developers with a range of tools for image and video analysis, object detection, face recognition, and more. OpenCV is written in C++ and supports multiple programming languages such as Python, Java, and MATLAB.

  • Official website: https://opencv.org/
  • User-friendliness: Easy to use with extensive documentation and tutorials.
  • Community support: Large and active community with frequent updates and contributions.

TensorFlow

TensorFlow is an open-source machine learning framework that includes a range of tools for image recognition, object detection, and classification. TensorFlow supports multiple programming languages, including Python, C++, and Java.

  • Official website: https://www.tensorflow.org/
  • User-friendliness: Easy to use with extensive documentation and tutorials.
  • Community support: Large and active community with frequent updates and contributions.

PyTorch

PyTorch is an open-source machine-learning library that includes a range of tools for image recognition, object detection, and segmentation. PyTorch supports multiple programming languages, including Python, C++, and Java.

  • Official website: https://pytorch.org/
  • User-friendliness: Easy to use with extensive documentation and tutorials.
  • Community support: Large and active community with frequent updates and contributions.

Caffe

Caffe is a deep learning framework that includes tools for image classification, segmentation, and detection. Caffe is written in C++ and supports multiple programming languages such as Python and MATLAB.

  • Official website: http://caffe.berkeleyvision.org/
  • User-friendliness: Moderate difficulty with a learning curve.
  • Community support: Medium-sized community with frequent updates and contributions.

Keras

Keras is an open-source deep-learning library that provides tools for image recognition, object detection, and classification. Keras supports multiple programming languages, including Python and R.

  • Official website: https://keras.io/
  • User-friendliness: Easy to use with extensive documentation and tutorials.
  • Community support: Large and active community with frequent updates and contributions.

scikit-image

scikit-image is a Python library that provides tools for image processing, including filtering, segmentation, and feature extraction.

  • Official website: https://scikit-image.org/
  • User-friendliness: Easy to use with extensive documentation and tutorials.
  • Community support: Large and active community with frequent updates and contributions.

These computer vision libraries offer a wide range of tools and functionalities for developers to work with. Choosing the right library largely depends on the requirements and specific use cases of the project.

Posted on — Leave a comment

Introduction to Numerical Integration using C

Numerical integration plays a crucial role in many applications related to embedded systems, such as control systems, signal processing, and digital filters. However, implementing numerical integration algorithms on embedded systems presents unique challenges due to limited computing resources such as memory, processing power, and clock speed.

To address these challenges, developers must carefully choose numerical integration methods that are well-suited for embedded systems. The choice of method depends on the specific requirements of the problem being solved and the available computing resources.

Some of the most commonly used numerical integration methods in embedded systems include the Trapezoidal Rule, Simpson’s Rule, and the Midpoint Rule. These methods are relatively simple to implement and require minimal memory and processing power, making them well-suited for use in low-power embedded systems.

In addition to these basic methods, more advanced numerical integration methods can also be used in embedded systems with larger amounts of memory and processing power. These methods include Gaussian Quadrature, Monte Carlo Integration, Romberg Integration, Adaptive Quadrature, Runge-Kutta Method, Newton-Cotes Formulas, and Chebyshev Quadrature.

Implementing numerical integration algorithms on embedded systems requires careful consideration of factors such as memory usage, processing power, and clock speed. Developers must also optimize their code to ensure efficient use of available resources and avoid memory leaks, stack overflows, and other common pitfalls.

Despite these challenges, numerical integration remains an essential tool for many applications related to embedded systems. With the right choice of method and careful optimization of code, developers can achieve high accuracy and efficiency in numerical integration calculations on embedded systems.

The Need for Numerical Integration

In many cases, it is not possible to find the exact analytical solution for a definite integral, either due to the complexity of the function or the limits of integration. In such cases, numerical integration provides a useful alternative for approximating the integral by dividing the interval into smaller subintervals, and then computing the area under the curve for each subinterval.

Here’s a list of functions that can solve definite integrals in embedded C:

  • Trapezoidal Rule
  • Simpson’s Rule
  • Gaussian Quadrature
  • Monte Carlo Integration
  • Romberg Integration
  • Adaptive Quadrature
  • Runge-Kutta Method (for solving ODEs)

Each of these methods has its advantages and disadvantages, and the choice of which method to use depends on the specific problem being solved and the available computing resources.

The Trapezoidal Rule and Simpson’s Rule are commonly used in embedded systems with limited RAM. These methods are relatively simple to implement and require minimal memory usage, making them well-suited for use in microcontrollers with limited resources. Additionally, these methods provide reasonably accurate results for many common functions, which further makes them popular choices for numerical integration in embedded systems.

Depending on the availability of RAM, different methods are available.

If the RAM is up to 32K, then integration methods considered, such as:

The Trapezoidal Rule and Simpson’s Rule are commonly used in embedded systems with limited RAM. These methods are relatively simple to implement and require minimal memory usage, making them well-suited for use in microcontrollers with limited resources. Additionally, these methods provide reasonably accurate results for many common functions, which further makes them popular choices for numerical integration in embedded systems.

If the RAM is increased to 60K, then some of the more computationally intensive integration methods can also be considered, such as:

  • Gaussian Quadrature: This method uses a weighted sum of function values at specific points to approximate the integral. It can provide higher accuracy than the Trapezoidal Rule and Simpson’s Rule for certain functions, but requires more memory and computational resources.
  • Monte Carlo Integration: This method uses random sampling to approximate the integral. It can provide accurate results for high-dimensional integrals, but can require a large number of function evaluations to achieve acceptable accuracy.
  • Romberg Integration: This method uses a recursive procedure to improve the accuracy of the Trapezoidal Rule. It can provide higher accuracy than the Trapezoidal Rule and Simpson’s Rule, but requires more memory and computational resources.
  • Adaptive Quadrature: This method adaptively subdivides the integration interval into smaller subintervals to achieve a desired level of accuracy. It can provide accurate results for functions with complex behavior, but can require a large number of function evaluations for high accuracy.

Note that the choice of integration method also depends on the specific requirements of the application and the available computing resources.

With an increased RAM of 512K, there are many numerical integration methods that can be used. Some of the most popular methods include:

  1. Gaussian Quadrature: This method provides high accuracy for a wide range of integrals but requires more memory than the Trapezoidal Rule or Simpson’s Rule.
  2. Monte Carlo Integration: This method involves randomly sampling points within the integration domain and is particularly useful for high-dimensional integrals. However, it requires a larger amount of memory than the Trapezoidal Rule or Simpson’s Rule due to the need to store a large number of random points.
  3. Romberg Integration: This method is a recursive extension of the Trapezoidal Rule and can achieve higher accuracy for a given number of function evaluations. However, it requires more memory to store the intermediate results of each recursive step.
  4. Adaptive Quadrature: This method dynamically adjusts the number of function evaluations based on the local behavior of the integrand, which can lead to higher accuracy for a given number of function evaluations. However, it requires more memory to store the intermediate results of each recursive step.
  5. Runge-Kutta Method: This method is commonly used for solving differential equations but can also be used for numerical integration. It provides higher accuracy than simple integration methods such as Trapezoidal Rule and Simpson’s Rule, but requires more memory to store the intermediate results of each step.
  6. Newton-Cotes Formulas: These are a family of numerical integration formulas that can achieve higher accuracy than simple integration methods. However, they require more memory to store the intermediate results of each step.
  7. Chebyshev Quadrature: This method uses the roots of Chebyshev polynomials to approximate the integral and can achieve high accuracy with fewer function evaluations than other methods. However, it requires more memory to store the coefficients of the Chebyshev polynomials.

Overall, the choice of numerical integration method will depend on the specific requirements of the problem being solved and the available computing resources. With a larger amount of RAM, more memory-intensive methods can be used, which can provide higher accuracy for a given number of function evaluations.

Posted on — Leave a comment

What is turtle.Turtle() in python?

In Python, turtle.Turtle() is a function that creates and returns a new turtle object that can be used to draw graphics on a canvas.

The turtle graphics library in Python provides a simple way to create graphics and animations by allowing you to control a virtual turtle that moves on a canvas. The turtle can be moved around the canvas using commands such as forward(), backward(), left(), right(), etc.

To use the turtle graphics library, you first need to import the turtle module. Then, you can create a new turtle object using the turtle.Turtle() function. For example, the following code creates a new turtle and moves it forward by 100 units:

import turtle

t = turtle.Turtle()
t.forward(100)

You can also customize the appearance and behavior of the turtle object by setting various attributes such as its color, size, shape, and speed. For example, the following code creates a red turtle with a size of 5 and a speed of 2:

import turtle

t = turtle.Turtle()
t.color("red")
t.pensize(5)
t.speed(2)
t.forward(100)

Overall, the turtle.Turtle() function is the starting point for creating and controlling turtle objects in the turtle graphics library.

Posted on — Leave a comment

DIY PCB Etching: How to Make Printed Circuit Boards at Home

Materials:

  • Copper clad board
  • Laser printer and paper
  • Ferric chloride
  • Plastic container
  • Gloves
  • Safety glasses
  • Water
  • Sandpaper
  • Steel wool
  • Drill

Tools:

  • Iron
  • Ruler
  • Scissors

Steps:

  1. Design your PCB using PCB design software or draw it on paper.
  2. Print your design using a laser printer on glossy paper. Be sure to print it in reverse so that the toner transfers onto the copper.
  3. Cut the copper board to the appropriate size using a ruler and scissors.
  4. Clean the copper board with sandpaper and steel wool to remove any dirt, dust, or oxidation.
  5. Heat up the iron to a high temperature and place the printed design onto the copper board.
  6. Apply pressure with the iron onto the paper for a few minutes until the toner melts and transfers onto the copper board.
  7. Once cooled, gently peel off the paper.
  8. Place the board into a plastic container filled with ferric chloride solution and let it sit for around 15-20 minutes.
  9. Shake the container occasionally to ensure the solution reaches all parts of the board.
  10. After 15-20 minutes, remove the board from the solution and rinse it with water.
  11. Use a drill to make holes in the board where necessary.
  12. Your PCB is now ready for use.

Note: Be sure to follow proper safety precautions when handling ferric chloride and wear gloves and safety glasses. Additionally, dispose of the ferric chloride solution properly and do not pour it down the drain.

Free software options for making PCB

  1. KiCAD – https://kicad.org/
  2. EasyEDA – https://easyeda.com/
  3. Fritzing – http://fritzing.org/home/
  4. DesignSpark PCB – https://www.rs-online.com/designspark/pcb-software
  5. ExpressPCB – https://www.expresspcb.com/
  6. FreePCB – https://www.freepcb.com/
  7. gEDA – http://www.geda-project.org/
  8. Osmond PCB – https://www.osmondpcb.com/

FAQ

Question: What trace width be achieved at home?
Answer: The achievable trace width at home depends on various factors such as the PCB fabrication process, equipment and materials used, and the skill level of the person performing the etching. Generally, the achievable trace width can range from around 8 mils (0.2 mm) to 20 mils (0.5 mm) with standard home etching methods. However, it is possible to achieve even smaller trace widths with advanced techniques such as photoresist etching, but these methods require more specialized equipment and materials.

Question: Why do you use mil instead of mm?
Answer: Mil is a commonly used unit of measurement in the electronics industry, particularly for specifying trace widths on printed circuit boards. It is equivalent to 1/1000th of an inch, or about 0.0254mm. While millimeters are a more commonly used unit of measurement in many parts of the world, mils are preferred for PCB design because they allow for finer resolution when specifying trace widths and clearances. Additionally, many PCB design tools are optimized for use with mils, making it easier to create and edit PCB designs using this unit of measurement.

Question: What are the common trace width for some common sections of PCB?
Answer: The common trace width for some common sections of PCB is:

  1. Power traces: 20-30 mils or more, depending on the current carrying capacity required.
  2. Signal traces 6-10 mils, depending on the frequency of the signal and the required impedance.
  3. Differential pair traces: 8-12 mils, depending on the required impedance and the tolerances of the PCB manufacturing process.
  4. Through-hole component pins: 20-30 mils, to ensure sufficient copper coverage around the hole and good solder joint strength.
  5. SMD component pads: 12-20 mils, depending on the size of the component and the PCB manufacturer’s recommendations.

Question: Can we draw all the trace with a single trace width?
Answer: It’s possible to use a single trace width for all traces on a PCB, but it’s not always the best approach. Some sections of the PCB may require wider traces to handle higher current or to reduce voltage drop. Other sections may require narrower traces to fit in tight spaces or to reduce signal crosstalk. It’s important to consider the specific requirements of each section of the PCB and adjust the trace widths accordingly. However, for a simple circuit, using a single trace width may be sufficient.

Posted on — Leave a comment

AVR Input Output Port Programming

In AVR microcontroller programming, input/output ports are used to interface with external devices such as sensors, switches, LEDs, motors, and other peripherals. Here’s an example of how to program AVR input/output ports using C language:

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    // Set PORTB as output and PORTC as input
    DDRB = 0xFF;
    DDRC = 0x00;

    while(1)
    {
        // Read the value of PINC3
        if(PINC & (1 << PINC3))
        {
            // If PINC3 is high, turn on LED connected to PB0
            PORTB |= (1 << PB0);
        }
        else
        {
            // If PINC3 is low, turn off LED connected to PB0
            PORTB &= ~(1 << PB0);
        }
    }
}

In this example, we set PORTB as an output port by setting all of its pins to output mode. We set PORTC as an input port by setting all of its pins to input mode. Then, we use a while loop to continuously check the value of PINC3. If PINC3 is high, we turn on an LED connected to PB0 by setting the corresponding bit in PORTB to high. If PINC3 is low, we turn off the LED by setting the corresponding bit in PORTB to low.

Note that the & and | operators are used to manipulate individual bits in the port registers. The << operator is used to shift the binary value of 1 to the left by a certain number of bits to set a particular bit high or low. The ~ operator is used to invert the value of a bit. The util/delay.h library is used to create a delay between each loop iteration.

Posted on — Leave a comment

How to make comments in python

In Python, you can make comments using the hash symbol (#).

Any text that appears after the hash symbol (#) on the same line is considered a comment and is ignored by the Python interpreter.

For example:

# This is a comment
print("Hello, world!")  # This is also a comment

In the above example, the first line is a comment, and it is ignored by the Python interpreter. The second line is a print statement, which will print “Hello, world!” to the console when executed. The third line is another comment, which is also ignored.

You can also use multi-line comments by enclosing them in triple quotes (“”” “””). For example:

"""
This is a multi-line
comment in Python.
"""

print("Hello, world!")

In this example, the first three lines are a multi-line comment, and they are ignored by the Python interpreter. The fourth line is a print statement, which will print “Hello, world!” to the console when executed.

Posted on — Leave a comment

Removed the faulty touch screen from STM32F429I-DISC1

The LCD display on this touchscreen is having issues. It is not responding to touch. And suddenly the display stopped working. So I cut the foam and suddenly the ribbon tore off completely.

As you can see the screen is completely removed.

It now gives access to all the pins that are being used by the LCD.

I am planning to make a VGA controller using this board since the microcontroller has an LTDC (LCD TFT Controller)

Posted on — Leave a comment

TIP3055 NPN BJT

It is a power transistor capable of handling power dissipation up to 90W for a few microseconds(generally less than 300 microseconds). Also, it has a Vceo of 60 V and a collector current of 15A.

TIP3055 is a widely used NPN power transistor that can handle high power and high voltage applications. It has a maximum collector-emitter voltage of 60V and a maximum collector current of 15A, making it ideal for use in power supplies, audio amplifiers, and motor control circuits. TIP3055 is a versatile transistor that can be used in a variety of circuit designs due to its high current gain and fast switching speeds. Its popularity can be attributed to its low cost, high reliability, and ease of use. With its ability to handle high power and voltage, TIP3055 is a go-to component for any circuit designer looking for a reliable power transistor.

It comes in a TO-247 package.
This is handy as it can be mounted to a heat sink with a nut bolt.

Datasheet Links

ST – https://www.st.com/resource/en/datasheet/tip3055.pdf

Onsemi – https://www.onsemi.com/pdf/datasheet/tip3055-d.pdf

Do all the companies that manufacture TIP3055 have exactly the same pinouts?

The TIP3055 transistor has a standardized pinout, which means that all manufacturers of this transistor must follow the same pinout configuration. The pinout configuration for the TIP3055 transistor is as follows:

  • Pin 1: Base
  • Pin 2: Collector
  • Pin 3: Emitter

Therefore, no matter which company manufactures the TIP3055 transistor, the pinout configuration should always be the same, and you can expect the same pinout configuration for TIP3055 transistors from different manufacturers. However, it is always recommended to check the datasheet provided by the manufacturer to confirm the pinout configuration and other specifications before using the transistor in a circuit.