Found 381 Articles for Hardware

Fast Fourier Transform (FFT) on Arduino

Yash Sanghvi
Updated on 26-Jul-2021 11:41:01

12K+ Views

There are several libraries available which help you calculate the Fast Fourier Transform (FFT) onboard the Arduino. We will look at the arduinoFFT library. This library can be installed via the Library Manager (search for arduinoFFT).Once installed, go to: File→Examples→arduinoFFT and open the FFT_01 example.ExampleThis example first creates a sinusoidal wave with the frequency of 1000Hz (sampled at 5000Hz). It then windows this using a Hamming function. Later it computes the FFT, determines the frequency with the highest magnitude, and returns it as the fundamental frequency. If that value is close to 1000 Hz, this code works.Let's begin the code ... Read More

Gaussian Library Arduino

Yash Sanghvi
Updated on 26-Jul-2021 11:33:08

1K+ Views

The Gaussian Library by Ivan Seidel helps you implement Gaussian math, Kalman filters and moving averages in Arduino.To download this library, go to the Library Manager and search for 'Gaussian'. Install the library by Ivan Seidel.Once installed, go to: File → Examples → Gaussian, and open the GaussianRandomPlot example.ExampleNow, this example will seem overwhelming at first. Therefore, what I'll suggest is first running this example on your Arduino, and seeing the Serial Monitor output. I'll show it here.In summary, this code generates 20, 000 random Gaussian numbers, i.e., the numbers follow the Gaussian bell-curve distribution, and segregates them in different ... Read More

LinkedList in Arduino

Yash Sanghvi
Updated on 26-Jul-2021 11:26:29

2K+ Views

The LinkedList library by Ivan Seidel helps implement this data structure in Arduino. A linked list contains a set of nodes wherein each node contains some data, and a link (reference) to the next node in the list.To install this library, go to Library Manager, and search for LinkedList.Once installed, go to: File→ Examples→LinkedList and open the SimpleIntegerList example.Much of the code is self-explanatory. We include the library and create the object, specifying integer as the data type.#include LinkedList myList = LinkedList();Within setup, we populate the list with some integers, using the .add() function.void setup() {    Serial.begin(9600);   ... Read More

Getting help on Arduino Forum

Yash Sanghvi
Updated on 26-Jul-2021 11:22:37

758 Views

Often, you are stuck on somewhere and don't find any relevant help from a Google search. In such cases, you can post your question on the Arduino Forum and ask for help from the vast Arduino community out there. Please make sure that you are not posting any duplicate topics. It is good practice to first check that no topic similar to yours is already present.In order to get help on the Arduino Forum, first sign up for an account on https://forum.arduino.cc/.Once you log in, you will see this screen −Click "New Topic". The following window will open up.You need ... Read More

How to obtain the free RAM in Arduino?

Yash Sanghvi
Updated on 26-Jul-2021 11:20:46

3K+ Views

The Arduino-MemoryFree library can be used to obtain the free RAM within your Arduino. In order to use this library, install it first. The instructions to install a third-party library in Arduino are given here: https://www.tutorialspoint.com/using-a-third-party-library-in-arduinoOnce installed, go to: Files → Examples → Arduino-MemoryFree.ExampleAs you can see the BareMinimum example lives up to its name. It is very short indeed.#include ; #include ; // not needed for new way. but good to have for reference. void setup() {    // put your setup code here, to run once:    Serial.begin(115200);    // forced to be compiled into and ... Read More

Cron Jobs in Arduino

Yash Sanghvi
Updated on 26-Jul-2021 11:17:13

2K+ Views

The CronAlarms library in Arduino helps you set cron jobs in Arduino. If you aren't aware of cron jobs, they are scheduled tasks to be carried out at a fixed time interval. An example can be sending a health packet to a server every day at midnight.In order to install this library, search for CronAlarms in the Library Manager and install the library by Martin Laclaustra.Once installed, go to - File → Examples → CronAlarms.Open CronAlarms_example. If you go through the example, you will see that they are doing the following −Set the time to Saturday 8:29:00am Jan 1 2011, using ... Read More

ArduinoJSON: Filtering Data

Yash Sanghvi
Updated on 26-Jul-2021 11:06:53

882 Views

The ArduinoJSON library, as the name suggests, helps you work with JSON objects on Arduino. In order to install it, go to the Library Manager and search for ArduinoJSON. Install the library by Benoit Blanchon.This is one of the very heavily documented libraries. In fact, it has its own website − https://arduinojson.org/. You can find answers to several questions on this website.In this article, we will look at how to filter data from a larger JSON and produce a smaller JSON.Once you download the ArduinoJSON library, go to: File→Examples→ArduinoJSONExampleThe example we should look at is the JsonFilterExample. The code is ... Read More

ArduinoJSON: Working with Flash Strings

Yash Sanghvi
Updated on 26-Jul-2021 10:25:29

229 Views

The syntax for deserialization is as follows −deserializeJson(doc, json)where doc is the JSON Document in which you will store the deserialized output, and json is the buffer containing the JSON contents.The good news is that the buffer can be taken directly from the PROGMEM. In other words, if you don't want to store a heavy JSON string into the RAM, you can store it into the program memory or the flash, using the F() macro, and the deserialization will work just fine.ExampleFor example, the following snippet works perfectly fine.StaticJsonDocument doc; DeserializationError error = deserializeJson(doc, F("{\"name\":\"Yash\", \"designation\":\"student\"}") );You can now go ... Read More

ArduinoJSON: Memory Allocation

Yash Sanghvi
Updated on 26-Jul-2021 10:22:28

1K+ Views

You can declare two types of JSON Documents with the ArduinoJson library - StaticJsonDocument and DynamicJsonDocument. Both need the capacity (in bytes) to be specified at the time of declaration.For static docs, the declaration syntax is −StaticJsonDocument doc_name;For example −StaticJsonDocument myDoc;For dynamic docs, the declaration syntax is −DynamicJsonDocument doc_name(capacity);For example, DynamicJsonDocument myDoc(4096); The difference between the two is that static doc allocates memory on the stack. Therefore, it doesn't need to call malloc() and free(), and is therefore faster.Dynamic docs allocate memory in the heap, and therefore, is slightly slower and should be used for larger JSONs, which don't fit in ... Read More

ArduinoJSON: Serialize and Deserialize

Yash Sanghvi
Updated on 26-Jul-2021 10:20:48

7K+ Views

The ArduinoJSON library, as the name suggests, helps you work with JSON objects on Arduino. In order to install it, go to the Library Manager, and search for ArduinoJSON. Install the library by Benoit Blanchon.This is one of the very heavily documented libraries. In fact, it has its own website: https://arduinojson.org/. You can find answers to several questions on this website.In this article, we will look at Serialization (generating a JSON document), and deserialization (parsing a JSON document) using this library.SerializationLet's start with Serialization. It is pretty straightforward. And if you've worked with python, the code will look all the ... Read More

Advertisements