Printing in Raspberry Pi 4

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.ComponentsDistributorLink To Buy
1Raspberry Pi 4AmazonBuy Now

Let us get started

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.

Requirements

  • Raspberry Pi
  • USB Printer
  • Ethernet Cable
  • Power Supply

CUPS

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.

Setup Print Server Software CUPS

With our Raspberry terminal, we will configure the typical Unix printing system.

  1. Update Pi

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.

  1. Use Static IP

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.

  1. Interface: This is the network connection for configuring the settings.
  2. the static Ip address is the Ip you'll use to configure your device. (Don't forget to include a /24 in the end.)
  3. static routers: It is the default gateway.
  4. Static domain_name_servers: Your DNS server's IP address is this.

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:

  1. Install CUPS

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.

  1. Configure CUPS

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.

  1. User & Network Access Settings

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.

  1. Setup Samba

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:

How do we set up our printer?

Install Printer Drivers

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.

Adding Printer to CUPS

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.

Printing with the raspberry pi

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.

Windows

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.

Linux

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.

macOS

At the bottom, press the Plus button. The printer will be detected automatically by Mac. Select and then click Add.

Android

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:

Benefits of Wireless Printing

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?

Mobility

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.

Accessibility

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.

Multifunctional

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.

Convenience

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.

Cost-effective

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.

What Can We Do With Our Printer?

Greeting Cards

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.

Print Your Artwork

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.

Business Cards

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.

Custom Napkins

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.

Conclusion

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.

Tweeting on Raspberry pi 4

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.ComponentsDistributorLink To Buy
1Raspberry Pi 4AmazonBuy Now

What will we learn?

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:

  • Consumers keys
  • Consumers secrets
  • Login Tokens
  • Login Secrets

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.

Step 1: To become a Twitter Developer, fill out the form below.

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.

Step 2: Create an application

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:

  • App name: a name that will help people remember your app (such as examplebot)
  • The objective of your application is described in the application description
  • Uses of the app: how customers will utilize your application
  • The uniform resource locator of your app's website is required; however, it could be a personal website's URL because bots do not require a URL to function.

Step 3: Create your Credentials for Authentication

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:

How can we set the app permissions?

Ensure that the "Read, access, and write direct message" is ticked in the "Permissions" section.

How can we Install Tweepy?

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:

How does tweepy work?

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:

  • Decoding and encoding of data
  • Hypertext transfer protocol requests
  • Results paging
  • Authentication
  • Rate restrictions
  • Streaming

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:

  • Redirect the user to the Twitter account to approve our application by obtaining a request tokens from Twitter
  • Twitter sends the user to our website whenever a callback is used. Otherwise, the user will have to enter the verification code manually.
  • Substitute an access token for the authorized request token.

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:

Tweet python code

How is API used in this library?

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:

User timeline methods

These ways allow you to read mentions, tweets, and retweets on your timeline and any other public user's timeline.

Tweet methods

These methods deal with tweet creation, retrieval, and retweeting. Tweepy is used in the following code to produce a tweet with specific text:

Users’ methods

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.

Follower methods

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.

Account methods

Using these methods, you may write and view your profile information. This code sample might be used to change your profile information, for example:

Likes method

You can designate any twitter message as Liked or delete the Like tag if it has already been added using these API calls.

Blocking user method

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:

Search methods

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":

Trend methods

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 methods

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:

  1. The stream object retrieves tweets that meet certain criteria using the Twitter API. A streaming listener receives tweets from this source.
  2. The streaming listener receives the tweets from the stream.

This is how you do it:

How about models?

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:

  1. Users
  2. Statuses
  3. Friendships
  4. Search Result

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:

  • favorite() to make it a favorite
  • favorite() to make it a favorite

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.

What is next after setting up our app?

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.

Conclusion

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.

Voice Control Project using Raspberry Pi 4

Welcome to the next tutorial of our Raspberry Pi programming course. Our previous tutorial taught us to make a button-controlled "music box" that plays different sounds depending on which buttons are pressed. In this lesson, we will configure our raspberry pi for voice control.

