Hardware programming - Getting started.

in stemng •  6 years ago 

Hello Steemians!
If you are a tech enthusiast or have been fascinated with the ability to control mechanical and/or electronic equipment (such as motors, levers, pumps bulbs etc) to behave in a specific or pre-set pattern, or how some object react based on the environment or changes in the environment or have thought of automating a physical object one way or the other or wanted to build your own mini robot to some things you want the way you want then you are on the right blog.

Consequently I would post projects that I have done while giving a thorough breakdown of components used (mechanical, electrical and electromechanical) and computer codes and walk you through creating some amazing projects of your own. But for this post we would be giving an insight on the topic at hand.



CC0 Public Domain

What is hardware?

No doubt the word hardware is widely used and could mean variety of thing depending on how it used. In information technology, hardware is the physical aspect of computers, telecommunications, and other devices. The term arose as a way to distinguish the “box” and the electronic circuitry and the components of a computer from the program you put in it to make it do things (the program came to be known as the software).

In summary hardware is the physical part or component of a system. And this would include mechanical components (e.g switches), electrical components (e.g LED) and electromechanical components (e.g Motors)

What is programming?

Programming is the process of designing and building executable program that carries out a given computing task. A program is a set of instructions that tells a computer how to perform a task. Simply put programming is the process of writing instructions that get executed by computers. The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solving a given problem.

So what do I mean by hardware programming?

In the modern society today, almost every mechanical and electrical system contains some kind of computer based system. These mechanical and electrical system could be for example a toaster, a toy to more advance system like an industrial robot or self-driving cars. This computer system controls the mechanical and/ or electrical system by executing the programs already stored on it. So that act of controlling the hardware with a program is HARDWARE PROGRAMMING

Still not clear?



Image created by me @oladelefat with Fritzing

To the basics, let’s look at the most basic circuit, a LED/ or bulb. Connecting the LED/bulb to a power source (DC for LED and AC/DC for bulb. For ease of communication I would reference only DC) would make the LED/bulb turn on. For as long as both terminals are connected to the power source and the power is still active the LED/bulb stays on. A switch is applied to be able to turn the LED/bulb on or off easily without removing the connection from the power source terminals. What the switch does is to break or make the circuit easily.



Image created by me @oladelefat with Fritzing

Now let's imagine we want the bulb to stay on for a predefined amount of time then go off for another predefined time before coming on for example the traffic lights the red, yellow and green individually turn on and off and intervals, the manual way to this this will be to stay with the switch and turn it on and off when required, but that will ineffective. That where the computer system comes in play. You define the on and off timing as a programme that the computer system will execute. How does it work? The computer system acts like the switch and makes or break the circuit according to the instructions defined in the program it executes (more details later). Isn’t that more convenient?

Microcontrollers: The brain of hardware programming



Wikimedia Creative Commons Attribution 3.0 Unported - Atmega microcontrollers

Different kinds of computers are designed for different purposes. The computer at the heart of your laptop is optimized for different purposes than the one in your phone or the one in your mouse. The simplest computers are those that are designed to take input from the physical world and control output devices in the physical world. These are called Microcontrollers

Most electronic devices you use today have a microcontroller at their core. Microcontrollers are optimized for control of general input and output. They’re generally less computationally capable than the processors used in multimedia computers or servers, for example. They require less power than those other processors, and they’re easier to interface with the physical world through input circuits called sensors and output circuits called actuators. They can communicate with other processors through various communication interfaces.

Computer, microcontroller, processor? Which is which?

You’ll hear these terms thrown around interchangeably here and in other writing about computers. Computer and processor are generic terms for the anything that can run a program, basically. Controller or microcontroller is usually reserved for a simple processor that does only one task, like listening to sensors. In explaining microcontrollers, we’ll distinguish them from personal computers or servers, which contain more powerful processors that can run an operating system.

When you’re building something that hardware, it’s common to use microcontrollers to sense the user’s actions, then pass information about those actions to a multimedia processor like the one in your laptop. Keyboards and computer mice have microcontrollers inside that communicate with personal computers using the USB communications protocol.

Microcontrollers come in many different size packages

Like any other computer, a microcontroller has to have input ports to detect action by a user, and output ports through which it expresses the results of its programs. The metal pins or contact points on a microcontroller are the inputs and outputs. Other devices, like light, heat, or motion sensors, motors, lights, our sound devices, are attached to these pins to allow the microcontroller to be sensitive to the world and to express itself. A microcontroller also requires power connections and communications connections, just like any other computer.

There are several different types of microcontrollers. The simplest have very little program memory, only one or two GPIO (General Purpose Input Output) pins (more details on GPIO later) and no specialty functions. Slightly more capable ones will have more memory, more GPIO pins and will include specialty functions as well. More powerful than those are the controllers that have connections to interface to a display screen, like those in your mobile phone. The more memory, processing power and input/output ports that a microcontroller has, the more expensive it tends to be.

