Arduino – Linux Hint https://linuxhint.com Exploring and Master Linux Ecosystem Tue, 09 Mar 2021 05:50:19 +0000 en-US hourly 1 https://wordpress.org/?v=5.6.2 Arduino With Python Tutorial for Beginners https://linuxhint.com/arduino-with-python-beginners-tutorial/ Sun, 07 Mar 2021 22:09:25 +0000 https://linuxhint.com/?p=93184

When you have started playing with Arduino boards, the standard programming language is provided by Arduino. This language is extremely useful for getting started and can even be used for real use. People who have used it for a while, though, notice a few limitations. You might also be used to programming in Python already. For this reason, developers have invented Micropython.

With Micropython, you have all the basics of Python, with limitations due to the hardware you are finally running it on. This article will not discuss these limitations. Hopefully, you have a clear picture of what a microcontroller can do. Most likely, you will find that it can do much more than you imagined before you started.

Some solutions

There is a multitude of ways you can start programming an Arduino using Python. Before you start, you want to think about whether you are preparing a new Arduino program or want to talk to one. There are several libraries that create new Arduino programs, bypassing the standard programming system that they supply.

You have boards that already run Micropython; you can find these on their respective home pages.

You may want to create a Python program that talks to a standard microcontroller. If you do, you have a few interface libraries for Python. Well-known ones are Micropython and CircuitPython; these are ready distributions for running on special boards. You can compile for other boards if you have the skills.

The mu-editor for micropython

A simple editor to use is a mu-editor. This editor is prepared so that it detects your board on the serial port if you have one. If you do not have one, you can start working with regular Python. To choose, change the mode from the left top corner. The standard Python works, and you can get used to the editor.

This editor has a few IDE features, like code completion, highlighting, and you can start a REPL. These features all work even when connected directly to the board. To install the editor, you can find it in your distribution’s repository.

$ sudo apt install micropython mu-editor mu-editor-doc

These are all the tools you need with a board that already has Micropython on it. One simple code you can try is the common blinking of the LED on the board. To get to the hardware, like an LED, you need to import the library.

from pyb import LED

import time


state=False;


while True:

    time.sleep(0.5)

    if state == False:

        LED(on);

        state=True;

    else:

        LED(off);

        state=False;

Use the code above to try your new board. Note that the ‘pyb’ will vary from board to board, Adafruit uses the machine. Take the time to learn what your boards’ values are from the documentation.

REPL – Read, Evaluate, Print, Loop

When using MicroPython, or any Python, you have a REPL available. This is a great way to test short snippets of code. In this case, you can use it to discover what modules are available. The help() function does a great job of guiding you through the basics of what you have available.

When you run help() without parameters, it gives you a list of options. After that, it is interactive; type in what you need to ask about and guidance on using it.

Use the REPL to find what libraries the board supports. It is a slightly harder learning method, but you get in the habit of using the built-in documentation. To truly learn, you need to take a few tutorials and build something else upon them.

Boards running Micropython

The easiest way to start programming for Arduino using Python is to buy a board ready for it. The boards that exist on the market are impressive and come from many suppliers. The main libraries are CircuitPython and Micropython.

An impressive line of boards come from Adafruit, called Circuit Playground. These boards are round, which is odd. More importantly, they have 10 Neopixels onboard, and that is just the visual part. Several sensors are on the board, also included are two push buttons and a slide switch. The input/output pins are made for using alligator clips while still being available as capacitive touch buttons.

Seedstudio also has a range of boards supporting CircuitPython. These come in a range from very small to very capable. The WiPy 2.0 is a tiny board that is ready to go, though it is useful to get the antenna kit. The board sports a WiFi module for the ESP32, one RGB LED, and a reset switch. You get much less hardware, but the size is 42mm x 20mm x 3.5mm, and you still have many pins on the board.

Simple projects to get you started

After you have made your blink program, you are certain to want to try something harder. Make sure you have something compelling that is challenging but solvable. Here are some suggestions.

Make a program that flashes one light at a steady pace. At the same time, make a button turn on and off another lamp. You will quickly see the limitations of delay()!

Make a MIDI controller.

Make a simple alarm system using an infrared sensor and some NeoPixels.

Conclusion

The best way to get started with MicroPython is to get a decent board that already supports MicroPython or CircuitPython and start trying out your ideas. Since the idea is to control other things, look for a package, or a kit, that contains a few sensors and a display or two.

Happy Hacking.

]]>
HeliOS for Arduino https://linuxhint.com/linux_on_arduino/ Sun, 01 Nov 2020 07:09:26 +0000 https://linuxhint.com/?p=74966 The microcontrollers of an Arduino use a single program to control all the switches, LEDs and other parts of the system. The first program learned by an Arduino user is typically the ‘Blink’ program, which uses the delay function to turn an LED on and off in an even pattern. This simple program can be extended to do many things, but it cannot include multitasking.

For more advanced projects, you need to change values and read data in real time, which is not possible with the standard delay function in Arduino. Therefore, a different solution is needed. Luckily, HeliOS can help.

The Limitations of Arduino