Where To Buy?
No.ComponentsDistributorLink To Buy
1BreadboardAmazonBuy Now
2DC MotorAmazonBuy Now
3Jumper WiresAmazonBuy Now
4Raspberry Pi 4AmazonBuy Now

What will you learn?

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.

What will you need?

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.

Getting started

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."

Basic voice commands used

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.

Configuring the Raspberry Pi master voice

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.

Vexing sounds and how to get rid of them

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.

How can we reduce vexing noise?

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.

Conclusion

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.

Implementing PWM with Raspberry Pi Pico using MicroPython

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 PWM

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.

PWM

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:

  1. Frequency
  2. Duty Cycle
  3. Resolution

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 =

  • The duty cycle is represented in the form of percentage (%) or ratio.

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:

  • Speed control of DC motor
  • Direction or position control of a servo motor
  • To control the LED brightness
  • Loudness control in buzzers
  • Measurements purpose
  • Controlling the fan speed

Software and Hardware Components Required

  • Raspberry Pi Pico Module
  • Latest version of Python
  • Latest version on Thonny IDE should be installed on your system
  • MicroPython setup installed in Raspberry Pi Pico
  • Breadboard
  • LED
  • Resistor (330 ohm)
  • USB cable

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

Programming Raspberry Pi Pico with MicroPython

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.

Installing Thonny IDE for Raspberry Pi Pico Programming:

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

Steps to write a program for LED brightness conrtol are:

  • Open the installed Thonny IDE for all users.
  • Connect the Raspberry Pi Pico development board with your system (laptop or desktop).
  • To create a new project; go to Files >> New.

Fig. 4 New Project

  • Connect the Raspberry Pi Pico board with laptop/desktop using USB cable.
  • Click on the ‘MicoPython(Raspberry Pi Pico)’ option from lower right corner in-order to select the interpreter for raspberry Pi Pico programming using MicroPython programming language. We already selected the one from lower right corner menu from the Thonny IDE window.

Fig. 5 Select Interpreter

  • Select interpreter ‘MicroPython (Raspberry Pi Pico)’ for Raspberry Pi Pico programming.

Image: 6 MicroPython for raspberry Pi Pico programming

  • You should see this MicroPython Version details in Shell section (to ensure that Thonny is ready to program your Raspberry Pi Pico board) as shown below:

Image: 7 Ready to program

MicroPython program to change the brightness of peripheral LED.

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

Save and test the PWM program

    1. Click on the ‘save’ icon to save the PWM program.

Fig. 13 Save the program

  1. After clicking on the ‘Save’ icon, an option ‘Where to save to?’ will pop-up. You can select any of the ‘Raspberry Pi Pico’ option.

Fig. 14 Save the program

  1. Run the program once it is successfully saved to change the LED brightness by clicking on the ‘Run’ icon as shown below:

Fig. 15 Run the saved program

Code

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)

Testing and Results

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

  • The results of the pulse width modulation implementation on LED are shown in the images attached below.
  • In the first image the LED brightness is very low.

Fig. 17 Brightness level 1

  • In the second image the LED brightness is slightly increased than the previous one.

Fig. 18 Brightness level 2

  • The third image represents the maximum brightness level.

Fig. 19 Brightness level 3

  • If you are not familiar with the PMW pin details we can the details of respective pwm pin using print command ‘pritn(“enter the pwm pin here”)’.
  • The image attached below represents the PWM pin details like to which slice and channel the PWM pin (GPIO 14) belongs.
  • As we can see from the image attached below that PWM slice is ‘7’ and channel is ‘0’.

Fig. 20 PWM pin details

  • We can also visualize the PWM output on Thonny IDE.
  • In Thonny IDE there is a ‘plotter’ feature available for graphical representation.
  • To enable the plotter feature, go to View and check the plotter option.

Fig. 21

  • Now you should see the plotter section on the right side of Shell

