Welcome to the next tutorial of our Raspberry Pi programming course. Our previous tutorial taught us to how to tweet from Raspberry pi. We also discussed some methods used by the tweepy library to perform some API calls in our project. We will learn how to print from a Raspberry pi in this lesson.
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | Raspberry Pi 4 | Amazon | Buy Now |
There are several benefits of having a print server. Print servers may link numerous computers to one or multiple printers, either physically or wirelessly, allowing you to access the printer with various devices and send print instructions from all the other connected computers.
It is not easy to print from an Android smartphone to a cabled printer; however, a printer server makes it simple. A print server is useful in small workplaces where employees may print from any business printer. Another benefit is that we do not need to install drivers and software for the printer on your devices.
The Common Unix Printing System is a printing tool for machines running UNIX-like operating systems. It enables the machine installed to function as a printer server. A CUPS-enabled computer may take tasks from numerous devices, process them, and send them to the right printer for printing.
With our Raspberry terminal, we will configure the typical Unix printing system.
We need to ensure that our Pi runs the most recent software; thus, we will carry out the following command in the terminal.
Once the installation is finished, we will restart our raspberry pi.
A few system changes are required before utilizing the Pi as a "server" on the network. We must configure the dynamic host configuration protocol client to use a static Ip; otherwise, the DHCP client may choose any accessible network address, making it difficult to access the RPi over the network.
We begin by modifying the DHCP configuration file.
If you choose to create a static Ip for the wired connection or a Wi-Fi connection, add either one of the below.
Save your file by pressing Ctrl Plus X, then Yes, finally Enter key. Lastly, restart your Raspberry Pi.
Note that your network setup may differ in address category and Ip. This step must be done carefully; otherwise, your Pi will experience connection troubles. Run the following commands and look at the inet and subnet mask numbers to know what IP address you'll need:
The next step is to set up CUPS. This will take some time, but it will install with other requirements such as Samba, Perl, and several other tools or packages.
We have to make adjustments to CUPs' config file. The following commands can be used to edit the configuration file:
To the config file, add the following. We will be able to communicate with CUPS panels due to these modifications.
If you wish to change the Ip port, locate and modify this line.
In addition, if we want to use the CUPS Interface, you must accept requests coming from that domain. Just before <location> tags, we add these lines.
Save your file by pressing Ctrl + X, then Yes, accompanied by the Enter key.
The Raspberry user is then added to the lpadmin group. This allows the RPi to conduct CUPS administration duties without being a superuser.
We must guarantee that CUPS is available throughout the network.
Lastly, reboot CUPS to apply the modifications.
Samba is an industry-standard Microsoft interoperable package for Unix systems. It allows our Windows operating system to connect to our CUPS central server on the Raspberry Pi and transmit print instructions from the Windows system.
We have to change Samba's settings in the config file before we can proceed with the setup:
Scroll down to the print area and alter the guest's ok to yes.
Scroll down to the printer driver area and change the line shown below
Save the script by pressing Ctrl Plus X, then Yes, accompanied by the Enter key.
Lastly, reboot Samba to see the modifications take effect:
You may need to install printer drivers. You can look for the instructions for your specific printer brand on the internet, but we'll be using an HP printer for this lesson.
Install the following GUI if desired:
Then run the command below and download the displayed package from HP.
Link your computer to the network your Raspberry is in. Open the internet browser and navigate to the CUPS site by providing your Pi IP followed by port ":631," to which CUPS is connecting. If the internet browser displays the message "Connection not secure," select "Proceed Anyway."
You may find your Pi IP by running hostname -I on your Pi terminal. If all goes well, the website is:
Navigate to the Admin page and choose Add Printer. Ascertain that you turn the printer on and hook it to the Raspberry through USB. Follow the on-screen instructions to set up the printer. Check the "share this printer" checkbox before proceeding to the last stage. Lastly, print a sample page on the Printers tab to ensure that everything is working correctly.
Please remember that the printer might not be shown under "Local Printers." If this is the situation, you must configure the necessary printer drivers in your Raspberry Pi.
The last step is to transmit print instructions using any connected devices. After that, you can print wirelessly from Linux, Microsoft, Macintosh, Android, and apple. There is no need to install additional printer drivers for this.
This is the final and most straightforward step, in which we will wirelessly communicate print instructions to our printer. You must have CUPS installed on your Raspberry and print a sample page using the CUPS Web-based interface. Any gadget you would like to print from must be on the Pi network.
You must have Samba installed and set up on your Pi for this to function.
Navigate to Settings and select "Add a printer or scanner." This will automatically detect the network printer, and you may add it by clicking "Add Device."
Select "The printer that I want isn't displayed if it doesn't work."
The queue name, in this case, is like the printer's queue name in the Printers tab of the CUPS web-based interface.
You may add a wireless printer to a Linux desktop by going to GNOME Preferences- Devices and Printers. The procedure would be relatively similar in other Linux distributions.
The wireless printer will be discovered and added automatically. If that doesn't work, you might need to add the printers by entering the Ip of the Raspberry Pi.
At the bottom, press the Plus button. The printer will be detected automatically by Mac. Select and then click Add.
The system includes a Print Function in Android. For previous versions, you must install the CUPS Print plugin. Then go to Settings -Devices Connected -Connectivity- Preference Printing and activate the CUPS Printing plugin. You may start the Print Capability in Oreo and later versions.
For printing a paper or file, open the files in a printing-compatible app. Go to Options Print, choose your printer, and press the print button.
There was an issue that occurred after installing a printer. The printer only printed a few jobs and ignored the rest. I had to reboot either the Raspberry Pi or the printers to resume printing. The command below resolved this issue:
If you haven't yet experienced the pleasures of wireless connection printing, this project is a great place to start. But what's the point of wireless printing?
Wireless connected printers enable users to work effectively on the go because there are no cables attaching the printer to a particular spot. This may be useful in various industries, from retail, where sales associates can construct more checkout stations during busy periods, to logistics, where haulage carriers must track the weights of their vehicles.
Organizations with mobile workers, such as health & security inspectors, may profit from wireless communication because employees can print their invoices, records, and results right away – instead of having to go back to their offices.
Instead of struggling to access your business services to download discs, these wireless printers work efficiently. The benefits of a wireless connection are limitless. It allows business employees to produce receipts, examination data, tickets, and labels with a single click and return to their job with minimal interruption.
Wireless printing can also eliminate the requirement for Wi-Fi using iOS and Android technologies, allowing mobile employees, public transportation drivers, and law enforcement officers to print files regardless of their place.
Wi-Fi printers use infrared technologies to connect to other devices and quickly produce high-quality banners, receipts, and bar codes. The printer may increase doctor efficiency while drafting patient information if it is equipped with pre-cut labels and provide major benefits to CSI teams, who can now immediately manufacture evidence tags at crime scenes.
Depending on your company's needs, a single printer can serve various functions. While a shop manager may utilize a mini-printer for everyday receipt production, they could also opt to use the same printers to print tickets for exclusive launch events, therefore, lowering equipment expenses.
Because the printer is small and portable, employees may set it wherever needed. The printers provide excellent space-saving solutions for better printing efficiency and the ability for many users to connect to a single printer to cut the cost of buying extra resources.
These printers are intended to reduce waste, which is very important for conferences and seminars. Workers may print on demand since the printer does not have to be supplied with pre-printed tickets, avoiding the possibility of an unneeded surplus.
Wi-Fi printers are advantageous to small stores, like start-ups or pop-ups, since they are not well-established companies.
With a bit of investment in such a payment service and a portable printer, business owners may accept card payments at gatherings or establish temporary kiosks in existing businesses and cafés.
Despite their small size, Wi-Fi printers have a considerably longer battery storage life that may last weeks or even months on standby. This implies you won't have to pay a high electricity cost, and you won't have to resupply every day.
Wi-Fi printing makes printing more flexible, making it an excellent project for Raspberry Pis. The advantage of this approach is that it is compatible with Microsoft operating system, Macintosh, and other Linux distribution systems.
Decades ago, some individuals stopped sending these cards and letters. But there's nothing quite like receiving a handmade letter from someone. Your printer offers multiple options for printing in various sizes.
You could even use an inkjet printer to print creative design work if you're a creative individual. Because inkjet ink offers a much more accurate and vibrant color representation than laser ink, we recommend utilizing them instead of laser printers.
There is no better method to share professional details with customers than offering them a professional card nowadays. Ordering these cards, on the other hand, is shockingly costly.
Are you preparing a great social event or party? Prepare your paper napkins by printing something unique on them. That's right: you can personalize your napkins with photos, graphics, initials, logos, and other details.
With this capability, you can elevate that special event or family dinner to a whole new level. Furthermore, if you own a modest business that offers personalized napkins, it is really a fantastic option to work from home.
In this tutorial, we learned how to print from Raspberry pi. We also learned some of the benefits of using a wireless printer. However, In the following tutorial, we will learn how to take a screenshot in our Raspberry pi.
Welcome to the next tutorial of our Raspberry Pi programming course. Our previous tutorial taught us to configure our raspberry pi for voice control. We also discussed some methods of reducing vexing noises so that the voice command program understands you. However, in this lesson, we will learn how to tweet from Raspberry pi.
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | Raspberry Pi 4 | Amazon | Buy Now |
Assume you wish to add tweeting into a Raspberry Pi software you're developing. This article will show you how to build a Twitter app, get access privilege tokens, and post a tweet. On our Raspberry Pi, we'll make a simple program that tweets the result of the uptime command. This is a made-up example, but it demonstrates what is needed to tweet from a raspberry pi.
For this session, a repo has been set up. Because we'll be referring to code within the repository, cloning it will be helpful. You could use this program as a reference point for your programs or copy the components you need.
Let's start by installing git with the command below.
We're going to clone the repository into our current working directory now:
After that, change the directory into the repository.
The Twitter Application programming interface requires that all queries use OAuth for authentication. To access the Application programming interface, you must first create the authentication credentials. Four text strings make up these credentials:
If you're a Twitter account, go through the procedures below to get the keys, tokens, and secrets. If you don't have a Twitter account, you'll need to establish one first.
Visit Twitter's developer site to sign up for a new account. You must now select the Twitter subscriber in charge of this account. It's most likely going to be yourself or your company. This is how this page appears:
After that, Twitter asks you questions about whatever you want to utilize the developer's account, as seen below:
You must specify the developer account's username and whether it will be used for commercial or personal purposes.
Apps and not accounts have access to Twitter's authentication credentials. Every tool or program that uses Twitter's API qualifies as an app. To perform API calls, you must first register your application. Navigate to the Twitter applications page and click on the option to create an application to register the app.
The following details regarding your application and its aim must be provided:
Navigate to your Twitter applications page to generate the authentication credentials. This is how the Apps page looks:
The Details button for your app can be found here. After hitting this button, you'll be sent to the following page, on which you can obtain your credentials. You could generate and copy the keys to use in your code by selecting the Keys and Tokens tab:
Save the credentials after you've generated them to use them later in your code.
The following snippet can be used to test the credentials:
Ensure that the "Read, access, and write direct message" is ticked in the "Permissions" section.
Tweepy is a Library for python for utilizing the Twitter API, and it's included in the requirements.txt document, so all you have to do is:
Tweepy is a library that simplifies the Twitter application programming interface. Tweepy is a collection of functions and classes that mirror Twitter models and application programming interfaces, and it handles implementation details discreetly, such as:
If you didn't use Tweepy, you'd have to deal with low-level features like hypertext transfer protocol, data encoding, authorization, and speed limits. This may consume a lot of time and is subject to mistakes. Tweepy allows us to concentrate on the functionalities we wish to implement.
Tweepy can be used to access the Twitter application programming interface features. Let's have a simple example to see what we're talking about.
The example command below will download all of your tweets from your timeline and output each one to the console. Twitter mandates that all requests be authenticated using OAuth. Tweepy makes using OAuth simple for you. We'll need to establish an account for our application to get started. Build a new app, and when it's done, you should get your authentication token and secret. Keep these two with you at all times; you'll need them.
Next, create an instance of OAuthHandler. We enter our user token and secret, which we received in the previous line, into this:
If you're utilizing a callbacks uniform resource locators that need to be given dynamically in a web application, you will pass it in like this:
If the callback uniform resource locator isn't going to change, it's preferable to put it up as static on Twitter when creating your app.
Unlike basic authentication, we must first perform the OAuth "dance" before we can use the API. The steps below must be completed for this:
So, to start the dance, let's get our request token:
This call asks Twitter for a token and then provides the authorization uniform resource locator, to which the user should be redirected to approve us. Simply keeping our OAuthHandler object alive till the user returns is sufficient. In a web app, a callback will be used. As a result, the request token must be saved in the session because it will be required in the callback uniform resource locator request. A fictitious example of saving the request tokens in a session is as follows:
As a result, we can now redirect the visitor to the uniform resource locator returned by our authorization URL() function.
If it is a desktop program (or any other software that doesn't employ callbacks), we'll need to ask for the "verifier code" that Twitter will provide after they have authorized us. This verifying code is sent in the callback query from the Twitter account as a GET query argument in the URL within a web application.
The request token is then exchanged with an access token in the last phase. The access token is the "key" to the Twitter Application programming interface treasure chest. To obtain this token, we must perform the following steps:
It's good to keep the access token on hand if you need it later. It is not necessary to fetch it every time. Because Twitter does not currently expire tokens, they would become invalid only when the user revokes our application's access. Your application determines the location where you store the authentication token. Essentially, you must save two string values: secret and key:
You can save these in a database, a file, or wherever else your data is stored. To re-create an OAuthHandler using this cached access token, follow these steps:
Since we have an access token for our OAuthHandler, we can move on to the following step:
The application programming interface class gives you access to the Twitter RESTful API's entire methods. Each method can take different parameters and provide different results. The API methods are classified into the following groups:
These ways allow you to read mentions, tweets, and retweets on your timeline and any other public user's timeline.
These methods deal with tweet creation, retrieval, and retweeting. Tweepy is used in the following code to produce a tweet with specific text:
The functions in this group may be used to retrieve users using a filtering criterion, extract user data, and show followers for each user so long as the account is public.
This set of routines includes methods for following as well as unfollowing persons, requesting followers for a user, and displaying the profiles a user is following.
Using these methods, you may write and view your profile information. This code sample might be used to change your profile information, for example:
You can designate any twitter message as Liked or delete the Like tag if it has already been added using these API calls.
This collection of methods includes unblocking and blocking members and a list of blocked users. You can view the users you've blocked in the following way:
You may search tweets using these methods using language, text, and other filters. For instance, this code will return the ten latest public tweets in English that contain the term "Python":
This set of tools allows you to generate a list of the most recent developments for any place. Here's how to construct a list of worldwide hot issues, for example:
Streaming enables you to actively monitor tweets in real-time for those that meet particular criteria. This indicates the program waits for the latest tweet to be produced before processing it if no other tweets satisfy the requirements.
You must construct two objects to use streaming:
This is how you do it:
Most of the time, when we call an API method, we'll get a Tweepy class model object back. This will hold Twitter's data, which we can use in our program. The following code, for example, returns a user model:
The following are the model classes:
Let's assume you want to obtain a list of all the tweets that mention you, then like each one and follow the author. This is how we can go about doing it:
Since every tweet object given by the mentioned timeline() belongs to the Statuses class, you can use the following syntax:
Tweet.user property is also a user object. Follow() may add the author of that tweet to the list of individuals to follow. Using Tweepy models allows us to write concise and understandable code.
Maybe we can put a motion detector and a camera on our cat and tweet images of it. Alternatively, we could set up a temperature sensor and tweet some weather-appropriate status updates. We can also leave the repository unchanged and tweet the uptime command if we only want others to know our pi's load average.
You may take the Twitter presence to another level by creating your personal Twitter bots. You may use bots to automate content generation and other Twitter tasks. This may save time and provide a better user experience for your viewers. The Tweepy library hides numerous low-level Twitter application programming interface details, allowing you to concentrate on the logic behind your Twitter bots.
In this tutorial, we learned how to set up our tweeter app on our Raspberry pi. We also learned how to generate access tokens, set up our app's permissions, and send a tweet. However, In the following tutorial, we will learn how to print on a Raspberry pi.
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | Breadboard | Amazon | Buy Now | |
2 | DC Motor | Amazon | Buy Now | |
3 | Jumper Wires | Amazon | Buy Now | |
4 | Raspberry Pi 4 | Amazon | Buy Now |
Like the Amazon Echo, voice-activated gadgets are becoming increasingly popular, but you can also construct your own with a Raspberry, a cheap USB mic, and some appropriate software. Simply speaking to your Raspberry Pi will allow you to search YouTube, view websites, activate applications, and even answer inquiries.
Because the Raspberry Pi lacks a soundcard or audio port, this project requires a USB microphone or a camera with a built-in microphone. If your mic only has an audio jack, look for an affordable USB soundcard that connects to a USB port on one side and has a headphone and mic output on the other.
For the Raspberry Pi, there are various speech recognition programs. We're utilizing Steve Hickson's Pi AUI Toolkit for this project since it is powerful and straightforward to set up and operate. You may install a variety of programs using the Pi AUI Suite. The first question is whether or not the dependencies should be installed. These are the files that the Raspberry Pi requires to work with voice commands, so pick Yes, then press Enter to agree.
Following that, you'll be asked if you wish to download the PlayVideo software, which allows you to open and play video content using voice commands. If you select Y, you'll be prompted to enter the location of your media files, such as /home/pi/Videos. It's worth noting the upper-case letters are crucial in this scenario. The application will tell you if the route is incorrect.
Next, you'll be asked if you wish to download the Downloader application, which explores the internet for files and downloads them for you automatically. If you select Yes, you will be prompted to enter an address, port, password, and username. If you're not sure, press Return to choose the default settings in each scenario for now.
Install the Google Texts to Speech Service if you require your raspberry pi to read the contents of the text files. Since it communicates to Google servers to translate text into speech, the Raspberry Pi must be hooked up to the internet to utilize this service.
You'll require a google user account to install this. The installation requests your username—press Return after completing this step. The Google password is then requested. Return to the previous page and type this.
You may also use the installer to download Google Voice Commands. This makes use of Google's speech-to-text technology. To proceed, you must enter your Google login and password once again.
Regardless of whether you choose Google-specific software or not, the program will ask if you wish to download the YouTube scripts. These technologies allow you to say something like "play pi tutorial," An appropriate video clip will be played—press Return after typing a new welcome. You can also enable the silent flag to prevent the Raspberry Pi from responding verbally.
Lastly, the software installs the Voice command, which includes some of the more helpful scripts, such as the ability to deploy your internet browser by simply saying "internet."
Youtube: When you say "YouTube" followed by a title tag, a youtube clip of the first related YouTube clip appears. "I'm feeling lucky" is comparable to "I'm feeling lucky" on google. Say "YouTube" followed by the title of the video you want to watch, for example, "YouTube fluffy kittens."
Internet: Your internet browser is launched when you use the word "internet." Midori is the internet browser for Rpi by default, but you may alter that.
Download: When you say "download," followed by a search query, the Pirate Bay webpage searches for the files in demand. For instance, you can say "Download Into the badlands" to get the most current edition of the movie.
Play: This phrase utilizes the in-built media player to open an audio or video file. For instance, "Play football.mp4" would play the file "football.mp4" from the media directory you chose during setup, like /home/pi/movies.
Show me: When you say "show me," a directory of your choice appears. The command defaults to not going to a valid root directory, so you'll need to modify your configuration so that it points to one. For instance, show me==/Documents.
You'll be asked if you want the Voice command to set things up automatically. If an issue occurs at this point, run the following command to download and install the required software.
After installing the Voice command application, you may want to perform a few basic adjustments to the setup to fine-tune it. Execute the following command from your Raspberry Pi's Terminal or via SSH.
Following that, you'll be asked several yes/no questions. The first question is whether you wish to enable the continuous flag permanently. The Voice command application, in clear English, asks if you would want to listen to your voice commands constantly every time you launch it.
For the time being, choose Yes. After that, you'll be asked if you wish the Voice command application to set the verify flag permanently. If you select Y, the application will expect you to pronounce your keyword (the default setting is "Pi") before responding to requests.
If you like the RPi to monitor continually but not act on all words you say, this is a good option.
The next step asks if you wish to enable the ignore flag permanently. If Voice command receives a command that isn't expressly listed in the config file, it will try to find and launch a program from your installed apps. For example, if you say "leafpad," a notepad tool, the Voice command looks for it and starts it even if you don't tell it to.
This is a functionality that we would not recommend anyone to enable. Because you're using Voice command at the SuperUser level, there's a significant danger that you'll accidentally issue a command to the Raspberry Pi that will harm your files. If you wish to set up other programs to function with the Voice command, you can update the configuration file for each scenario.
The voice command afterward asks if you want to permanently enable the silence flag so that it doesn't respond verbally whenever you talk. As you see fit, select yes or no. After that, you'll be prompted to adjust the default voice recognition timeframe. If Pi is having problems hearing your commands, you should modify this.
If you select Yes, you'll be prompted to enter a number; this is the number of seconds that the Raspberry Pi will listen for a voice command; the default for RPI is 3. The application then allows you to customize your text-to-speech choices. Before you do this, make sure your volume is turned up. The application attempts to speak something and then asks if you heard it.
When the system receives your keyword, it responds with "Yes, sir?" as the default response. To modify this, select Yes in the following prompt, then enter your chosen response, for example, "Yes, ma'am?" Once you're finished, hit the enter key. The program will replay the assigned response to check that you are satisfied with the outcome.
Whenever the program receives an unidentified command, the method is the same as the default response. "Received the wrong command" is set as the default response, but you could still alter it to something more friendly by typing yes, then your desired response, like, "The command is not known."
You now have the option of configuring the voice recognition parameters. This will check to see if you have a suitable mic. The Pi will then ask you if you want it to test your sound threshold using the Voice command.
Check for background sound, then press Yes, then press enter key. It then requests you to say a command to ensure that it is using the correct audio device. Type Yes to have the application automatically select the appropriate audio threshold for your Rpi.
Lastly, the Raspberry Pi will ask if you wish to modify the default voice command term ("Pi"). After that, type Y and your new keyword, then press enter when you're finished.
After that, you'll be requested to say your keyword to acclimate the RPi to your voice. If everything looks good, press Y to finish the setup. Start with the fundamental commands outlined above when using the Voice command software.
Once you've mastered these commands, use the following line of code to exit the application and, if desired, change your config file.
The Raspberry Pi's technology is still a work-in-progress, so not everything you speak may be recognized by the program.
Stay near the mic and talk slowly and clearly to maximize your chances of being heard by the program if you still have difficulties understanding. Launch the terminal or log in through SSH to your Raspberry Pi and type the following command to access your audio settings to change your audio preferences.
Hit the F4 button on the keyboard to select audio input, then the F6 key to exit. Select your input device, the mic with the arrow up or down keys, then press Enter key. To change the mic's volume, push it up using the up-arrow key to maximum (100).
If your device isn't identified at all, it may require more current than a universal serial bus port on a Raspberry Pi can supply. A powered universal serial bus hub is the ideal solution for this.
If you have difficulty connecting after installing the Download application, please ensure that connection to The Pirate Bay site is not limited.
To download the files, you'll also require a BitTorrent application for your RPi, such as transmission. To install this, launch your terminal or access your RPi through SSH and type the following command:
The Transmission homepage has instructions about getting started and utilizing the application. You should always download files that have permission from the copyright holder.
Please remember that whatever you speak and any text documents you provide are transferred to Google servers for translation if you use Google text or speech Commands.
Google maintains that none of this information is kept on its servers. Even if this is the case, any data communicated through the worldwide web can be decrypted by any skilled third party or a hacker. Google, however, encrypts your connection to minimize the risk of this happening.
If you like this voice command tool, you might want the program to launch automatically every time the Rpi is powered on. If this is the case, launch the terminal from your RPi or access it via SSH and execute the command below:
The above command opens the script that controls which programs run whenever your Raspberry Pi is booted. By default, this script is doing nothing. Type the following line of code directly above the one reading exit 0:
To save any changes, use Ctrl+X, enter yes, and press enter key. At this point, you can restart the Raspberry Pi to ensure that it is working.
Launch your Rpi terminal, type the command below, and press enter to see a list of active processes.
Noise from air conditioners and heaters can damage your audio and make it impossible for the program to understand what you're saying. The only other alternative is to turn these systems off during recording unless the entire system is redesigned to be more acoustically friendly. However, upon listening to the audio, it becomes clear and annoying.
Computer hardware cooling fans are also sources of mechanical noise. These can be disabled manually and for a limited period. Besides that, try isolating the disturbance in another space or utilizing an isolation box as an alternative.
We learned how to configure our raspberry pi for voice control. We also looked at a few basic commands used to control the raspberry pi and the software used. However, In the following tutorial, we will learn how to tweet on Raspberry pi.
Hello readers, I hope you all are doing great. In our previous tutorial, we discussed the implementation of LED interfacing and blinking program with Raspberry Pi Pico using MicroPython programming language. So continuing with our previous tutorial, in this tutorial we will learn how to control the LED brightness using PWM (pulse width modulation technique).
As we mentioned above, in our previous tutorial we implemented the LED blinking program with a Raspberry Pi Pico board. Blinking an LED means turning ON and OFF and thus the process involves only two states that are ‘1’ (HIGH) and ‘0’ (LOW). But, sometimes it is required to change the digital output between these two (ON and OFF states) for example changing the LED brightness. PWM or Pulse Width Modulation technique is used to change the brightness of the LED.
Raspberry Pi Pico (RP2040) offers 40 pins which include power supply pins, General Purpose Input Output (GPIOs) pins, ADC, PWM etc. where most of the pins are multifunctional except power supply pins. Almost all the GPIO pins (30 pins) can be used to implement pulse width modulation technology.
Fig. 1 Raspberry Pi Pico Pi-Out
RP2040 offers 16 PWM channels and each channel is independent of another. Means we can set the duty cycle and frequency for one channels without affecting the others. These PWM channels are represented in the form of slices or groups and each slice contains two PWM outputs channel (A/B). There are total 8 slices and hence 16 channels. The pin B from PWM (A/B) can also be used as an input pin for duty cycle and frequency measurement.
The PWM channel provided in RP2040 are of 16 bit resolution which means maximum PWM resolution is 2^16 or ranges between 0 to 65536.
For more information on Raspberry Pi Pico’s PWM channels you can visit the Raspberry Pi organization’s official website: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
Before programming the Raspberry Pi Pico for PWM implementation let’s first understand the concept of Pulse Width Modulation.
Fig. 2 Pulse width modulated signal
Pulse Width Modulation (or PWM) is a modulation technique used for controlling the power delivered to a load or external/peripheral devices without causing any power loss by pulsing the direct current (DC) and varying the ON time of the digital pulse. Using a digital input signal, the Pulse Width Modulation technique produces modulated output signals.
The following factors influence the behaviour of a pulse width modulated signal:
Frequency : Technically, frequency means “number of cycles per second”. When we toggle a digital signal (ON and OFF) at a high frequency, the result is an analog signal with a constant voltage level.
The number of cycles per second defined by a signal's frequency is inversely proportional to the time period. PWM frequency is determined by the clock source. The frequency and resolution of PWM are inversely proportional.
Duty Cycle : It is the ratio of ON time (when the signal is high) to the total time taken to complete the cycle.
Duty Cycle =
Fig. 3 Duty cycle
Resolution: A PWM signal's resolution refers to the number of steps it can take from zero to full power. The resolution of the PWM signal can be changed. For example, the Raspberry Pi Pico module has a 1- 16 bit resolution, which means we can set up to 65536 steps from zero to full power.
Various applications of Pulse Width Modulation technique are:
We have already published tutorials on how to download and install the above-mentioned software components.
Follow the given link for a detailed study of Raspberry Pi Pico: https://www.theengineeringprojects.com/2022/04/getting-started-with-raspberry-pi-pico.html
To program the Raspberry Pi Pico board there are various development environments available (like uPyCraft IDE, Visual Studio Code, Thonny IDE ect.) and multiple programming languages as well.
In this tutorial, we are going to use Thonny IDE to program the Raspberry Pi Pico board.
We have already published a tutorial on installing Thonny IDe for Raspberry Pi Pico Programming. Follow the given link to install the IDE: https://www.theengineeringprojects.com/2022/04/installing-thonny-ide-for-raspberry-pi-pico-programming.html
Fig. 4 New Project
Fig. 5 Select Interpreter
Image: 6 MicroPython for raspberry Pi Pico programming
Image: 7 Ready to program
In this example code we will implement the pulse width modulation on the digital output pin (GPIO 14). The brightness of the will vary from minimum to maximum brightness back and forth. The maximum possible resolution is 16 bit that is 2^16 (or 0 – 65535). Let’s write and understand the MicroPython program for PWM implementation:
The first task is importing library files necessary for PWM implementation. We are importing two libraries first one is to access the GPIO pins and another one is to implement pulse width modulation techniques. We also need to import ‘time’ library file to add some delay.
Fig. 8 Import libraries
To define the GPIO pin to be used as a PWM pin a ‘PWM()’ function is used which further contains the ‘Pin()’ function that is passing the PWM GPIO (14) pin number.
The PWM function is further represented using a ‘led’ object. If you are not familiar with the PWM pin details like to which slice and channel the pwm pin belongs, you can get the respective details using print(led) function.
Fig. 9 declare object
The led.freq() command is used to set frequency rate at which the digital pulse will be modulated.
Fig. 10 Frequency of modulation
Inside the while loop we are using two for() loops. First one to change the LED brightness from minimum to maximum resolution (‘0’ to ‘65525’ ).
Fig. 11
Another for loop() is used to set the LED brightness from maximum resolution (65535) to ‘0’ (minimum resolution).
The process will be repeated back and forth due to the ‘while()’ loop.
Fig. 12
Fig. 13 Save the program
Fig. 14 Save the program
Fig. 15 Run the saved program
from machine import Pin, PWM
import time
led = PWM(Pin(14))
print(led)
led.freq(1000)
while True:
for duty in range(0, 65535):
led.duty_u16(duty)
print(duty)
time.sleep(0.001)
for duty in range(65535, 1):
led.duty_u16(duty)
print(duty)
time.sleep(0.001)
Let’s interface a peripheral LED with raspberry Pi Pico. As mentioned in the code description the GPIO 14 pin is configured as PWM pin. Connect the LED with raspberry Pi Pico board. The connections of LED with Raspberry Pi Pico board are shown in Table 1.
Table 1
Schematic of LED interfacing with raspberry Pi Pico is shown below:
Image: 16 LED Interfacing with Raspberry Pi Pico
Fig. 17 Brightness level 1
Fig. 18 Brightness level 2
Fig. 19 Brightness level 3
Fig. 20 PWM pin details
Fig. 21
Fig. 22 Plotter
Fig. 23 Rising PWM output 0 to 65535 (brightness increasing)
Fig. 24 PWM output maximum to 0
Now let’s take another example where we will interface multiple LEDs (16) with Raspberry Pi Pico board and then will implement pulse width modulation on those LEDs.
The procedure of interfacing and programming with Thonny IDE using MicroPython will remain similar to the previous example.
Fig. 25 Interfacing Multiple LEDs with Pico
Let’s write the code:
from machine import Pin, PWM
import time
led_1 = PWM(Pin(5)) # declaring led_x object for PWM pins
led_2 = PWM(Pin(6))
led_3 = PWM(Pin(8))
led_4 = PWM(Pin(9))
led_5 = PWM(Pin(10))
led_6 = PWM(Pin(13))
led_7 = PWM(Pin(14))
led_8 = PWM(Pin(15))
led_9 = PWM(Pin(16))
led_10 = PWM(Pin(17))
led_11 = PWM(Pin(18))
led_12 = PWM(Pin(19))
led_13 = PWM(Pin(20))
led_14 = PWM(Pin(21))
led_15 = PWM(Pin(22))
led_16 = PWM(Pin(26))
print(led_1)
def led_freq(x):
led_1.freq(x)
led_2.freq(x)
led_3.freq(x)
led_4.freq(x)
led_5.freq(x)
led_6.freq(x)
led_6.freq(x)
led_7.freq(x)
led_8.freq(x)
led_9.freq(x)
led_10.freq(x)
led_11.freq(x)
led_12.freq(x)
led_13.freq(x)
led_14.freq(x)
led_15.freq(x)
led_16.freq(x)
led_freq(1000) # setting pulse width modulation prequency
while True:
for duty in range(0, 65535): # Increasing LED broghtness
led_1.duty_u16(duty)
led_2.duty_u16(duty)
led_3.duty_u16(duty)
led_4.duty_u16(duty)
led_5.duty_u16(duty)
led_6.duty_u16(duty)
led_7.duty_u16(duty)
led_8.duty_u16(duty)
led_9.duty_u16(duty)
led_10.duty_u16(duty)
led_11.duty_u16(duty)
led_12.duty_u16(duty)
led_13.duty_u16(duty)
led_14.duty_u16(duty)
led_15.duty_u16(duty)
led_16.duty_u16(duty)
print(duty) # Print the duty Cycle
time.sleep(0.001)
for duty in range(65535, 0): # deccresing LED brightness
led_1.duty_u16(duty)
led_2.duty_u16(duty)
led_3.duty_u16(duty)
led_4.duty_u16(duty)
led_5.duty_u16(duty)
led_6.duty_u16(duty)
led_7.duty_u16(duty)
led_8.duty_u16(duty)
led_9.duty_u16(duty)
led_10.duty_u16(duty)
led_11.duty_u16(duty)
led_12.duty_u16(duty)
led_13.duty_u16(duty)
led_14.duty_u16(duty)
led_15.duty_u16(duty)
led_16.duty_u16(duty)
print(duty)
time.sleep(0.001)
As we mentioned in the introduction part raspberry Pi Pico has 8 PWM slices and 16 PWM channels. So in this example code we are interfacing 16 LEDs with PWM pins.
Most of the code instructions and commands are similar to the previous example. Here we declare 16 different led objects for 16 different GPIO pins (PWM pins).
Fig. 26 Declaring ‘led’ object
Fig.27 PWM frequency
In the images attached below, we can see the variation in LED brightness.
Fig. 28 Minimum Brightness Level
Fig. 29 Intermediate Brightness Level
Fig. 30 Maximum Brightness Level
In this tutorial we demonstrated the implementation of pulse width modulation on LEDs with Raspberry Pi Pico module and MicroPython programming language.
Continuing with this tutorial, in our upcoming tutorial we will discuss the interfacing of a servo-motor with raspberry pi Pico and we will also implement PWM on servo motor to control the direction of rotation.
This concludes the tutorial, we hope you find this of some help and also hope to see you soon with a new tutorial on Raspberry Pi Pico programming.
Because of SQL database errors, users are unable to access their valuable data, and it is their responsibility to fix the issues promptly to make sure that there are no severe data loss issues. There are some predominant database corruption errors and issues. You may promptly resolve them to avoid undesirable severe data loss. We will know more about database corruption errors, issues, and perfect solutions for fixing SQL server database problems.
Usually, there are three main reasons behind database failure. Let us examine each of them and identify ways to recover and restore your lost data.
If a computer or server is shut down improperly, or if it encounters a power outage or surge or something occurs that abruptly interrupts the process of writing data to the files, there are chances of the OS files getting corrupted or damaged severely. This may lead to critical data loss. After encountering such a crisis, you are advised to repair or at least, examine the filesystem to safeguard against any data loss in the future. For modifying or mounting a file system, a repair may be necessary. Even though a thorough check may not report or reveal any severe damage, you might still need to repair the filesystem.
Another effective way of repairing the corrupt or compromised database is by utilizing database console commands like CHECKDB, DBCC, or DBCC DEBREPAIR. These commands could help fix minor database issues. However, they are not efficient enough to tackle or resolve critical corruption cases.
Hardware failures will be including memory issues, bad disk sectors, disk crashes, and even disk with errors, among many other issues. Hardware failures could be because of design errors, overloading, and poor quality control at the time of fabrication, and degradation of mechanical parts. Software failures will be including issues associated with software like DBMS software, operating system, application programs, etc.
Irrespective of how trustworthy, your DBMS seems, it is not in a position to guarantee a failure-free seamless transaction each time. To prevent any kind of database failure, the most logical and proactive step is to consult with expert DBAs. Once the overall database health is analyzed, you may rest assured to avoid serious problems down the line.
Users should regularly back up their SQL database to restore the database, in case of corruption or damage. Backup is certainly the most effective way of dealing with corruption. Keep in mind that some data may be missing between the time when disaster struck and the last backup. You may consider using commands like DBCC CHECKDB to examine and resolve corruption issues. However, you may fail to repair and restore severely corrupted files using this command.
You may use SQL data recovery tools recommended by experts to repair and resolve corrupt database file issues due to a lack of a backup. Some cutting-edge tools are helpful in the recovery of deleted objects, and they even display a preview. SQL recovery could prove to be a daunting and stressful job. However, you may use some advanced SQL recovery tools for getting your databases back into action!
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | Breadboard | Amazon | Buy Now | |
2 | Jumper Wires | Amazon | Buy Now | |
3 | Raspberry Pi 4 | Amazon | Buy Now |
Connect button pushes to function calls using the Python gpiozero package and uses the Python dictionary data structure
For this project, you'll need some audio samples. On Raspbian, there are many audio files; however, playing them with Python can be challenging. You can, however, transform the audio files to a more simply used format for Python.
Please make a new folder and rename it because all of your project files will be saved in the new location.
Create a new folder named samples using the same technique as before in your new folder.
In /usr/share/sonic-pi/sample, you'll find a bunch of sample sounds. These sounds will be copied into the samples folder in the following phase.
Open the command window by selecting the icon in the upper left corner of your screen.
To transfer all items from one folder to another, execute the following lines:
You should now see all the .flac audio files inside the sample folder.
To use Python to play sound files, you must first convert them from .flac to .wav format.
Go to the sample folder inside a terminal.
FFmpeg is a software program that can quickly transcode video files on Raspberry Pi. This comes preloaded on the most recent Raspbian releases.
You may use this simple command to convert music or movie files format:
To transform an audio (.wav) to a mp3 format (.mp3), for example, type:
A batch operation is a process for processing or treating a large quantity of material. When creating modest amounts of goods, the batch operation is preferred. Because this procedure provides superior traceability and flexibility, it is highly prevalent in pharmaceutical and specialized chemical manufacturing.
It's simple to rename a file with bash. For example, you may use the mv command.
But what if you had a thousand files to rename?
When you run a script or a series of commands on several files, this is known as a batch operation.
The first step is to notify bash that you wish to work with all the files inside the folder.
The dollar symbol indicates that you're referring to f in this case. Finally, inform bash that you're finished.
If you press enter after each statement, bash will wait until you input done before running the loop; therefore, the command would appear as shown below:
You might also use a semi-colon to separate the instructions rather than pressing Return after every line.
The process of processing and analyzing strings is referred to as string manipulation. It entails several processes involving altering and processing strings to utilize and change their data.
That final command was meaningless, but batch operations can accomplish a lot more. You can use the following command to rename each file.
As a result, the $f percent.txt.MD syntax replaces all.txt strings with .md strings. Use the hash operator instead of the % sign to remove a string from the beginning rather than the end.
Write the following lines in your terminal. All .flac files will be converted to .wav files, and the old ones will be deleted.
Based on the Raspberry version you're using, it might take a couple of minutes.
All of the new.wav files will then be visible inside the sample folder.
After that, you'll begin writing Python code. You can do this with any code editor or IDE, but Mu is often an excellent option.
To play audio files, import and initialize the pygame library.
This file should be saved in the gpio-music-box directory.
Select four audio files to utilize in your composition, such as:
Then make an object which references an audio file. Give the file a different name. Consider the following case:
For the following three sounds, create labelled objects.
Because all of your audio files are in the sample folder, the path will be as follows:
Each audio object should be given a name, for example, cymbal:
This is how your program should appear:
Please make a backup of your code and execute it. Then use the .play() function inside the shell from the code editor to play the audio.
Ensure that the speaker is functional and the volume is cranked up if you don't hear anything.
Four pushbuttons will be required, each connected to a different GPIO pin.
There are 26 GPIO pins on a Raspberry Pi. You may use them to transmit on/off pulses to/from electrical components like Led, actuators, and switches.
The GPIO pins are laid out as below.
There are extra pins for 3.3 V, 5v, and Grounded connections and a number for each pin.
Another illustration of the pin placement may be seen here. It also displays some of the unique pins that are available as options.
A figure with a quick explanation is shown below.
One of the basic input components is a button.
Buttons come in various shapes and sizes, with two or four legs, for example. Flying wire is commonly used to link the two-leg variants to a control system. Four-legged buttons are usually put on a breadboard.
The illustrations below illustrate how to connect a Raspberry Pi to a button. Pin 17 is indeed the input in both scenarios.
The breadboard's negative rail may be connected to a single GND, allowing all pushbuttons to share the same grounded rail.
On the breadboard, attach the four buttons.
Connect each pushbutton to a GPIO pin with a specific number. You are free to select whatever pin you prefer, but you must recall its number.
Connect one Ground pin to the breadboard's neutral rail. Then connect one of each button's legs to this rail. Finally, connect the remaining buttons' legs to separate GPIO pins.
Here's a wiring schematic that may be of use. The extra legs of the pushbuttons are connected to Pin 4, pin 17, pin 27, and Pin 10 in this case.
A single pushbutton has been connected to pin 17 in the figure below.
The button may be used to invoke methods that don't need any arguments:
First, use Python language and the gpiozero library to configure the button.
The next step is to design a function with no parameters. This straightforward method prints the phrase Hello in the terminal.
Finally, build a function-calling trigger.
You can now see Hello displayed in the terminal each time that button is clicked.
You may make your function as complicated as you want it to be, and you can also call methods which are part of modules. In this case, hitting the button causes an LED in pin 4 to turn on.
The application should execute a function like drum.play() whenever the button is pushed.
However, brackets are not used when using an action (like a button push) to invoke a function
. The software must call that method whenever the button is pushed, not immediately. All you have to do is use drum.play in this situation.
First, establish one of the buttons. Ensure to replace the numbers from the example with the ones of the pins you've used.
Add the following line of code at the end of your script to play the audio whenever the button is pushed:
Push the button after running the software. If you don't hear the sound, double-check your button's connections.
Add code to the three remaining buttons to have them play their audio.
For the second button, you may use the code below.
Good code is clear, intelligible, tested, never overly convoluted, and does the task at hand.
You should be able to run your code with no issues. However, once you have a working prototype, it's typically a good practice to tidy up your code.
Subsequent stages are entirely optional. If you're satisfied with your writing, leave it alone. Follow the instructions on this page and make your code a little cleaner.
Instead of creating eight individual objects, you may keep your pushbutton objects and audio in a dictionary. These are, nonetheless, the seven characteristics of good code.
If you're writing one-time discard code that no one, including yourself, will have to see in the future, you may write in any way you like. However, the majority of useful software that has been produced has to be updated regularly.
The next important feature of excellent programming is scalability, or the capacity to expand with the demands of your organization. Scalability is primarily concerned with the code's efficiency. Scalable code doesn't always require frequent design changes to maintain performance and resolve various workloads.
Last-minute adjustments are unavoidable while developing software. It will be difficult to send new changes through if the code can not be rapidly and automatically tested.
Every piece of software that is built has a certain goal in mind. For persons familiar with the functionality, a code that adheres to its requirements is simple to understand. As a result, one important characteristic of excellent code is that it meets the functional requirements.
Mistakes and flaws are an inherent element of software development. You can't anticipate every conceivable manufacturing case, no matter how cautious you were during the design process. You should, however, shield your application against the negative effects of such situations.
This is an important feature of excellent coding. A reusable and sustainable code is extendable. You write code and double-check that it works as expected. Extensions and related advances can be added to the feature by modules that require it.
For every software application, reusable coding is essential and highly beneficial. It aids in the simplification of your source code and avoids redundancy. Reusable codes save time and are cheaper in the long term.
Learn how to create simple dictionaries and iterate over them by following the methods below.
First, establish a dictionary where the Buttons serve as keys and audio as values.
Whenever the pushbutton is pressed, you can loop through the dictionary to instruct the computer to play the audio:
We learned how to make a "music box" with buttons that play sounds depending on which button is pushed in this lesson. We also learnt how to interface our raspberry pi with buttons via the GPIO pins and wrote a python program to control the effects of pressing the buttons. In the following tutorial, we will learn how to perform a voice control on Raspberry pi.
Welcome to the next tutorial of our Raspberry Pi programming course. Our previous tutorial looked at how to Interface DS18B20 with Raspberry Pi 4. This tutorial will teach us how to create a time-lapse video with still images and understand how phototimer and FFmpeg work.
Where To Buy? | ||||
---|---|---|---|---|
No. | Components | Distributor | Link To Buy | |
1 | Raspberry Pi 4 | Amazon | Buy Now |
When photographing something over a lengthy period, "time-lapse" comes to mind. A video can be created by mixing the still photos. Plant development may be tracked with time-lapse movies, as can the changing of the seasons. They can also be utilized as low-resolution security cameras.
Cameras that can be used with the Raspberry Pi are a bit limited. A powered USB hub is required for most webcams that are compatible. For this post, we’ll be using a camera specifically made for the Raspberry Pi. The camera module can be plugged into a specified port on the Raspberry Pi. How to do it;
Shutting down the pi is recommended before adding a camera. A power button should be installed on Pi 4 so that you may shut down the device safely every time.
Slide the cord into the port by using an image as a guide. Finally, press down tabs, securing the cable to the motherboard.
Click on the main menu button, select Preferences, and then click Pi Configuration if you're using a monitor. Enable the camera by clicking on the Interfaces tab.
To continue, headless users must type the command below. Make sure the camera is turned on in Interfacing Options. Rebooting the Raspberry Pi will be required.
Individual stills are used to create time-lapse videos. We'll be using raspistill to acquire our time-lapse images. As part of the Raspberry Pi OS, you don't need to install anything extra. The are two way to record a time lapse:
Raspistill is a Linux-based software library that aims to make it easier for Linux users to use sophisticated camera systems. We can use open-source programs running on ARM processors to control the camera system with the Raspberry Pi. Almost all of the Broadcom GPU's proprietary code is bypassed, which customers have no access to.
It provides a C++ API to apps and operates at the base of configuring a camera and enabling the program to obtain image frames. Image buffers are stored in memory space and can be supplied to either video encoders (like H.264) or still image encoding algorithms like JPEG or PNG. raspistill, on the other hand, does not perform any image encoding or display operations directly.
An illustration of how to take time-lapse photography is shown in the following image.
In this case, the time-lapse capture was 10 seconds long. The Raspberry will wait for a total of 2000 milliseconds between each image. For 10 seconds, the Raspberry Pi will take a picture every two seconds.
The photos will be stored as .jpg files. This example uses the name "Pic" and a number that increases with each frame to identify each image. The final digit of percent 04d is a zero. Pic0000.jpg and Pic0001.jpg would be the names of the first two photographs, and so on. Change this value according to the requirements of your project.
Your time-lapse video needs to be put together once all of your photographs have been taken. FFmpeg is the tool we'll be utilizing to generate our timelapse video. The command to download the package is as follows:
Allow the installation to be complete before moving on. Using this command, you can create a finished video:
Pic%04d.jpg corresponds to the image filename you specified in the preceding section. If you have previously changed this name, please do so here. With the -r option, you can specify how many frames per second you want to record. When creating a time-lapse video, replace the phrase video-file with your name. Make sure to keep the .mp4 file extension.
A high-speed audio and video conversion tool that can also capture from a webcast source is included. On the fly, video resizing and sampling can also be done with high-grade polyphase filters.
A plain output URL specifies an indefinite number of outputs that FFmpeg can read from (standard files, piped streams, network streams, capturing devices, etc.), whereas the -i option specifies the number of input files. An output URL is encountered on the command-line interface that cannot be treated as an option.
Video/audio/subtitle/attachment/data streams can all be included in a single input or output URL. The container format may limit the quantity or type of stream used. The -map option can map input streams to output streams, either automatically or manually.
For options, input files must be referred to by their indices (0-based). It's not uncommon to have an infinite number of input files. Indexes are used to identify streams inside a file. As an illustration, the encoding 2:3 designates the third input file's fourth and final stream. In addition, check out the chapter on Stream specifiers.
A Python library named phototimer will be used to control the raspistill command-line that comes pre-installed on the Raspbian OS.
Using docker, you can develop, analyze, and publish apps in a short time. To run phototimer with Python installed, you'll need to use Docker with Raspbian Lite.
A new location does not necessitate an SSH login. The lapse of time will be restarted.
Download the Docker image, activate the camera interface, and start the container instead of executing a git clone on each device.
If you disconnect from the container, docker will keep track of the log information and will enable you to reconnect at any time.
We can easily set up docker with the following set of commands.
Download the docker file as a zip as shown below
Or use the terminal by copying the phototimer code as shown here:
If git isn't already installed, use the following command to add it:
By modifying the config.py file, you can change the time-appearance lapses and duration.
You will likely want to alter the default time-lapse settings so that they better fit your requirements, which start at 4 am and end at 8 pm.
For some reason, overall quality of 35/100 produces a substantially smaller image than one with a quality of 60-80/100. You can modify the file to determine how much space you'll need.
Depending on how your camera is positioned, the image may need to be flipped horizontally or vertically. True or False in each situation will have the same result.
To achieve a specific aspect ratio, you can change the height or width of the image in this way. The default setting is what I use.
The Docker container must be re-built and restarted every time you change your setup.
When docker does a build, it will construct an image from the current directory's code and a base image, like Debian.
The most crucial part is that the image we create right now contains everything our application might want.
For those just getting started, these are some helpful keyboard shortcuts and CLI commands:
The default time zone for the Docker container is UTC. If you're in a different time zone, you'll want to adjust your daylight savings time accordingly.
Docker can be configured to run in your current local time by adding the following additional option to the command:
As a result, the following is what a time-lapse in Texas, United States, might look like:
Below are some time-lapse images taken from the raspberry pi camera.
To save your photos to your laptop, follow these steps once you've captured a few pictures:
The ssh and SCP functions are included in Git for Windows, which may be installed on Windows.
You'll need a way to connect to your new rig when you're not near your wi-fi router if you plan on doing the same thing I did. There are a few ideas to get you started:
All Pi models allow networking via USB, and it is very straightforward to establish and will not interfere with the wi-fi network. You will have to bring a USB cord to each new site to directly change the Wireless SSID/password on the pi.
Plugging an SD card into your computer while on the road allows you to update your wi-fi configuration file easily, provided there is an SD card adapter nearby. The existing configuration will be replaced with this new one on the next reboot.
If you're comfortable with Linux, you can use hostapd to create your hotspot on the RPi. To connect to your Raspberry Pi, you'll need a computer with an Ethernet cable and a web browser.
Install your wi-fi Username and password and use that to start/stop timelapse capture and download files if you won't be using the rig outside your location.
The imported files should be in the correct order if you drag them onto the timeline after they've been imported, so be sure to do that. The crop factor should be set to "fill." Instead of 4.0 seconds, use 0.1 seconds for the showtime every frame.
It is often necessary to transfer documents between the Linux laptop to an industrial Raspberry Pi for testing purposes.
Occasionally, you'll need to transfer files or folders between your commercial Raspberry to your computer.
There is no longer a need for you to worry about transmitting files via email, pen drive, or any other method that takes up time. Automation and industry control can help you automate the process in this post.
As the name suggests, SCP refers to secure copy. This command-line application lets you securely transfer files and folders between two remote places, such as between your local computer and another computer or between your computer and another computer.
You may see SCP info by using the command below:
Using SCP, you can transfer files to the RPi in the quickest possible manner. There is a learning curve associated with this strategy for novice users, but you'll be glad you did once you get the hang of it.
You must activate ssh on your Raspberry Pi to use SCP.
A free program like Giphy can help you convert the videos to a GIF; however, this will lower the number of frames.
We learned how to use the Raspberry Pi to create a time-lapse animation in this lesson. In addition, we looked into the pi camera raspistill interface and used FFmpeg and phototimer to create a time-lapse. We also learnt how to interface our raspberry pi with our pc using ssh and transfer files between the two computers. The following tutorial will teach how to design and code a GPIO soundboard using raspberry pi 4.
Hi Everyone! Glad to have you on board. Thank you for clicking this read. In this post today, I’ll cover Real Life Examples of Workflow Automation.
Workflow automation is a talk of mainstream conversation. Many employees use this process in their organizations but they are not aware of this term. Workflow automation is a process used to automate manual and repetitive time-consuming tasks. It requires a series of tasks that need to be completed in a sequential manner where the process goes from start to finish with a definite goal in mind. For instance, onboarding new clients and approving leave requests are susceptible to errors when done manually. However, with workflow automation software, these tasks are done automatically without human intervention, leaving no room for mistakes or failure.
In this digital transformation stage, it is almost impossible to handle the influx of data manually. This is where digital technology comes to rescue you. With workflow automation, you can streamline business processes in a way that requires less time and hard work and guarantee optimal results.
We’ve compiled 7 real-life examples that use workflow automation to bring value to your business where you can automate routine tasks, allowing you to pay careful attention to the business objectives that matter.
Expense reports are a hassle. You require these reports to reimburse the money employees pay out of their pocket. Companies need to ensure their finances and expenditures are in check to make sure they don’t go out of budget anytime soon.
When employees spend money on travel or any business purpose outside the company premises, they feel uncomfortable finding all those receipts to submit as proof of purchase. And for the finance department, this process is painful since they need to do a lot of physical paperwork and fill spreadsheets to reimburse money to the employee.
Solution? Workflow automation.
With workflow automation tool, creating expense reports are like a walk in the park. Employees can use this tool on their smartphones. All they need to do is click the image of the receipt and upload it in the app, and send it to the manager for approval. The manager can check the details at a glance and can immediately approve it and send it to the finance department for reimbursement.
The first impression is the last impression. So make it count. If new hires experience a positive onboarding process, they are more likely to stick with the company.
Manual filling of personal information and compliance documents is prone to mistakes that will leave a negative first impression on the new hires. This situation can be avoided with workflow automation.
Incorporating workflow automation software in hiring new candidates will make the process smooth and accurate, putting both executives and new team members on the same page. This way the manager you will work under can overview your background at a glance and assign tasks to as best of your capabilities.
No matter the organization, assigning new tasks to the individuals takes time and requires deliberate effort. It is very challenging to manually keep the record of tasks assigned to each individual. This is where workflow automation comes in handy.
For instance, Flokzu is a workflow process management software that you can use to visually create the outline of each task to be completed. Moreover, it comes with a reporting system that lets you know about the pending task when it is completed and automatically assigns the new task to the relevant team member.
Traditional handling of leave requests is outdated. You can’t consistently keep in check whether the company is working with a full labor force. If handled manually, you always need to enter the time when an employee is away, which is a painful and tedious job. Workflow automation makes this process effortless.
Once the manager approves your leave request, the workflow automation software will automatically monitor the time when the employee is away and make it sync with the payroll. So, the time-off duration will automatically be deducted from your paycheck at the end of the month. This way manager can keep the record of employees working in the company at the same time and those away, making sure the required number of employees are present in the organization.
Data procurement is a fundamental component of your business growth. It helps you make an educated decision around the calculated data to handle business operations efficiently. With the deep insights into the raw materials entering the manufacturing department, you can find areas of improvement immediately.
When handled manually, data procurement can lead to data loss, more time spent and reduced productivity from the labor workforce. However, automated systems, on the other hand, help you monitor data on a single screen and allow the manager to efficiently revisit the strategic decisions and improvise on them for better results.
Impeccable customer support is the prime pillar of any agency. You want to turn customers into recurring customers, which is only possible when their queries are handled and requests are answered immediately. The main purpose of any customer support is to bridge the communication gap between customers and the agency so they keep coming back for what you have to offer.
And with workflow automation, you can bridge this gap and delight the customers with consistent and reliable processes from ticket creation to ticket closure. When you submit the ticket, your request is transferred to the relevant department which might involve getting back and forth between departments until you get the email when the issue is resolved. Some companies use online chatbots where the queries of customers are handled immediately without any delay. Know that when repetitive and mundane activities are automated, team members can pay attention to value-added endeavors.
Invoice generation is necessary to balance the books of any organization. According to reports, one accountant can process 5 invoices per hour manually and charge $19.24/hour. In conclusion, one invoice costs $4 to manually process it.
With workflow automation software this cost can be significantly reduced. You can, for instance, subscribe to invoice generation software QuickBooks ($12.50/month) and can generate scores of invoices at a low cost.
If you integrate a payment platform like PayPal with an invoice generation tool like QuickBooks; whenever you buy anything, the system will cut money from the former and an automatic electronic invoice will be generated in the latter.
Workflow automation is an effective way to manage complex business tasks. But while this process is in practice, it doesn’t mean you have to adapt it anyway. What’s working for other companies might not work for you. For instance, tasks that are not repetitive and time-consuming, you might prefer doing them manually since it may require more time and budget to put them on an automated system. Similarly, the tasks like system failure or hacking, when this occurs you instantly need human involvement. Make sure you do your due diligence before incorporating workflow automation into your business, so you can reap more benefits than your competitors.
That’s all for today. Hope you’ve enjoyed reading this article. Feel free to share your valuable feedback and suggestions to improve our content. If you have any questions, ask me in the section below. I’d love to help you the best way I can. Thank you for reading this article.
In this article, we will discuss the introduction to organic chemistry in which we will study organic compounds, classification of organic compounds, types of formulas, use, significances, general and covalent bond characteristics of organic compounds, and homologous series and his characteristics. 9 out of 10 takes the organic chemistry too tough but I explained it easily and simply to you. This article is for beginners and clears many topics.
“The chemistry of compounds obtained from living things.”
Swedish Chemist Jacob Berzelius put forward this theory in the 19th century.
“ Organic compounds could not be synthesized in the laboratory due to the influence of a mysterious force called vital force, which occurs only in living things.”
The branch of chemistry in which we study hydrocarbons and their derivatives is known as organic chemistry.
Organic compounds belong to hydrocarbons and their derivatives which are covalently bonded to carbon.
There are so many examples of organic compounds
Organic compounds had six types of formulae;
The formula In which the exact no of atoms is mentioned in one molecule of the organic compound is called the molecular formula.
Examples
The molecular formula of methane CH4.
The formula of organic compounds shows the actual arrangement of different atoms of various elements present in a molecule.
Example
The structural formula of propane is
Iso_ propane
The formula in which groups of atoms are linked with each carbon atom in a branched-chain or straight chain.
Example
The condensed formula of propane
Iso_propane. n_propane
The formula in which sharing of electrons in a dot and cross-form between the various atoms in one molecule is indicated is called electronic or Dot and Cross formula.
Example
In which whole, no ratio of different atoms in a compound gives the empirical formula of organic compounds
Example
The essential form of structure of an organic compound makes a series of atoms that are bonded together in the form of a chain, branched, or rings called the skeleton formula.
Example
skeleton formula of propane is
Depending upon their carbon atoms, organic compounds are divided into two categories.
Acyclic compounds form a long chain of carbon atoms without joining the end of the cross-format with each other. They may form straight or branched chain compounds
A straight-chain is formed by the linking of carbon atoms with another carbon atom or any other atoms through single, double, or triple bonds.
Example
propane
Branched-chain compounds
Open chain compounds i.e. aliphatic compounds in which a branch along with a straight chain is formed.
Closed chain or cyclic compounds
The carbon atoms of closed chain compounds are not free from their ends and it contains one or more close chains. These are divided into two groups
These compounds are made up of rings of carbon atoms. These are further divided into two groups.
Aromatic compounds consist of benzene rings at least one in their molecule. Six carbon atoms with three double bonds make a benzene ring, these compounds are also called benzenoid compounds. They have aroma or smell so they are also called aromatic compounds.
Example
These are called none_ benzenoid compounds because the benzene ring is not present in these compounds.
Example
Those cyclic compounds that consist of one or more atoms other than that of carbon atoms in their rings are known as heterocyclic compounds.
Example
The classification of known compounds is as follows
so the organic compounds are open or closed chains. Open chains are further divided into alkane, alkene, and alkynes. Closed chains may be homocyclic or heterocyclic. Homocyclics are alicyclic or aromatics.
From plants and animals, organic compounds are naturally prepared.
Protein and fats are the two major groups of organic compounds that are synthesized by animals.
Plants could be prepared
From dead plants through a biochemical process, we obtain
By the destructive distillation of coal and petroleum, we obtain thousands of organic compounds.
A blackish, complex mixture of organic compounds of carbon, hydrogen, and oxygen is called Coal
In the absence of air, strong heating of coal is called Destructive distillation.
Except for carbon, coal contains different elements like hydrogen, oxygen, sulfur, and nitrogen.
So huge number of organic compounds are formed due to the destructive distillation of coal with few inorganic compounds.
When coal is passed through the destructive distillation process. A solid residue left behind and lost all of its volatile elements is called coke.
The techniques, in which different ranges of temperature are used to separate the mixtures of the coal in terms of temperatures. we get different products at different ranges of temperature.
The below chart shows the uses and types of coal
A Greenish black or dark brownish colored viscous liquid is called petroleum.
It is a complex mixture of salt, water, and Earth particles mixed with a mixture of serve solid, liquid, or gaseous hydrocarbons.
The main source of organic compounds is petroleum and it is separated through fractional distillation. Different organic compounds consist of each fraction of petroleum that is not a single compound.
Natural gas consists of serial gases like 85% of methane, nitrogen gas, carbon dioxide, propane, butane, and ethane.
Macromolecules are formed by living plants
Two centuries ago, due to the vital force theory, we considered that organic compounds are prepared only from animals and plants and could not be synthesized in the laboratory.
A large amount of the organic compounds, almost more than ten million are synthesized in a laboratory.
Urea opens the way for chemists to prepare organic compounds in the laboratory and it is synthesized by inorganic salts.
Example
The fermentation of barley and molasses produced alcohols.
Synthetic rubber has much more qualities than natural rubber-like
Different fibers are made in laboratory-like
Natural fibers have better properties than synthetic fibers like
All proteins, sweeteners, vitamins, drugs, and medicines are being prepared in laboratories.
There is no doubt that more than ten million compounds are made in the laboratory but thousands of organic compounds are naturally synthesized by plants and animals.
We use different organic stuff daily such as milk, eggs, vegetables meat, etc. contain protein, vitamins, fats carbohydrates, etc.
Natural fibers and synthetic fibers, all are organic compounds used in cloth making that we use daily for wearing bedsheets, etc.
A variety of organic compounds are used in raw materials such as
cellulose naturally occurring organic compound in wood that is used for making furniture and housing.
Coal, petroleum, and natural gas are all organic compounds called gospel fuel that is used for domestic purposes and automobiles.
antibiotics (kill or inhabitants of microorganisms that cause infectious diseases) are life-saving medicines.
The general characteristics of Organic Compounds include:
A covalent bond is a chemical bond that influences the sharing of electrons pairs between atoms in a switch resulting in a balance of impressive and despicable forces between the atoms. The presence of a covalent bond renders specific elements to the organic compounds. These include:
A major characteristic of Members of Homologous Series
A Homologous Series is a community of organic chemical compounds, usually summarized in the order of increasing size, that have an identical structure (and hence, also similar properties) and whose structures vary only by the number of CH2– CH2 units in the fundamental carbon chain.
They maintain the following general characteristics:
So this is all for our today's article. I have tried my best to explain all the important topics covered in the heading " Introduction to Organic Chemistry". So if you want more tough articles in simple ways then give me good feedback. It will help me for better work. Thanks
Hi Friends! Hope you’re well today. I welcome you on board. In this post, I’ll walk you through How Workflow Automation Can Benefit Small Businesses?
Reduce the possibility of human error, save time and improve efficiency – The main goal of workflow automation. If your employees spend a lot of time on mundane and repetitive tasks, it’s a high time to invest in workflow automation. Especially if your business is small and you are in the early stages to leave a footprint in the competitive market. You can’t afford to hire scores of employees to do predictable tasks that you can automate with workflow automation. For instance, follow-up emails and sales calls, finance approval and invoice generation, and onboarding new employees, you can automate these tasks without having to worry about hiring someone to handle them manually.
Curious to know how workflow automation can benefit small businesses?
Keep reading.
Before we proceed further, we’ll cover what workflow automation is?
Workflow automation is the process to automate manual repetitive tasks to improve efficiency and reduce human error. When you apply technology to business operations, you can effortlessly translate the manual handling of processes into automation. This way employees can spend more time on value-added tasks that require a human touch and brainstorming.
What’s more, with workflow automation you can monitor employees’ performance and can immediately apply tweaks to revisit your strategic decisions. Plus, you don’t need a technical IT team to streamline processes, improve reporting and integrate two or more apps. Apps like Zapier do it for you. It involves creating Zaps that is creating links between business tools. For instance, it can integrate a website, CRM software, and messaging app to improve productivity and bridge the communication gap between customers and the agency.
The following are the core benefits of incorporating automation into your business.
Chasing down people across departments is so frustrating, especially when you don’t know the current status of the file. With workflow automation, you can monitor the workflows online and get an instant alert to set priorities. This improves the productivity of the employees, allowing them to be better prepared for the pending tasks.
Employees are the backbone of any industry. But you need to keep your budget in check while getting employees on board. You can significantly reduce the cost of labor workload if you automate some of your business processes. For instance, freeing employees from doing predictable and mundane tasks will help you invest in the things that involve human input.
When employees are free from manual tasks such as data entry, form filling, and invoice generation, they will find more time for brainstorming and get creative on the tasks that require innovation and emotion. The potential to apply intelligence, sensitivity, and expertise on the product level allows companies to deeply connect with the customers and deal with their questions and queries with deliberate intention.
When the pandemic hit, the demand for remote work increased more than ever before. Not everyone can manage to do an in-house job in a time of crisis. Companies that know how to manage the workforce remotely can effectively capitalize on the given resources. With workflow automation, you can seamlessly connect employees from different parts of the world. For instance, Google Drive, and DropBox allow the companies to share files across departments, and tools like Loom allow them to have full visibility of the teams.
What tasks do we need to automate? The answer is simple: Tasks that are repetitive and require approvals and smooth communication. Following are the five tasks that you can automate in your business.
At times employees have to spend money on the best of money for business purposes. Companies can’t instantly pay those employees who pay out of their pocket. And when they apply for reimbursements, they come across a hassle process especially when reimbursements are handled manually.
To effectively handle such scenarios, automation is the solution. Incorporating workflow automation prevents employees to chase hectic approvals and make regular visits to the finance office. Automation makes this process straightforward. Employees simply upload the receipts on the software which instantly gets connected with the manager for approval. Once the manager grants approval, receipts move to the finance department and they release the money spent by the employees.
First impression is the last impression especially when it comes to onboarding new hires. The seamless onboarding process tells a lot about employees if they are going to stick with the company for a longer time.
Tasks like updating new hires, documents approval, and follow-ups can be automated before candidates even join the company. Plus, you can effortlessly communicate and assign them the tasks so they are better prepared when they embrace the new role. Automation removes the tedious paperwork and mundane approvals, allowing both employer and employees to come on the same page without the need to back and forth face to face interaction.
Every organization deals with the influx of leave requests regularly. If organizations still use traditional ways to approve requests, they might already know it’s a tedious process. At times manager feels difficulty in managing the required number of employees in the company. One employee might want the same day off already applied by another employee. If handled manually, it is very challenging to keep the record of employees with days off or those who want particular time away from the company.
Workflow automation removes this uncertainty and makes sure the company doesn’t go understaffed. Automation software tracks and keeps the record of the time of those away and the manager can instantly approve the leave requests by scanning everything on the single screen. Software is stuffed with an online form to let employees know which days are available or unavailable that automatically limits two employees requesting the same days off.
No matter the type and size of your business, data procurement is a critical part of every business. It is a process that consists of a series of functions required to obtain goods and services from the vendor and keep a record of how these services and goods are used to achieve business goals. The effective use of the procumbent function directly influences the cost-saving objectives of the agency. Yes, by analyzing the data you can revisit decisions if you need to change vendors and suppliers. Data procurement goes beyond the purchase of goods and services. For instance, it also includes a better understanding of the performance of all business units, supplier performance, risk and compliance management, and contract utilization.
Manual processing of data procurement often leads to compromised risks like operational risks, delivery risks, and potential frauds. Moreover, inaccuracy and inefficiency are other issues that result from the manual handling of data. However, with automation procurement software these issues can be avoided. Automating vendor management and purchase orders guarantee enhanced compliance and greater productivity.
Invoice generation is an integral part of any business. Effective invoice generation builds trust and allows clients to stay in touch with your business and keep coming back for what you have to offer. If you create invoices manually, you might need to generate an invoice every time to request payment from the client. However, with workflow automation this process becomes transparent, preventing you from entering information every single time to request the next payment. A smart automation solution comes with automation of data entry, matching prices, transferring digital payments, managing purchase orders, and more. Generating digital invoices is crucial for businesses to keep up with the modern trends and compete with rival brands.
When you start a small business, you need employees to keep it up and running.
However, it’s probable in the early stage of your business you’re tight on budget.
To combat this, a smart automation solution is key.
No advanced automation solutions are required. Some vendors offer low-cost solutions that perfectly fit your budget.
From vacation requests and invoice generation to data procurement and onboarding new hires, you can automate workflows for your business growth.
Know that not every business task requires automation, since some mission-critical tasks like system failure and hacking demand instant human involvement to run a business without delays.
That’s all for today. Hope you’ve enjoyed reading this article. If you have any questions, you can ask me in the section below. You are most welcome to share your experience of incorporating workflow automation into your business. Thank you for reading the article.