As mentioned in the introduction, the standard language of an Arduino can be applied in many ways. However, there is a problem: the Arduino cannot multitask. For example, you cannot set three different LEDs to blink at independent intervals. This task cannot be carried out because, if you use delay, the LED with the longest delay will block the blinking of the other LEDs while waiting to switch states.

Standard polling is also troublesome, as checking the state of a button requires an action to be taken. In a standard Arduino, you have to setup a function to poll the state of a switch or any other state.

While there are solutions for addressing these issues (e.g., hardware interrupts, the millis function, the FreeRTOS implementation), but these solutions also have limitations. To overcome the issues of these solutions, Mannie Peterson invented HeliOS. HeliOS is small and efficient, and it can even run on 8-bit controllers.

Consider the code below, which is unreliable at best because the delay statement will prevent the button from being checked.

int buttonPin = 2;    // the number of the pushbutton pin
int ledPin =  4;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
       digitalWrite(ledPin, HIGH); // turn LED on
  } else {
        digitalWrite(ledPin, LOW); // turn LED off
  }

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

}

When you run this code you will see that the ‘ledPin’ will blink normally. However, when you push the button, it will not light up, or if it does, it will delay the blink sequence. To make this program work, you can switch to other delay methods; however, HeliOS provides an alternative.

Linux Embedded on Arduino (HeliOS)

Despite the “OS” in its name, HeliOS is not an operating system: it is a library of multitasking functions. However, it does implement 21 function calls that can make simplify complex control tasks. For real-time tasks, the system must handle external information as it is received. To do so, the system must be able to multitask.

Several strategies can be used to handle real-time tasks: event-driven strategies, run-time balanced strategies and task notification strategies. With HeliOS, you can employ any of these strategies with function calls.

Like FreeRTOS, HeliOS enhances the multitasking capabilities of controllers. However, developers who are planning a complex project of critical importance need to use FreeRTOS or something similar because HeliOS is intended for use by enthusiasts and hobbyists who want to explore the power of multitasking.

Installing HeliOS

When using the Arduino libraries, new libraries can be installed with the IDE. For versions 1.3.5 and above, you pick use the Library Manager.


Alternatively, you can download a zip file from the webpage, and use that file to install HeliOS.


Please note that you need to include HeliOS in your code before you can start using it.

Example

The code below can be used to make an LED blink once per second. Although we have added HeliOS code, the final effect is the same as that of the introductory tutorial.

The main difference here is that you must create a task. This task is put into a waiting state, and a timer is set to tell the task when to run. In addition, the loop contains only one statement: xHeliOSLoop(). This loop runs all the code defined in the setup() of the code. When you plan your code, you need to set all pins, constants and functions in the top setting.

#include

//Used to store the state of the LED
volatile int ledState = 0;
volatile int buttonState = 0;
const int buttonPin = 2;
const int ledPin = 4;

// Define a blink task
void taskBlink(xTaskId id_) {
    if (ledState) {
       digitalWrite(LED_BUILTIN, LOW);
       ledState = 0;
       } else {
       digitalWrite(LED_BUILTIN, HIGH);
              ledState = 1;
       }
    }
}

// Define a button read task
void buttonRead(xTaskId id_) {
 buttonState = digitalRead(buttonPin);

 // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
 if (buttonState == HIGH) {
   // turn LED on:
   digitalWrite(ledPin, HIGH);
 } else {
   // turn LED off:
   digitalWrite(ledPin, LOW);
 }
}

void setup() {
 // id keeps track of tasks
 xTaskId id = 0;
 // This initialises the Helios data structures
 xHeliOSSetup();

 pinMode(LED_BUILTIN, OUTPUT);
 pinMode(ledPin, OUTPUT);
 // initialize the pushbutton pin as an input:
 pinMode(buttonPin, INPUT);

 // Add and then make taskBlink wait
 id = xTaskAdd("TASKBLINK", &taskBlink);
 xTaskWait(id);
 // Timer interval for 'id'
 xTaskSetTimer(id, 1000000);

 id = xTaskAdd("BUTTON", &buttonRead);

 xTaskStart(id);
}

void loop(){
//This, and only this, is always in the loop when using Helios
 xHeliosLoop();
}

With this code, you can program the LED to blink at any time without having to worry about the Arduino being delayed.

Conclusion

This project is great for people who are new to Arduino, as it lets you use the regular Arduino code to handle real-time tasks. However, the method described in this article is for hobbyists and researchers only. For more serious projects, other methods are necessary.

]]>
Best Temperature and Humidity Sensor Modules for Arduino https://linuxhint.com/temperature_and_humidity_sensor_modules_for_arduino/ Tue, 27 Oct 2020 15:56:27 +0000 https://linuxhint.com/?p=74189

The sensors are awesome! They let you know what’s happening in the outside world. Temperature and humidity sensors, in particular, are some of the most widely employed instruments in various monitoring applications.The reason is that these are the most critical measurements to get right when you are trying to create safe and energy-efficient environments. That is why they’re extensively used in agriculture, health, biomedical, meteorological, food processing, and pharma industries, to name a few.

In this article, we reviewed the best temperature and humidity sensor modules for Arduino. You can use these sensors in a variety of applications and implement multiple IoT projects in beginner as well as professional settings. As different sensors are manufactured for different applications, we’re not ranking them from best to worst for this write-up.