Fig. 22 Plotter

  • The duty cycle is printed in both Shell and Plotter using print()
  • The image attached below, represents the pulse width modulated output observed from the GPIO 14 PWM pin during rising edge (0 to 65535) or while the LED brightness increasing.

Fig. 23 Rising PWM output 0 to 65535 (brightness increasing)

  • Pulse width modulated output during falling edge or decreasing LED brightness (65535 to 0) is shown in the image attached below:

Fig. 24 PWM output maximum to 0

Implementing Pulse Width modulation with multiple LEDs

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:

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)

Code Description

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

  • Next we created a function ‘led_freq()’ to set the frequency at which pulse width modulation takes place.

Fig.27 PWM frequency

  • The programming part of increasing the and decreasing the brightness of LEDs is similar to the previous example.

Result

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

Conclusion

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.

Top Reasons for Microsoft SQL Database Failure 

Today all businesses utilize databases for practically all operations, ranging from sales & marketing to CRM. Hence, whenever organizations face a database failure, they are susceptible to losing crucial data that may be costly for the entire business. Microsoft SQL is a popular RDMS in all firms or organizations for professionally managing valuable data. SQLServer is incredibly useful in the business circuit, yet it has some corruption issues and errors that DBAs need to tackle strategically.

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.

Causes of SQL Database Corruption 

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.

File System Damage

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.

File Corruption

According to Small Business Chron, organizations of all sizes depend on SQLServer database from Microsoft for organizing and securing critical information. If one or even more database files are corrupted or damaged, they may result in database failure at your file-level leading to corruption. Files may be damaged because of numerous reasons. Primary files that are capable of corrupting the entire database, may themselves get corrupted because of any SQLServer account changes, file header corruption, and accidental data deletion, among many others. In case of corruption in secondary files, the SQL database will be inaccessible. When you attempt to access the damaged database, you will be getting different types of error messages. You may be several solutions for effectively repairing a corrupt database, but these solutions will not guarantee or assure you that there will be100 percent data recovery. You may consider using the log files for restoring the database. But remember that the log files are not adequate t help recover lost data in corruption cases since often backup files may get damaged if corruption seems to be severe.

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 & Software Failure

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.

Avoiding SQL Database Corruption: Some Expert Tips

  • Do not consider rebooting the server
  • During any ongoing script execution or other running database, jobs avoid abrupt shutting down the SQLServer.
  • Always keep proper backup and then upgrade your SQLServer
  • Don’t connect or re-connect the database.

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.

Conclusion

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!

Build a GPIO Soundboard in Raspberry Pi 4

Welcome to the next tutorial of our Raspberry Pi programming course. In our previous tutorial, we learned how to create a timelapse video with still images and understand how phototimer and FFmpeg work. In this lesson, you'll make a button-controlled "music box" that plays different sounds depending on which buttons are pressed.

Where To Buy?
No.ComponentsDistributorLink To Buy
1BreadboardAmazonBuy Now
2Jumper WiresAmazonBuy Now
3Raspberry Pi 4AmazonBuy Now

What you will learn

Connect button pushes to function calls using the Python gpiozero package and uses the Python dictionary data structure

Components

  • Raspberry Pi
  • Breadboard
  • Buttons
  • Jumper wires
  • Speaker

Set up your project

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.

Copy the sample sounds

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.

Convert the sound files

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.

How can we converting the media files?

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:

Running batch operations on a file using bash

What are batch operations?

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.

  • Try your first simple batch process with any directory containing a few files. The first thing you should do is try something simple.

The first step is to notify bash that you wish to work with all the files inside the folder.

  • f will be used to denote each directory listing inside the folder individually.
  • After that, you must instruct bash which operations to perform on each file. The file name should be echoed to standard output in this scenario.

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.

How do we manipulate strings?

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.

  • If you run ls in the terminal, you'll notice that all files will be renamed. So, how did it all come together?
  • The first portion of the f inside *.txt instructs bash to do the action on all files ($f) with the.txt extension.
  • The command does mv $f instructs bash to relocate each file. After that, you must tell bash what the new name of the relocated file is. To do so, delete the.txt extension and replace it with .md. Fortunately, bash includes an inherent operator for removing string ends. Please take a look at this sample to understand how it works.
  • At this point, you may add something more to the string's end.

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.