Complex electronic devices like mobile phones or media players or televisions often contain multiple microcontrollers. A very simple controller might be used to control the power systems for the device, another might control the physical input interface, like the touchscreen of a phone or the remote control of a TV, another might control the display, while a more powerful processor controls the whole system, communicating with each lesser processor as needed. When your device is complex enough to need an operating system, then the control of displays, power, and physical IO is usually farmed out to microcontrollers, while the central processor runs the operating system.

Microcontrollers generally run just one program as long as they are powered. That program is programmed onto the controller from a personal computer using a dedicated hardware programming device. The hardware programmer puts the program on the controller by shifting the instructions onto it one bit at a time, through a set of connections dedicated for this purpose. If you want to change the program, you have to use the programmer again.

So what can you do with hardware programming?

The applications are limitless, but we would be focusing on two main applications, robots and home automation.

  • Robots overview

A robot is a machine (especially one programmable by a computer) capable of carrying out a complex series of actions automatically. Robots can be guided by an external control device or the control may be embedded within. Robots may be constructed to take on human form but most robots are machines designed to perform a task with no regard to how they look.
Most robots today are used to do repetitive actions or jobs considered too dangerous for humans.

You might have asked yourself ‘’why use robot?”

Apart from the fact that they are cheaper to use over humans (apart from the initial cost of purchasing or developing the robots they don’t need wages). Robots can do the same task over and over again without getting bored. In almost all cases robots are more accurate than humans (which can cut back on production costs, mistakes or hazards), robots don’t get sick, don’t eat food, don’t take the day off and don’t complain.

Robots are centred on three major part: The mechanical parts; motors, pistons, grippers, wheels etc. They make the robots move, grab, turn and lift. These parts are usually powered by air (pneumatics), liquid (hydraulics) or electricity. The sensors; any device used to detect events or change in its environment which could any of light, motion, temperature, magnetic field, gravity, humidity, moisture, vibration, pressure, sound and other physical aspects of the external environments . It is used to tell about its surrounding. The brain; a robot brain (or control) more or less is centred on a microcontroller. A robot control system uses feedback just as the human brain does. Our brains decide on what to do and how to react to the world based on feedback from our five senses, a robot’s computer system does the same thing based on data collected by the sensors.

  • Home automation overview.

Home automation is a way of controlling lighting, climate, entertainment systems, and appliances remotely or automatically. It may also apply to home security such as access control and alarm systems. For instance you want your water pump to start automatically immediately the water level in the reservoir drops below a predefined value or you want the security light of your home to switch on once it’s dark without your interference.

So what do I need to get started?

The most important component for this learning process is the microcontroller, so picking the right one is the first task. For that we would an Arduino board. The Arduino is a very popular, inexpensive and also simple to use microcontroller board. Other hardware includes; jumper wires, breadboard, resistors, batteries, LED, motors (including stepper and servo motors), sensors (motion detection sensor, ultrasonic sensor, tilt sensor, flame sensor, photo resistors etc.), buzzer
Conclusion

More details on this components to come in consequent posts along with fun projects to carry out with them.

Thanks and until next time, keep steeming!

References

edx: computer programming
Wikipedia: computer programming
ITP: Microcontrollers: The Basics
tretton37: Introduction to hardware programming(part1)
Idaho public television: Robotics: Facts
Wikipedia: Sensor
SearchNetworking: Hardware

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://itp.nyu.edu/physcomp/lessons/microcontrollers/microcontrollers-the-basics/

Welcome to steemSTEM

SteemSTEM wants to reward original scientific content and create a nice and constructive environment of scientific people, while also making science more fun.
I appreciate that you sourced some of the information but the percentage in which your article relies on sources is too great. Basically there is too little original content to call it an original article.
I am sure that you can do better and provide your own view on the subject. You can give us the information as further reading, but keeping it original will actually help steemSTEM and even you.

Cheers!

🚀 This is a stellar post! 🚀

I will be featuring it in my weekly #technology and #science curation post for the @minnowsupport project and the Tech Bloggers' Guild! The Tech Bloggers' Guild is a new group of Steem bloggers and content creators looking to improve the overall quality of our niche.

Wish not to be featured in the curation post this Friday? Please let me know. In the meantime, keep up the hard work, and I hope to see you at the Creators' Guild!


If you have a free witness vote and like what I am doing for the Steem blockchain it would be an honor to have your vote for my witness server. Either click this SteemConnect link or head over to steemit.com/~witnesses and enter my username it the box at the bottom.

Nice article. Great read.

Thank you for the comment.

Congratulations @oladelefat! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

The Steem blockchain survived its first virus plague!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!