If you have no idea where to start, take a look at the included buyer’s guide section for help.

So, without further ado. Let’s get right into it!

KeeYees 5pcs DHT11 Temperature Humidity Sensor Module

DHT11 is perhaps the most popular, widely used, and reliable temperature and humidity sensor module for Arduino based projects. It can measure humidity from 20% to 90% RH and temperature from 0 to 50 degrees Celsius.

The best thing about KeeYees DHT11 is that you can operate it with both 3.3 and 5 Volts power. This makes it suitable for connection to not just Arduino, but as well as other standard boards such as Raspberry Pi, RN Control, etc.

Besides operating voltage, you need only one other port to connect to the sensor module. It has a quick response time and comes with an anti-interference ability to reduce noise levels. During our tests, we found that the readings are reasonably accurate. While the first readings aren’t very accurate, the second, third, and subsequent calls showed precise numbers.

That said, the module has a reasonable cost and works best for most DIY projects. However, DHT11 feels somewhat outdated in 2020 for modern IoT applications. That is why we advise IoT professionals to look at other more up to date options mentioned in this article.

Buy Here: Amazon

SMAKN DHT22/AM2302 Digital Temperature and Humidity Sensor

This sensor is a wired version of the DHT22. It’s a basic high-end model of the DHT11, and slightly more expensive. But it has high measurement accuracy and outstanding long term stability. What’s more, it offers a wider temperature and humidity measurement range. In brief, the DHT22 steps in where DHT11 falls short.

It utilizes a capacitive humidity sensor (0 ~ 99.9%RH) and a thermistor (-40 ~ +80℃) to measure the surrounding air. It spits out a digital signal on the data pin with ±2%RH humidity and ±0.5℃ temperature accuracy. Yup, it needs no analog input pins. Therefore this sensor is ideal for monitoring room climate or building a DIY climate station in your backyard.

The module is relatively easy to use. In case you face any problem, the instructional ebook comes in very handy. It has detailed guidelines about how to start and operate this product. However, keep in mind that accurate data reading requires careful timing.

This module’s only downside is sending data every two seconds, which means sensor readings are not real-time, but two seconds old. However, this much delay is acceptable in most hobbyists, as well as some professional settings.

Buy Here: Amazon

KeeYees BME280 Temperature Humidity and Atmospheric Pressure Sensor

The KeeYees BME280s and their I2C interface are excellent little devices for gauging temperature, pressure, and humidity. They’re extremely fast in updating any changes in the environmental conditions. For instance, when you’re going from low humidity to high humidity, it instantly detects the difference. No waiting for slow sensors anymore! The package includes three pieces of the digital sensor module.

The LDO regulator offers great help in a mixed 5v and 3.3v environment. Its temperature humidity and operational pressure ranges are -40 to +85°C, 0-100%, and 300-1100 hPa, respectively, with +-1°C, +-3%, and +-1Pa accuracy.

The BME280’s online library has some great examples to play around with, but formatting them to work on an LCD screen is tough. Still, the precision and variety of measurements are totally worth the shot.

Overall, the BME280s is a great winter project to spend a couple of hours on. Its humidity and pressure readings are fairly accurate, but the temperature is slightly off. It works like a charm with Arduino based projects and ideal for RF24 and Wi-Fi sensor nodes.

Buy Here: Amazon

Gowoops 2 pcs DHT22 Temperature Humidity Sensor Module

The Gowoops DHT22 is a mainstay for anyone learning to play with different types of microcontrollers. It is tiny, reliable, and fetches decently accurate readings.

This lovely sensor has ± 2% relative humidity measurements with a range of 0–100% RH and ±0.5 degrees Celsius temperature accuracy at a range of -40 to +80°C. It operates on a DC voltage of 3 to 5.5 volts.

What we love about Gowoops DHT22 sensor is that it comes with an attached board. Hence, it eliminates the need to solder in the pins altogether. All you have to do is just plug it in and make something cool for your project. Moreover, it also comes with a cable to stretch the sensor away from the hardware if you want.

The only problem is that the sensor comes with absolutely no documentation. If you want to write your code Vs, utilize some of the Arduino, or C-libraries available online, be ready for your best detective work.

Buy Here: Amazon

Adafruit (PID 3251) Si7021 Temperature & Humidity Sensor Breakout Board

If you’re tired of DHT11 and DHT22 modules and want highly reliable temperature and humidity measurements for professional projects, then Adafruit Si7021 may be for you.

The measurements range from 0–80% RH for humidity and -10 to +85 °C for temperature. While it has a higher temperature accuracy of ±0.4 °C, humidity accuracy is understandably ± 3%. The sensor is neatly placed on a breakout board with a 3.3 Volts regulator and level shifting. Therefore, you can use it without any problem with 3.3V or 5V power. In addition, the board has a PTFE filter (the white flat thingy on top), which helps keep the sensor nice and clean.

It uses I2C for data transfers. Therefore it can work with a wide range of microcontrollers, not just Arduino. Besides wiring, it becomes fairly easy as you don’t need any resistors. Yes, the pins are a little tricky to get right the first time, and you do have to solder them on, but if a beginner like me can do the soldering part, then so can you.

