Plot Multiple Line Graphs Using Pandas and Matplotlib

Rishikesh Kumar Rishi
Updated on 01-Jun-2021 11:22:03

4K+ Views

To plot multiple line graphs using Pandas and Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a 2D potentially heterogeneous tabular data using Pandas DataFrame class, where the column are x, y and equation.Get the reshaped dataframe organized by the given index such as x, equation, and y.Use the plot() method to plot the lines.To display the figure, use show() method.Exampleimport pandas as pd from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame([    ["y=x^3", 0, 0],    ["y=x^3", 1, 1], ... Read More

Electrical Components and Their Symbols

Manish Kumar Saini
Updated on 31-May-2021 15:02:39

5K+ Views

Wires and TracesComponent NameSymbolWires or ConductorTrace Junction or Connected WiresTrace Crossing or Unconnected WiresGroundsComponent NameSymbolGround or EarthSignal GroundChassis GroundSourcesComponent NameSymbolSingle CellBattery (Combination of cells)Photovoltaic Cell (Solar Cell)Independent or Constant Voltage SourceControlled or Dependent Voltage SourceIndependent or Constant Current SourceControlled or Dependent Current SourceAC voltage SourceResistorsComponent NameSymbolFixed ResistorRheostat (Variable Resistor)PotentiometerThermistor or VaristorCapacitorsComponent NameSymbolNon-polarized CapacitorPolarized CapacitorVariable CapacitorTrimmer CapacitorInductorsComponent NameSymbolAir Cored InductorIron Cored InductorTapped InductorTransformersComponent NameSymbolTransformerCenter Tapped TransformerStep up TransformerStep Down TransformerTransformer with two secondary windingsCurrent TransformerPotential TransformerZero Sequence Current Transformer (ZSCT)DiodesComponent NameSymbolPN Junction DiodeSchottky DiodeZener DiodeLight Emitting Diode (LED)Photo DiodeTunnel DiodeVaricap (Variable Capacitor Diode)Schockley DiodeConstant Current DiodeSilicon Controlled Rectifier (SCR)DiacTransistorsComponent NameSymbolN-channel, Junction ... Read More

Interfacing an Ultrasonic Sensor with Arduino

Yash Sanghvi
Updated on 31-May-2021 15:01:09

4K+ Views

In this tutorial, we will interface the ultrasonic sensor HC-SR04 with the Arduino to get the distance from a surface in centimetres.Circuit DiagramAs you can see, you need to connect the Vcc pin of HC-SR04 to 5V, GND to GND, Trig pin to pin 7 of Arduino Uno, and Echo pin to pin 6 of Arduino. You can actually choose any GPIO instead of pins 7 and 6. You just have to make sure that the definitions in the code are proper.Working of HC-SR04The HC-SR04 emits ultrasonic waves at 40, 000 Hz. In order to make it emit waves, we ... Read More

Read a Specific Bit of a Number with Arduino

Yash Sanghvi
Updated on 31-May-2021 15:00:22

3K+ Views

Each number has a specific binary representation. For example, 8 can be represented as 0b1000, 15 can be represented as 0b1111, and so on. If you wish to read a specific bit of a number, Arduino has an inbuilt method for it.SyntaxbitRead(x, index)where, x is the number whose bits you are reading, index is the bit to read. 0 corresponds to least significant (right-most) bit, and so on.This function returns either 0 or 1 depending on the value of that bit in that number.ExampleThe following example will illustrate the use of this function −void setup() {    // put your setup ... Read More

Interfacing a Speaker with Arduino

Yash Sanghvi
Updated on 31-May-2021 14:59:20

1K+ Views

In this tutorial, we will interface a simple piezo-buzzer with Arduino to create beeping sounds. Such an arrangement can be used in applications like burglar alarms, or water level indicators or such similar projects.Circuit DiagramAs you can see, the circuit diagram is quite straightforward. You need to connect the buzzer’s GND to Arduino’s GND, and the other wire to one GPIO of the Arduino (we have chosen pin 7). You can optionally add a small resistor (~100 Ohm), between the GPIO and the buzzer.Code WalkthroughThe entire code is given below −#define buzzerPin 7               ... Read More

Getting Data from Temperature and Humidity Sensor using Arduino

Yash Sanghvi
Updated on 31-May-2021 14:58:55

610 Views

In this tutorial, we will interface Arduino DHT-22 Temperature and Humidity Sensor and print the obtained temperature and humidity values on the Serial Monitor.Circuit DiagramWhen the DHT-22 is facing you, the first pin from the left, the VCC pin is connected to 5V, the next pin is the DATA pin, and it is connected to pin 2 on Arduino Uno. The third pin is Not Connected. The 4th pin, GND, is connected to GND on Arduino. A 10K resistor is to be connected between the DATA pin and the Vcc pin of DHT22, as you can see in the above ... Read More

Getting Data from Vibration Sensor Using Arduino

Yash Sanghvi
Updated on 31-May-2021 14:49:41

3K+ Views

In this tutorial, we will interface Arduino with the MPU6050 Vibration sensor.Circuit DiagramAs you can see, we connect Vcc to 3.3V, GND to GND, SDA to A4 and SCL to A5. A4 and A5 also serve as SDA and SCL on Arduino Uno.Code WalkthroughThe code is given below −#include const int MPU_ADDR = 0x68; // I2C address of the MPU-6050 int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ; void setup() {    Serial.begin(9600);    Wire.begin();    Wire.beginTransmission(MPU_ADDR);    Wire.write(0x6B); // PWR_MGMT_1 register    Wire.write(0); // set to zero (wakes up the MPU-6050)    Wire.endTransmission(true);    Serial.println("Setup complete"); } ... Read More

Display Data on OLED Screen Using Arduino

Yash Sanghvi
Updated on 31-May-2021 14:49:17

869 Views

In this tutorial, we will interface Arduino with the SSD 1306 OLED Display.Circuit DiagramAs you can see, we connect Vcc to 3.3V, GND to GND, SDA to A4 and SCL to A5. A4 and A5 also serve as SDA and SCL on Arduino Uno.Required LibrariesThe following libraries will be required for interfacing Arduino Uno with the OLED Display −Adafruit SSD1306Adafruit GFXAdafruit BusIO (required by Adafruit GFX)Go to Tools → Manage Libraries, search for these libraries and click Install.ExampleThe code is given below −#include #include #include #define WIDTH 128 // OLED width (pixels) #define HEIGHT 64 // ... Read More

Interfacing GNSS Receiver with Arduino to Get Speed

Yash Sanghvi
Updated on 31-May-2021 14:45:34

239 Views

In this tutorial, we will interface Arduino with a GNSS Receiver and obtain the speed. If possible, you can run this code in a moving vehicle, because otherwise you will get 0 speed if your GNSS receiver is stationary. Any GNSS receiver generally uses UART for communication. We will be using the ublox Neo-6M GNSS module for thisCircuit DiagramAs you can see, we connect Vcc to 5V, GND to GND, RX of the Neo 6M to pin 3 of Arduino Uno, and TX of Neo 6M to pin 4 of Arduino Uno.Required LibrariesTinyGPS library will be required for interfacing Arduino ... Read More

Map a 10-Bit Number to 8-Bit in Arduino

Yash Sanghvi
Updated on 31-May-2021 14:45:03

1K+ Views

Mappings often have to be performed in Arduino for a variety of reasons. One example would be mapping the 10-bit ADC output to 8-bit to save on storage. A 10-bit number would occupy 2-bytes for storage, whereas an 8-bit number would occupy just one byte and still preserve most of the information of the 10-bit number.Arduino has a readymade map() function for achieving this.Syntaxmap(value, fromLow, fromHigh, toLow, toHigh)where, value is the value to be mapped; fromLow and fromHigh are the bounds of the range of the current value; toHigh and toLow are the bounds of the range of the new ... Read More

Advertisements