F(t) generation and SQL recording

3rd example: https://github.com/elc-construction-electronique/Librairie-Python-ALR32XX/blob/main/Exemples/Exemple_3.py

The purpose of this last exemple is to control the supply voltage to the ALR3203 to create any low frequency signal. This signal will be requested point by point from the user and stored in an SQL database.

Adding the library and initializing

As in the previous example, the development libraries are added and the power supply variable is created.

import sys 
import math
import sqlite3
sys.path.insert(0, "..")
from ALR32XX.ALR32XX import*

The sys, math and sqlite3 libraries do not require additional installation.

To complete the initialization of the procedure, we need to declare a variable for our power supply:

X=ALR32XX('ALR3203')

Here, the variable X will be linked to the ALR3203 connected via USB or RS232 to the computer. X therefore inherits functions from the library, for example X.Mesure_tension() to measure the voltage on the power supply channel.

Creation of the database

The program concerning the management of the database will not be detailed. The principle is to create a database with the index, the requested voltage and the time value, to record the number of points desired and to come and ask each point to the user:

Signal creation

The information is stored in two lists which are browsed item by item to create the signal (as in the previous example).

By connecting the output of the power supply to an oscilloscope, the plot can be displayed:

Last updated