All in all, the Adafruit Si7021 module is perfect for all of your environmental and ecological sensing projects, whether you’re a beginner or a professional.

Buy Here: Amazon

A Buyer’s Guide to the Best Temperature and Humidity Sensor Modules for Arduino

Temperature and humidity sensor modules have significant performance and price differences. So how do you pick the best module for your project at hand?

Measure Humidity and Temperature Accuracy

Of course, the accuracy of measurement is the most critical aspect of a humidity and temperature sensor. Highly accurate sensors tend to be more costly because precision requires a great deal of care in manufacturing. Usually, this information is written on the package when you purchase the product. But accuracy may vary depending on the environment you subject your sensor modules to. If there’s a lot of interference and the general atmosphere is harsh, then the module’s accuracy will obviously suffer. Still, it’s better to go for a module that offers more precision than one that provides a broader measurement range.

Measure Humidity and Temperature Range

The range of a sensor should be your second consideration. Generally speaking, the broader the range of humidity and temperature a sensor can detect, the higher will be its price. Therefore, select a module that meets your measurement range necessary for the projects. Moreover, except for scientific and meteorological research, you do not need full humidity range (0 to 100% RH) of measurement.

Protection

Most sensor modules are not water-resistant or waterproof. You’ll need to “engineer” some creative ways to keep them dry and away from harm’s way. But keep in mind that you cannot seal them so tight that it interferes with their ability to take samples. Some modules do come in a waterproof version, such as when you need a temperature sensor to measure the temperature of the water or any other liquid. But they’re far and few.

Final Thoughts

That’s all about the best temperature and humidity sensor modules for Arduino. We hope this guide was informative, and you got to learn some useful information. For routine everyday DIY projects, DHT11 will do just fine. Its humidity accuracy of 5 to 95 percent RH satisfies most applications. However, if your project needs higher accuracy, go for DHT22. For harsher environments with strong interference, BME280, PID 3251, or AM2311A are suitable. There are even better temperature and humidity sensors for industrial-grade applications such as AHT20. But they’re not intended for home use. That’s all for this article. Thank you for reading!

]]>
Arduino Programming Projects for Learning https://linuxhint.com/best_beginners_arduino_programming_projects/ Mon, 20 Jul 2020 04:56:35 +0000 https://linuxhint.com/?p=63418 Many people learn much faster when they immediately apply their theoretical skills to solve real problems. If you count yourself among them, and your goal is to learn programming, then you need to check out our selection of Arduino programming projects for learning.

What Is Arduino?

Arduino is an open-source single-board microcontroller that’s loved by makers around the world for its open nature, affordability, and ease of use. You can think of it as a lightweight Raspberry Pi with limited processing power but impressive versatility.

It takes no time to connect an Arduino board (such as the Arduino UNO R3 or the Arduino Nano) to all kinds of sensors, actuators, and lights and program it to do just about anything you want.

If you’ve never programmed an Arduino before, you have absolutely nothing to worry about because getting started with it is very easy. All the projects listed in this article come with source code, so you can get them to work first and figure out how they work second.

Top 15 Arduino Programming Projects for Learning

Now that you know what Arduino, it’s time we list the top 15 best Arduino programming projects for learning. Because we’ve made sure to include something for beginners and more experienced programming users, it doesn’t matter if you’re completely new to programming or already have a few projects under your belt.

1. Blinking LED

Everyone who’s new to Arduino should start with this simple project, which demonstrates how you can get a physical output (a blinking LED in this case) using an Arduino and a few lines of code. The reason this is such a great introductory project for beginners is simple: you already have all the parts you’ll need if you own an Arduino board with a built-in LED.

If you meet this one condition, you can go ahead and plug your Arduino into your computer and start the Arduino Software (IDE). Then, use the code found at the bottom of this page to program the LED to blink. Since the code is well-documented, you should be able to quickly understand how it works and modify it to make the LED blink faster or slower.

2. Thermometer

Okay, so you know how to make an LED blink and feel ready to tackle more complicated projects. Great! We have just the right project for you. With an inexpensive temperature sensor (also called a thermistor), you can turn your Arduino into a thermometer and use the collected temperature data to power future projects or just to keep you informed.

The guys over at Circuit Basics provide very detailed instructions accompanied by clear illustrations and code examples. All you need to do is follow the instructions step by step, and you’ll have your own Arduino-powered thermometer in no time.

3. Light-Following Robot

Believe it or not, but you can build your own Arduino-powered robot even if you’re on a tight budget (especially if you have basic tools and Arduino parts lying around). Once finished, the robot will chase around the brightest light it sees, so you can play with it using a flashlight. You can then improve it by adding additional sensors and tweaking its programming too, for example, avoid walls and other obstacles.

This project, called The Arduino Mothbot, has been featured on Instructables and viewed by over 100,000 people. It’s great for introducing kids to the magic of programming using readily available electronic parts to create something amazing.

4. Robot Arm with Smartphone Control

This is one of those Arduino projects for learning that really shows the true potential of the tiny single-board microcontroller. To complete the lengthy tutorial published on HowToMechatronics, you’ll need a 3D printer, multiple servo motors, and the HC-05 Bluetooth module for controlling the robot arm using your smartphone. 3D printing and coding skills are not required since HowToMechatronics share all 3D models and source code on their site.

The robot arm can be theoretically programmed to perform any complex motion, so you shouldn’t have much trouble impressing your friends by making it write something on a piece of paper or simply wave hello.

5. Buzz Wire Game

This Arduino project takes the classic buzz wire carnival game to the next level by adding an Arduino-powered digital display with status information. The instructions over at MakeUseOf recommend you use a coat hanger to construct the course, but we recommend a piece of thick copper wire instead because you can then make the course however long or intricate you want.

Of course, you could create this game without any programming just by using a 9V battery and buzzer, but learning to program with Arduino is all about having fun, and you can certainly have a lot of fun with this project.

6. Heart Rate and SpO2 Monitor

Why would you buy a fitness tracker when you can create a heart rate monitor capable of measuring your oxygen saturation using Arduino? Besides an Arduino board, you need for this project is the MAX30102 pulse oximetry and heart rate monitor module, some OLED display, and buzzer, although the last two components are optional.

Since you can buy the MAX30102 module for as little as $1.5, the cost of this heart rate and SpO2 monitor certainly beats the cost of off-the-shelf heart rate monitors with oxygen saturation measuring capabilities. Head over to the Arduino Project Hub for detailed instructions on how to put it together.

7. LED Cube

Arduino boards are so affordable that there’s no reason to feel bad about using them for purely decorative projects that serve no practical purpose whatsoever. One such project is this LED cube, which consists of 64 LEDs arranged into a 4x4x4 grid. With the power of your Arduino, you can make the cube come to life and display various cool patterns.

Admittedly, a project of this kind can be somewhat tedious to make since it involves a lot of repetition, but it will hone your soldering skills to perfection. If you don’t have a soldering iron, we highly recommend the Lukcase TS100, which works with any laptop power adaptor and heats up in just a few seconds.

8. Word Clock

This elegant and fully functional Arduino-based word clock was created by Maker Lewis of DIY Machines and published on Electromaker.io. The main component you need to create it, is this 8×8 64 RGB LED display, which is used to illuminate a 3D printed clock face.

If you don’t have a 3D printer and don’t intend to buy one, then you can program a simple digital clock using any standard LCD display for Arduino. This tutorial explains everything in great detail and features a sample code that you can simply copy and paste to make your clockwork.

9. Earthquake Detector

There are many fantastic Arduino programming projects for learning on Instructables, but this earthquake detector is among the most useful ones. If you live in an area with a lot of seismic activity, you can use it to trigger certain emergency procedures, such as shutting down the main water supply to your house or sending a message to your relatives. Alternatively, you can connect it to a portable power source and use it to monitor seismic activity in a remote area and transmit the gathered information online.

Just keep in mind that this earthquake detector doesn’t reflect all the possible acceleration changes for earthquakes in the Richter scale, so don’t assume that it can measure up to professional earthquake detectors costing thousands of dollars because it can’t.

10. RFID Smart Lock

You probably think that building an RFID smart lock has to be complicated and expensive, right? Far from it! Most of this project revolves around the Mifare MFRC522 reader module, which you can get on Amazon for just $10, and the rest is described on MakeUseOf.

Okay, so creating an RFID smart lock isn’t all that complicated, but is it a good idea to attempt something even professional so often can’t get right? Well, that depends on your expectations. If you’re interested in this Arduino programming project for learning because you want to gain some valuable experience, then you should go for it. But if you expect to end up with a truly secure RFID smart lock, we recommend you order one online instead.

11. Vending Machine

If you feel like building something complex and undeniably impressive with Arduino, this Arduino-based vending machine may just be the right project for you. To create it, you obviously need some power tools and basic carpentry skills, in addition to the ability to connect together all electronic parts and write the Arduino code.

The good news is that HowToMechatronics walks you through building your first Arduino-based vending machine step by step and even provides a detailed 3D model of the vending machine that you can use to take all measurements. The person behind this project didn’t use a 3D printer, but that doesn’t mean that you can’t improve upon his design and give your vending machine an even nicer case.

12. Audio Spectrum Visualizer

This project is aimed at audio enthusiasts who would like to improve their programming skills while building something fun. We recommend you use a large LED display so that your spectrum visualizer stands out and illuminates the entire room when you listen to music at night.

A project like this is all about soldering and coding. Mastering the former skill is up to you, but the instructions and code samples published on the Arduino Project Hub can help with the latter. It’s worth noting that you can feed audio to the visualizer not only from your music system but also from any headphone output.

13. Alarm System

 

You don’t need an expensive alarm system to catch an intruder off guard and scare them with a loud sound. All you really need is an Arduino, ultrasonic sensor, and piezo buzzer. The idea is to detect motion using the ultrasonic sensor and then turn on the piezo buzzer to deter any intruder nearby.

To learn more about this project, head over to this site, or just watch the video above. It goes without saying that this simple alarm system is not a substitute for a real security system. That said, if the intruder you’re dealing with is an annoying sibling or the neighbor’s cat, this solution will work great and won’t cost you a lot of money.