How do we play sounds using python?

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 begin building the components for your musical instrument, you'll need to see if Python will play any of the audio files you've copied.

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.

Hint

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.

Connect your buttons

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.

How can we use a button with a Raspberry Pi?

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.

Hint

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.

Play sounds at the press of a button.

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.

How can we improve our script?

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.

  1. Readability

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.

  1. Scalable

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.

  1. Testable

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.

  1. Meet functional requirement

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.

  1. Gracefully fails

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.

  1. Extendable

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.

  1. The Code Is Reusable

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:

Conclusion

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.

How to Create a Time-Lapse Animations with Raspberry Pi 4

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.ComponentsDistributorLink To Buy
1Raspberry Pi 4AmazonBuy Now

What is time-lapse?

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.

Components

  • Raspberry pi 4B
  • Pi camera

Connect to the Raspberry Pi

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;

  • Turn off the pi

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.

  • Locate the camera port and lift the tabs to install the camera's cord.
  • Secure the tabs on the flex cable after inserting it into the flex cable slot.

Slide the cord into the port by using an image as a guide. Finally, press down tabs, securing the cable to the motherboard.

Enable the camera in Raspberry Pi OS

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.

How to record time-lapse images

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:

  • Using the raspistill tool on the Rpi alone
  • Using phototimer
  1. Using the Raspistill tool only

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.

How can we use this tool?

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.

How can we compile the to a video?

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.

What is FFmpeg?

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.

  1. Using Photo timer

A Python library named phototimer will be used to control the raspistill command-line that comes pre-installed on the Raspbian OS.

  • With the use of this tool, we're able to add valuable features like:
  • Set a time frame for your day.
  • After capturing a photo, create a date-based folder such as:

Let us install docker to use this tool

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.

  • Automatic restarts of the time-lapse

A new location does not necessitate an SSH login. The lapse of time will be restarted.

  • Easy setup

Download the Docker image, activate the camera interface, and start the container instead of executing a git clone on each device.

  • Easy access to logs

If you disconnect from the container, docker will keep track of the log information and will enable you to reconnect at any time.

Install Docker in Raspberry pi

We can easily set up docker with the following set of commands.

Clone the phototimer GitHub repository

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:

Edit the config file

By modifying the config.py file, you can change the time-appearance lapses and duration.

  • Set the hours

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.

  • Set the quality level

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.

  • Flip the image

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.

  • Height and Width

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.