14. Flappy Bird Clone

If you’re not interested in building physical contraptions using Arduino and just want to practice your programming skills, why not make a clone of Flappy Bird, the viral mobile game where the player controls a bird, attempting to fly between columns of green pipes without hitting them?

Flappy Bird is such a simple yet fascinating game that there are countless programming tutorials and forum threads dedicated to it, so you shouldn’t have much trouble programming it from scratch even if you’re just a beginner. Besides Flappy Bird, you can also program an Arduino Tic-Tac-Toe game or a portable game of chess.

15. Flamethrower

 

Yes, that’s correct. You can use Arduino to create a flamethrower—and not just any flamethrower… a punch-activated arm flamethrower. Just watch the video above to understand what we mean. This is hands down the coolest Arduino project we’ve ever come across, which is why we decided to end this article with it. It’s true that it’s more about building the actual flamethrower than programming the punch action, but we’re more than happy to make an exception.

If this is your first time building a punch-activated arm flamethrower (of course it is), make sure to read the tutorial posted on the Arduino Project Hub carefully from start to finish so that you don’t make a stupid mistake and burn down your house.

]]>
Best Arduino Starter Kits https://linuxhint.com/best_arduino_starter_kits/ Sun, 19 Apr 2020 11:43:16 +0000 https://linuxhint.com/?p=58547 When you start out with Arduino, you have a vast selection of choices. This may be confusing. To make it easier, start by thinking what you want your first project should do for you. The different packages have more or less components. Motors and servos, sensors and LEDs are usually included but not always.

Arduino is many boards, based on micro controllers from ATmega. Since Arduino is open source, there are also many other manufacturers that do the same. The best way to start is to use a starter kit with the UNO v3 board. There are many others, but this one is easy to get started with and cheap.

What is the Arduino used for?

An Arduino usually takes measurements from sensors and acts on them to take an action elsewhere. A simple idea is to have a light sensor tell the Arduino to turn off unnecessary lamps. In these kits, there is usually enough components to make simple robots and have both switches and sensors.

Arduino Original

The first kit is the official Arduino starter kit. It comes with a breadboard, which makes sense since it is supposed to be for you to learn the basic. To do that, you need to experiment. Soldering is time consuming. A kit that contains a book and servos, a small DC motor, a UNO rev 3. A breadboard, loads of switches and other components. There is no power adaptor included. You are supposed to use your computers USB-port to power it. Many people buy that afterwards, when you want to create your own projects.

Elegoo

This kit has many more components, including keyboards, remotes and even an RFID card and reader. This kit is bigger than the official one. It is not delivered with a paper book. Instead, the documentation and the examples comes on a CD. You can download the newest ones from their web page. They also have bigger kits, and smaller ones. Just in case you have components or plans that do not match the components you need for your project.

Buy Here: Amazon

Miuzei

The Miuzei kit has a similar set of components as the Elegoo, but also includes a water sensor. The keypads and display are good for the price. It has 28 lessons and many cables and breadboards. Note that it also includes a propeller, that they call a fan.

Buy Here: Amazon

RexQualis

The RexQualis kit is the one with the most components out of the box. In this box you have a CD with project descriptions for an infrared controlled stepper motor a soil moisture sensor module and more. The possibilities with this kit is the biggest of them all. It is also decently priced.

Buy Here: Amazon

VKMaker

Here we have a kit that compares favourably to the other kits. The kit has many components. However, the instructions are not up to par. If you know a bit of electronics and Arduino, this is a good kit but you have to figure out much yourself. Community???

Buy Here: Amazon

Sunfounder

Sunfounder has several different starter kits, the one below is for sensor of different kinds. The array of sensors is impressive and can be used for many projects. The documentation is delivered on CD but is also available from their website. You have all you need there. Remember to take the entire ZIP file, code is in separate files and not in the pdf document. Sunfounder also have other kits; The IoT kit, the Smart Home Kit and many robotics kits. On a side note; they have Raspberry kits also.

Buy Here: Amazon

GAR Monster kit

As the name states, this kit is big. It has the same as the others but have added wireless, Bluetooth, WiFi and an Ethernet shield. Packed with that and a multitude of sensors, you need to pay more for the kit. Do make sure you have a lot of energy for projects and experiments. Perhaps build a robot, there are motor drivers added for good measure. This package even includes, the UNO R3, Nano V3 and MEGA 2560.

Buy Here: Amazon

Conclusion

As you can see from list, you have many options. You can go cheap and build up to more advanced stuff and you can focus on specific stuff. You also have the grand kit, where you have all the options in one box. Remember, you will receive a breadboard in these kits. If you do not get one, think again, it makes it so much easier to try things out and experiment. Also, remember to find as much help as you can from both manufacturers and community to get you where you want to go.

]]>
Best Arduino IDEs https://linuxhint.com/best_arduino_ide/ Sat, 18 Apr 2020 17:44:41 +0000 https://linuxhint.com/?p=58473 When you start out with Arduino, the IDE from the creators themselves is a great choice. However, if you are used to any other development environment, you should consider alternatives. The fact is that working with Arduino, you will be programming quite a lot. If you already have a favourite editor or IDE you can, in most cases, continue as usual. All it requires is a plugin.

Top list of Arduino IDEs

Here is a list of the top IDEs that support Arduino and some help getting it to work. In the bottom, you also have some hints how to get a few editors configured for the job.

Platform.io

A great idea is to check out platform.io. They have so many boards, even if you filter on Arduino, you still have a gigantic list. Platform.io is a library and service for anyone wanting to start doing embedded development. Once you have registered, for free, on platform.io, you can start projects with any board in their database. The database contains much more than Arduino, so check it out. The most common work flow when using platform is to create a project from the command line.

$ platform project init –ide <Your IDE> –board <ID>

The board ID is listed in their documentation, you can also list them with :

$ platform boards <platform>

Run it without the platform parameter and you get a list of several thousand boards. Decide which platform you want to use and filter with the parameter. In this case “arduino” is suitable. You also have “atmel” and a few others, when you know what project you are starting, you will know how to filter.

Arduino IDE

Do not turn away from this, the original, before you get started. This package is very capable, there are only a few reasons you might want to use something else; You are accustomed to something else and refuse to try something new. You have an especially challenging project. One of the few, really important, features you do not have in the original IDE is revision control. If you want to put your project under git control, you need to do that separately. One of the good things about Arduino IDE is that it has many examples that you can study, change and play around with. You also have a long list of boards. Some are installed with the IDE, some are listed and downloadable from Arduino or using the Boards manager.

It has no integration for platform.io though.

Netbeans

NetBeans is the big system for development and can handle many different languages, with the correct plugin you can also use it for Arduino projects. You can pick it up from the plugin portal. The plugin is written in JAVA, it is 4 Years old. Any problems, you are probably on your own. It is also available on GitHub – Arduino . Find the nbm file in GitHub, or download the source code. To install, find the file, choose it and click the install button. Now you have support for Arduino and git, or any of the other features that NetBeans supports. As mentioned earlier, plartform.io has support for boards, to start a project, run the below command.

$ pio project init –ide netbeans –board unowifirev2

The command will create projects files and directories that you can use in NetBeans directly. You now have the entire tool suit available for your project.

Eclipse – Plugin

As usual Eclipse have all their plug-ins on their “Marketplace”. You need to choose that from a running instance of Eclipse. You should start with the IDE and then continue with the “Arduino Download Manager” from inside the new “IDE”. You can download the Eclipse package and then use the Arduino download manager to handle what boards you are interested in. You also have code snippets available in the market place.

Using the Platform.io to create a project is a great idea here to. The command is the same, with the entire name for the IDE.

$ pio project init –ide eclipse –board uno

This creates the hidden Eclipse project files; .cproject, which points out the libraries you need and other things. It also creates necessary directories.

Atom.io

Yes, this is an editor but with enough plug-ins, it behaves like an entire IDE. Once you have installed atom, you can go to preferences and install the ‘platform-ide’ package. Once you have done this, you have a choice to initialise an Arduino project from inside the editor.

The Platform.io integration makes it a breeze to start and initialise a project. You do not need to install platform.io, while there are also examples installed. Examples that you can add to your project, or start your project with the examples.

Visual Studio

Visual Studio, yes, the one from Microsoft is fairly popular. It has many different plugins, both from Microsoft and other people. The choice is great and you can install just snippets or entire packages for all jobs on Arduino. You do need to have the main Arduino development kit installed to use it fully.

emacs

In emacs, you have a package from ELPA; platformio-Mode, available. For code completion, use the irony-mode package. You create a project the same way, with the platformio command.

$ platformio project init –ide emacs –board uno

The mode has functions, tied with key-chords, that builds, compiles and uploads. You can also choose an external programmer and send files to the external file system.

nvim

For nvim, you have to load many parts. One is the neomake-platformio, the others are an Arduino syntax file, the Bare Arduino project and the files they recommend. This is a complex method which is suitable for you vim enthusiasts that love compiling your own stuff.

Conclusion

When you start out with Arduino, you get a lot of goodies directly from their own website. However, when you get into more advanced territory, you can move to other editors and IDEs. The main advantage is that you can use what you are used to using. The second advantage is that you can do the more advanced stuff that the Arduino IDE hides from beginners.

]]>
Installing Arduino IDE on Debian 10 https://linuxhint.com/install_arduino_ide_debian_10/ Wed, 14 Aug 2019 14:06:53 +0000 https://linuxhint.com/?p=45291 According to the official website of Arduino, “Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.”

In this article, I am going to show you how to install Arduino IDE on Debian 10. So, let’s get started.

Installing Arduino IDE from the Official Debian 10 Repository:

Arduino IDE is available in the official package repository of Debian 10 Buster. So, you can easily install it on your Debian 10 machine using the APT package manager.

First, update the APT package repository cache with the following command:

$ sudo apt update

The APT package repository cache should be updated.

Now, install Arduino IDE with the following command:

$ sudo apt install arduino

Now, press Y and then press <Enter> to continue.

APT package manager will download and install all the required packages.

Arduino IDE should be installed at this point.

Now, you have to add your Debian 10 login user to the dialout group. Otherwise, you will not be able to upload your Arduino codes to the Arduino microcontroller.

To add your Debian 10 login user to the dialout group, run the following command:

$ sudo usermod -aG dialout $(whoami)

Now, restart your Debian 10 machine with the following command:

$ sudo reboot

Once your computer starts, you can find the Arduino IDE in the application menu of Debian 10. Click on the Arduino IDE icon to start it.

Arduino IDE should start as you can see in the screenshot below.

If you go to Help > About Arduino, you can see that the Arduino IDE version is 1.0.5. It is really old.

In the next section, I am going to show you how to install the latest Arduino IDE from the official website of Arduino.

Installing Arduino IDE from the Official Website:

It is easier to get Arduino IDE installed from the official Debian 10 package repository but as the IDE version is very old, it may cause a lot of problems for you. But don’t worry. You can download and install the latest version of Arduino IDE from the official website of Arduino.

First, visit the official Arduino IDE page from your favorite web browser. Now, scroll down a little bit and click on Linux 64 bits link as marked in the screenshot below.

If you want, you can donate to the Arduino project. If you don’t want to donate, just click on JUST DOWNLOAD button as marked in the screenshot below.

Your browser should prompt you to save the Arduino IDE archive. Select Save File and click on OK.

Your browser should start downloading the Arduino IDE archive. It may take a while to complete.

Now, navigate to the ~/Downloads directory with the following command:

$ cd ~/Downloads

You should be able to find the Arduino IDE archive that you’ve just downloaded as you can see in the screenshot below. Remember the archive name.

$ ls -lh

Now, extract the archive in the /opt directory with the following command:

$ sudo tar xvJf arduino-1.8.9-linux64.tar.xz -C /opt

The archive should be extracted to the /opt directory.

A new directory should be created in the /opt directory as you can see in the screenshot below. Remember the directory name.

$ ls -lh /opt

Now, run the following command to create a desktop launcher for Arduino IDE and add a symbolic link of the Arduino executable to the PATH.

$ sudo -E /opt/arduino-1.8.9/install.sh

Arduino IDE desktop launcher/shortcut should be created. You can also access the Arduino executable from the command line.

Now, you have to add the Debian 10 login user to the dialout, tty, uucp and plugdev group. Otherwise, you won’t be able to upload your Arduino code to the Arduino microcontroller.

To add the Debian 10 login user to the dialout group, run the following command:

$ sudo usermod -aG dialout $(whoami)

To add the Debian 10 login user to the tty group, run the following command:

$ sudo usermod -aG tty $(whoami)

To add the Debian 10 login user to the uucp group, run the following command:

$ sudo usermod -aG uucp $(whoami)

To add the Debian 10 login user to the plugdev group, run the following command:

$ sudo usermod -aG plugdev $(whoami)

Now, restart your Debian 10 machine with the following command:

$ sudo reboot

Once your computer starts, you should be able to find Arduino IDE in the Application Menu of Debian 10 as you can see in the screenshot below. Click on it to start the Arduino IDE.

Arduino IDE should start.

As you can see from Help > About Arduino, I am running Arduino IDE 1.8.9. This is the latest version of Arduino IDE at the time of writing.

So, that’s how you install Arduino IDE on Debian 10. Thanks for reading this article.

]]>
Installing Arduino on Debian/Ubuntu https://linuxhint.com/install_arduino_debian_ubuntu/ Sat, 16 Mar 2019 07:14:11 +0000 https://linuxhint.com/?p=37478 Arduino is a hardware open source project based on microcontrollers we can program to automate tasks or interact with the environment among other possible functions. It’s language is C/C++, some examples of Arduino projects can include full automated greenhouses, security systems, drones, robots and a lot more.

if you are not very familiar with Arduino’s potential check this link with a database of Arduino open source projects from which you can take codes or ideas for projects. In this tutorial you’ll see how to setup Arduino on Debian or Ubuntu Linux based distributions. For this tutorial I’m using the Arduino ONE microcontroller but it is useful for other Arduino microcontrollers.

Installing Arduino on Debian/Ubuntu based Linux distributions

To begin plug  in the Arduino USB cable to your computer as shown in the image below

Then as root or with sudo run “apt install arduino
And when asked to install dependencies press Y. You can also run “apt install arduino -y

Run “dmesg | tail” to confirm the card was detected properly. Run” usermod -a -G dialout Username” (where “Username” replace it for your user)

Now run “arduino” and the interface will show up

Select your Arduino device by clicking on Tools>Boards>
In my case I select the Arduino One board, select yours.

Then select your connection port by clicking on Tools > Serial Port

In order to check if your Arduino works properly lets try a blinking script. Open File>Examples> Basics>Blink

Edit the call delay() and upload the changes to your board  by clicking on the verification icon and then the right arrow icon located on the right top of the program, and see how the previous blinking changes. You can select other examples too, check for arduino’s output at the bottom of the program. For more information on similar scripts check https://learn.adafruit.com/introducing-circuit-playground/set-up-test-arduino .

For tutorials on programming for Arduino check this link and this one , you’ll need the proper peripherals like leds, environmental detectors, etc. to carry out your instructions.

I hope this tutorial has helped you to get started with Arduino on Linux. Keep following LinuxHint for more tips and manuals.

]]>