Now let`s build a Docker container

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:

Start the timelapse

Let us configure the time zone for docker

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.

How can we save the file to our laptop?

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.

Connectivity options

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:

Use a USB OTG cable

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.

Drop a wpa_supplicant.conf file into /boot

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.

Setup the RPi as a wi-fi hotspot

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.

How to edit the video

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.

  1. Transfer files to the Raspberry Pi using SCP

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.

  1. Enable SSH

You must activate ssh on your Raspberry Pi to use SCP.

Converting to GIF

A free program like Giphy can help you convert the videos to a GIF; however, this will lower the number of frames.

Conclusion

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.

Real-Life Examples of Workflow Automation

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.

Real-Life Examples of Workflow Automation

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.

1: Creating Expense Reports

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.

2: Onboarding New Hires

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.

3: Instant Task Creation

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.

4: Organizing Leave Requests

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.

5: Simplified Data Procurement

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.

6: Effective Customer Support

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.

7: Faster Invoice Generation

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.

Final Thought

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.

Introduction to Organic Chemistry

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.

Introduction to organic chemistry

Old Definition:

“The chemistry of compounds obtained from living things.”

Vital force theory

Swedish Chemist Jacob Berzelius put forward this theory in the 19th century.

State

“ 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.”

  • This theory falls in 1828 when Wohler prepared urea by heating it from ammonium cyanate.

Equation

 
  • Also in 1845 when Kolbe prepared acetic acid in the laboratory.

Advanced definition;

The branch of chemistry in which we study hydrocarbons and their derivatives is known as organic chemistry.

Organic Compound:

Organic compounds belong to hydrocarbons and their derivatives which are covalently bonded to carbon.

Examples

There are so many examples of organic compounds

  • Carbohydrate
  • Artificial fibers
  • Fertilizers
  • Plastics
  • Paints
  • Dyes
  • Pharmaceutical products
  • Lipids
  • Enzymes etc.

Chart

Formulas of organic compounds:

Organic compounds had six types of formulae;

  1. Molecular formula
  2. Structural formula
  3. Condensed formula
  4. Dot and Cross formula
  5. Empirical formula
  6. Skeleton formula

Molecular formula:

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.

  • Methane is made up of one carbon atom and four hydrogen atoms.
  • Each molecule of methane consists of one carbon atom and four hydrogen atoms.

Structural formula

The formula of organic compounds shows the actual arrangement of different atoms of various elements present in a molecule.

  • The structural formula of organic compounds differs but may have the same molecular formula as propane
  • A single bond represents a single line(__)and double bond show double lines (=) and a triple bond show three lines in a structural formula.

Example

The structural formula of propane is

Iso_ propane

Condensed formula

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

Electronic or Dot and Cross formula

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

Empirical formula

In which whole, no ratio of different atoms in a compound gives the empirical formula of organic compounds

Example

Skeletal formula

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

Classification of organic compounds:

Depending upon their carbon atoms, organic compounds are divided into two categories.

  1. Open chain or acyclic compounds
  2. Closed chain or cyclic compounds
Open chain or Acyclic compounds:

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

  • Straight chain compounds
  • Branched-chain compounds

Straight 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

  1. Homocyclic or carboxylic compounds
  2. Heterocyclic compounds

Homocyclic or carbocyclic compounds

These compounds are made up of rings of carbon atoms. These are further divided into two groups.

  1. Aromatic compounds
  2. Alicyclic compounds

Aromatic compounds

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

Alicyclic compounds Or none_benzenoid compounds

These are called none_ benzenoid compounds because the benzene ring is not present in these compounds.

Example

Heterocyclic compounds

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

Chart

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.

Major sources of organic compound

From plants and animals, organic compounds are naturally prepared.

From animals:

Protein and fats are the two major groups of organic compounds that are synthesized by animals.

  • Protein included chicken, egg format and mutton, etc.
  • In milk and butter fats are present.

From plants

Plants could be prepared

  • Fats
  • Vitamins
  • Proteins
  • Carbohydrates

From dead plants through a biochemical process, we obtain

  1. Coal
  2. Gas
  3. Petroleum

By the destructive distillation of coal and petroleum, we obtain thousands of organic compounds.

Coal

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.

Distilled products of coal

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.

Products:

  1. coal gas
  2. coke
  3. Coal tar
  4. Aluminum liquor

Fractional distillation of coal

Coke

When coal is passed through the destructive distillation process. A solid residue left behind and lost all of its volatile elements is called coke.

Fractional distillation

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.

Uses of coal

  • Used in the preparation of nitrogenous fertilizer.
  • Used in roads and leveling of roads.
  • In the extractions of metals, especially iron is used as a reducing agent.
  • Used mainly in fuel.
  • Used in plastics, synthetic fibers, and pesticides.

Chart

The below chart shows the uses and types of coal

Petroleum

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.

As a Source of organic compounds

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

Natural gas consists of serial gases like 85% of methane, nitrogen gas, carbon dioxide, propane, butane, and ethane.

Uses

  • Used in fertilizer
  • Making carbon black
  • Compressed natural gas (CNG) is used in automobiles.
  • Use in different industries and as well as in homes.

Plants

Macromolecules are formed by living plants

  • Oils
  • Vitamins
  • Proteins
  • Carbohydrates

Use

  • Gums
  • Rubber
  • Medicines

Prepare in laboratory

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.

But

A large amount of the organic compounds, almost more than ten million are synthesized in a laboratory.

  • Wohler synthesis urea in laboratory
  • Kolbe prepared Acetic acid
  • Drugs and medicines
  • Fragrance and flavors
  • Pesticides and insecticides
  • Synthetic rubber and fibers
  • Plastic and paints.

Synthesized products in the laboratory from animals and plants

Urea

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.

Natural Rubber

Synthetic rubber has much more qualities than natural rubber-like

  • Non-inflammable
  • Resist high temperature
  • No reaction between ozone and oxygen

Synthetic fibers

Different fibers are made in laboratory-like

  • Nylon
  • Rayon
  • Polyester etc.

Natural fibers have better properties than synthetic fibers like

  • The ability of low water absorption
  • Greater strength
  • Good elasticity

Drugs and medicines

All proteins, sweeteners, vitamins, drugs, and medicines are being prepared in laboratories.

Uses of organic compounds

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.

Use in food

We use different organic stuff daily such as milk, eggs, vegetables meat, etc. contain protein, vitamins, fats carbohydrates, etc.

Use in cloth

Natural fibers and synthetic fibers, all are organic compounds used in cloth making that we use daily for wearing bedsheets, etc.

Use in raw materials

A variety of organic compounds are used in raw materials such as

  • Drugs
  • Paper
  • Ink
  • Dyes
  • Paints
  • Pesticides
  • Rubber etc.

Use in wood

cellulose naturally occurring organic compound in wood that is used for making furniture and housing.

Use in fuel

Coal, petroleum, and natural gas are all organic compounds called gospel fuel that is used for domestic purposes and automobiles.

Use in medicine

antibiotics (kill or inhabitants of microorganisms that cause infectious diseases) are life-saving medicines.

Characteristics

The general characteristics of Organic Compounds include:

  • Can be separated as well as prepared in the laboratory
  • Comprise almost 90% of all known compounds.
  • Mostly accumulated of only three elements- carbon, hydrogen, and oxygen. Other elements like halogen and nitrogen besides phosphorous are also existing but to a small extent.
  • Retain complex patterns and high molecular weights
  • Their properties are determined by a specific active atom or group of atoms recognized as the functional group.
  • They are primarily insoluble in water but soluble in organic solutions.
  • They are flammable
  • Chemical reactions comprising organic compounds continue at slower rates.

Characteristics due to Presence of Covalent Bonds

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:

  • Low melting points and boiling points.
  • Organic acids and bases are powerful and thus they have a particular dissociation in an aqueous medium.
  • They express the process of isomerism in which an isolated molecular formula characterizes several organic compounds varying in physical and chemical properties.
  • They are flammable.

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:

  • A common formula defines the members of the homologous series.
  • Succeeding members differ from each other by CH2CH2
  • Physical properties change regularly with an increasing number of carbon atoms.
  • Members have similar chemical properties because they have an identical functional group because can be assembled using the same method.

Significance of Organic Compounds

  • Organic compounds are important because all inhabiting organic compounds contain carbon.
  • While carbohydrates, fats, the basic structures of life, are organic compounds
  • They are the basic units of many of the cycles that move the earth. For instance, the carbon cycle comprises the deal of carbon between plants and animals in photosynthesis and cellular respiration.
  • Organic compounds get together with metals to form organometallic compounds. These compounds are valuable industrially. They are employed as catalysts, promoters, analyzers as well as stabilizers.

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

How Workflow Automation Can Benefit Small Businesses?

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.

How Workflow Automation Can Benefit Small Businesses?

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.

Benefits of Automating Your Business

The following are the core benefits of incorporating automation into your business.

 

Increased Productivity

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.

Lower Costs

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.

Get Creative

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.

Remote Work

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.

Business Tasks That Require Automation

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.

Expense Reimbursement

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.

Onboarding New Hires

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.

Vacation Requests

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.

Data Procurement

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.

Instant Invoice Generation

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.

Final Thought

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.

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir