Introduction to Atoms

Hello, friends today we will discuss the basic concept of chemistry it is our first tutorial series in which we will discuss:

  1. Atom
  2. Molecule
  3. Ion
  4. Molecular ion

Now in this article, we will discuss atoms. Its definitions, examples, properties, its evolutionary history, and also some important facts in the form of questions.

Atom

Definitions

A tiny particle that cannot be seen with a naked eye so-called atom.

Or

Atom is the lowest unit of matter and is often divided without the discharge of electrically charged particles.

Or

Atom is the introductory structure block of chemistry.

Examples

From molecule;

Hydrogen (H2)

  • It has two atoms.

Nitrogen (N3)

  • It has three atoms

From elements;

Helium(He)

  • It has two electron

Properties

We discuss different properties of atoms like:

Atomic no:

The no of protons present in the nucleus of an element is called atomic number Or nuclear charge no.

. Its symbol is Z.

  • Always a whole no
  • No effect of neurons on atomic no.
  • Always give a smaller value than atomic mass.

Examples

  1. Carbon has 6 protons in its nucleus so its atomic no is Z=6
  2. Sodium has 11 protons .so Z= 11

Atomic mass

The sum of the numbers of neutrons and protons in the nucleus of an atom is called atomic mass or mass no.

  • It is represented by A and calculated as A=Z+n
  • Where n is no of neutrons and Z is no of protons
  • It always is greater than atomic no.
  • It is affected by the addition of neutrons.

Example

Sodium has 11 electrons = 11 protons and 12 neutrons in an atom. So its mass no is

A= 11+12= 23

Periodic table

In this table, we can see atomic numbers, atomic mass, and symbols of atoms. Above the symbol is atomic no and below is the atomic mass.

Atomic size.

  • We can not measure the size of an atom because atoms have no boundaries and they are very tiny, so can assume spherically
  • It decreases if the atomic no is decreased from left to right in a period.
  • In groups, atomic size gradually increases from top to bottom.

Atomic radius

The distance between the nucleus and the outermost orbit of the electrons of an atom is called atomic radius or atomic radii.

Relative atomic mass

The relative mass unit or atomic weight open element is defined as the number of atoms of an element in grams contained in 12 grams of carbon _12(isotope)

Atomic mass unit

The atomic mass unit or Dalton is defined as the one-twelfth of the mass of a carbon atom.

  • It is also called Dalton.
  • Its symbol is amu.

Interactions between atoms ( bonds)

Types of bonds

  • Ionic bond
  • Covalent bond
  • Dative covalent bond
  • Metallic bond

Ionic bond:

This type of bond is formed by the complete transfer of an electron from one atom to another.

Example

  • Only valence electrons( electrons in the last shell) can take part in ionic bonding while others are not.
  • In ionic bond formation, heat is released.

Covalent bond:

In this type of bond, electrons are mutually shared between two atoms.

Types

  1. Single covalent bond
  2. Double covalent bond
  3. Triple covalent bond
  4. Metallic bond

Single e covalent bond:

In which one bond pair of electrons is formed by the contribution of an electron by each bonded atom.

  • Indicated by a single line

Double covalent bond:

In which two bond pair is formed by the contribution of electron pair from each atom.

  • Indicated by double lines

Triple covalent bond:

In which three bond pairs are formed by the contributions of three electrons from each bonded atom.

  • It is indicated by three lines.
  • Each bonded atom attains octet by sharing of bond pair of electrons and attaining the nearest noble gas configuration.

Dative covalent or coordinate covalent bond:

A bond is formed between the electron pair donor and the electron pair acceptor.

  • The atom which invests a pair of electrons is called a donator.
  • The atom that receives that electron pair is called the acceptor.
  • Those valence electrons that are not taking part in bonding and available on an atom like the one available on nitrogen in ammonia.

Example:

Polar covalent bond:

Those covalent bonds in which hetero atom takes part and one attracts the bond pair of an electron more strongly than the other.

None polar covalent bond:

If a covalent bond is constituted in which two similar atoms shared pair of the electron is excited by the both equally. such a type of bond is called a nonpolar covalent bond.

Predominantly covalent:

If the electronegativity between two elements is more than 1.7 the bond between them will be predominantly ionic and if it is less than 1.7 the bond between two atoms will be predominantly covalent.

Metallic bond:

A metallic bond is formed due to free electrons.

Evolutionary history of the atom

Timeline: 400 BC.

Scientist: Democritus

Theory of universe:

A first-person who uses the term atom(mean individual derived from atoms) was a Greek philosopher. He says that if you divided a piece of matter and divide and continue dividing, at any moment reach when you can’t divide it more, that fundamental unit was Democritus called an atom.

  • Atom is made from matter and can not be seen by the necked eye.
  • Between atoms, there is a space.
  • Atoms are in the form of a solid-state.
  • There is no internal structure in an atom.
  • Every atom has a different shape, size, and weight.

Timeline:1800s

Scientist: Jhon Dalton

  • The first person presents an atomic model of the behavior of the theory of the behavior of atoms consisting of small particles.
  • Atoms cannot change their shape and are indestructible.
  • By the weight of atoms, their elements can be characterized.
  • Atoms combined to firm a compound.

Timeline: 1890s.

Scientist: Thomson

J.JThomson was a physicist who use cathode ray tube technology to discover electrons.

  • In this tube, the air has been sucked out.
  • An electric charge travels from cathode to anode
  • Florescent gas light up the whole tube and the charge in it is invisible. When a charge hits the beam, a dot will appear on the screen.
  • A beam of light travel in a straight line in a fluorescent tube.
  • Each coil has a specific charge on a deflection.
  • From a negative coil, the charge would defect away as Thomson shows.
  • So he formed that charge this a negative charge.

When he found that negative charge, he did not stop and did a series of experiments, he discover the mass of the electron. He found that the mass of an electron is 1000 times lighter than a hydrogen atom. He made a statement saying that an electron must be inside an atom. Before it, he says the negative charge corpuscles later his name was changed and named as an electron.

Thomson’s atomic model

Using her prediction, he discovered what an atom looks like?

  • His model was named plum pudding model his name.
  • Each atom has a spherical shape and is inserted with positively charged fluid. He says it sticky jam part of a pudding.
  • In this fluid, corpuscles (electrons) are the negatively charged particles suspended. He compared it to plum in the pudding.
  • The movement of these electrons is not discovered by Thomson.

Timeline: 1910’s.

Scientist: Ernest Rutherford

Sir Rutherford made a famous gold foil experiment and proved the Thomson atomic model.

  • He fired positively charged alpha particles at a gold foil.
  • He estimated the deflection came out the other side.
  • Every particle has not been deflected. Every particle would deflect back in all the ways.
  • He assumed that the center of the foil must be positive. He called his nucleus.

Rutherford's Atomic model

  • The nucleus consists of positively charged particles.
  • The electrons revolve around the nucleus.
  • He faces one problem: Why nucleus can’t attract the electrons?
  • He compared the atom with a mini solar system in which electrons revolve around the nucleus in a fixed orbit due to this he called his planetary model

Timeline:1910’s

Scientist: Neils Bohr

Niels obeys the planetary model but he found some disadvantages. He could answer the Rutherford question

Why electrons do not fall into the nucleus?

He replies with a perfect answer to the question because of his knowledge of quantum physics and energy.

Bohr's atomic model:

  • Electrons have fixed energy and size in orbits of the nucleus.
  • The energy of an electron depends on the orbit in which the electron revolves.
  • Electrons fill the lower orbit first.
  • If the first energy level(orbit) is filled then the next will began to fill.
  • When an electron moves from one orbit to another, the radiation process occurs.

There is a problem with this theory: Electrons could not move in a specific path or orbit.

Timeline:1920’s

Scientist: Erwin Schrodinger

He was a revolutionary physicist and he presented the atomic model by using Heisenberg’s uncertainty principle.

Schrodinger’s atomic model(Aka the cloud model)

  • An electron would not revolve in a fixed orbit.
  • We can find out where it likely is.
  • Energy level depends upon the type of probability of orbit described by Bohr.

Facts

What is not an atom?

By the definition, atoms are the units of matter, so those are not atoms that do not consist of matter.

Parts of atoms that are not associated with a proton are not atoms.

An electron is not an atom, also neutrons bonded to other neutron is not an atom.

Why does an atom react?

Atoms react for attaining the nearest noble gas configuration and become more stable by following the duplet or octet rule.

Why the shape of the atom is spherical?

We can say that an atom “has the shape of the sphere” because a positively charged nucleus is at the very center, and the negatively charged electrons are distributed around it. The electrons are attracted to the nucleus and repel each other. A nucleus, the mass of neutrons and protons within an atom, arranged itself in a roughly spherical shape.

Why the revolving electron does not fall into the nucleus?

Electrons revolve in fixed energy levels around the nucleus. It can not befall into the nucleus because electrons do not radiate energy and move in a circular orbit due to necessary centripetal force.

Why neutrons are neutral and do they exist in the nucleus?

We have an idea from its name, the neutron is the neutron. In other words, the interaction between protons and electrons can cause the formation and destorarion of neutrons. As electrons are negatively charged and protons are positively charged particles. So they cancel each other charge and that’s why neutrons carry no charge and they are neutral. They exist in the nucleus for the stability of nuclei.

Why carbon 12 is used in the references of all atomic mass units?

At the start, hydrogen is used to measure but it gives a fraction. so it would be changed into oxygen, Scientists used a mixture of natural oxygen but it led to confusion. So again changed the reference and turned it into carbon – 12. We use this because it gives all the atomic mass units in exact no. The reason is the different ratio of the mass of proton and neutron performing the change of nuclei.

I Hope, I cover all aspects of the atom, in the next tutorial we will learn about the molecules. If someone has any questions about the atom I will try to answer them. write it in the comment box. Thanks

Raspberry Pi Pico Dual Core Programming with MicroPython

Hello readers, I hope your all are doing great. We know that a Raspberry Pi Pico module comes with multiple inbuilt features for example onboard memory, processing units, GPIOs or General Purpose Input Outputs (used to control and receive inputs from various electronic peripherals) etc.

In our previous tutorials, we discussed how to access GPIO pins of the Raspberry Pi Pico module for both input as well as output operations.

In this tutorial, we are going to discuss another important feature of the Raspberry Pi Pico module (RP2040) which is Dual Core Processor. The Pico board features with 133MHz ARM Cortex-M0+, Dual Core Processor. This dual-core feature makes the Pico module capable of multiple thread execution or multithreading.

Now before writing the MicroPython program let’s first understand the concept of the dual-core processor in the Raspberry Pi Pico module.

Fig. 1 raspberry Pi Pico dual-core programming

Raspberry Pi Pico Dual Core

A core is the basic unit of any processor which is responsible for executing program instructions. A multi core processor comes with the features of executing multiple tasks at a time. Multithreading is the ability of a processing unit to provide multiple threads of execution simultaneously (operating system supported). In multithreading, threads share their resources with each other. So this dual-core processor feature results in increased processing speed.

Raspberry Pi Pico (RP2040) module is having two processing cores, Core0 and Core1. In the default mode of Raspberry Pi Pico program execution, Core_0 executes all the tasks and Core1 remains idle or on standby mode. Using both the cores of RP2040 provides us with two threads of execution and hence a more powerful project with better processing speed.

Both core0 and core1 execute their assigned tasks independent of each other while sharing all the resources like memory space and program code with each other. Sharing the memory location between two cores can create race conditions and hence can cause trouble when mutual memory accessing is not assured. On the other hand, sharing program code with each other (core0 and core1) may sound troublesome but practically it is not. The reason is fetching code is a read instruction that does not create a race condition.

Core0 and Core1 communication

Fig. 2 Core_0 and Core_1 communication

As we mentioned above, sharing memory space with two cores simultaneously can cause race conditions. So, to make the cores to communicate with each other the Raspberry Pi Pico module is featured with two individual ‘First In First Out’ (FIFO) structures. Each core can access only one FIFO structure so both core have their own FIFO structure to write codes which helps in avoiding race condition or writing to the same memory location simultaneously.

You can follow the given link for detailed study on Raspberry Pi Pico: https://www.theengineeringprojects.com/2022/04/getting-started-with-raspberry-pi-pico.html

Software and Hardware components required

  • Raspberry Pi Pico development board
  • Thonny IDE
  • Data cable
  • Connecting wires
  • Breadboard
  • LEDs

Programming

The development environment we are using is Thonny IDE, to program the Raspberry Pi Pico board for accessing the dual core feature with MicroPython programming language.

So, before writing the MicroPython program user need to install the respective development environment.

We already published a tutorial on how to install and access Thonny IDE for Raspberry Pi Pico programming using MicroPython programming language. You can find the details at the given link address: https://www.theengineeringprojects.com/2022/04/installing-thonny-ide-for-raspberry-pi-pico-programming.html

Now let’ write a MicroPython program with Thonny IDE to access raspberry Pi Pico’s both cores:

In this example code we using just a simple “print()” commands to print the messages from each core for testing purpose.

  • The first task while writing a code is importing necessary libraries. Here we are importing three libraries, “machine”, “utime” and “_thread”.
  • utime library provides the access to internal clock of raspberry Pi Pico module which is further used to add delay when required.
  • _thread library is responsible for implementing the threading function provided by “Raspberry Pi Pico” community.
  • As we are using a dual core processor and accessing both the cores simultaneously means we are using two threads (one thread from each core). This _thread module allows a user to work with multiple threads and also allow them to share global data space.
  • For more details on _thread module follow the given link: https://docs.python.org/3.5/library/_thread.html#module-_thread

Fig. 3 Importing necessary libraries

  • Semaphores or Simple locks are provided with “_thread” module which is responsible for synchronization between multiple threads. The allocate_lock() function provided with _thread module is responsible for returning a new lock object.
  • Here we are declaring a “spLock”

Fig. 4 declaring thread lock object

  • Next, we are creating a function where we are assigning the task to core_1.
  • The “spLock.acquire()” function “acquires the thread lock without any optional argument”. The reason for using the this “acquire()” function is to make sure that only one thread of execution is acquiring the lock at a time until the lock is released for other thread. Here we using the “print()” command as a task assigned or to be executed by core_1 along with a delay of 0.5sec or 500us.
  • Next, is the release() command, which is used to release the lock acquired earlier. So that other threads can execute their respective tasks.
  • The task assigned to core_1 will be executed continuously because it is written in “while loop”.

Fig. 5 Task for Core_1

  • The function core1_task() defined earlier which is containing the task assigned to core_1 will be passed as an argument inside start_new_thread() function. As per the official documentation from python.org, this function is responsible for “starting a new thread and returning its identifier”. The thread will execute the assigned function (as an argument). The tread will automatically exit when the function returns. We can even assign more than one argument in this “-thread.start_new_thread()” function.

Fig. 6 Core_1 thread

  • As we mentioned earlier, Raspberry Pi Pico uses core_0 as default a core for processing purpose. So here we do no need to use the _thread.start_new_thread() function to start a new thread for Core_0. Core_0 will automatically start a thread for code execution. But we still need to call the acquire(a lock) and then release functions, just to ensure only thread is acquiring the lock at a time. Here again we are using the print() command to print a message from core_0 like we did in case of Core_1.

Fig. 7 Task for default core (core_0)

Code

The MicroPython code with thonny IDE for Raspberry Pi Pico is written below:

import machine

import utime # access internal clock of raspberry Pi Pico

import _thread # to access threading function

spLock = _thread.allocate_lock() # creating semaphore

def core1_task():

while True:

spLock.acquire() # acquiring semaphore lock

print( "message from core_1")

utime.sleep(0.5) # 0.5 sec or 500us delay

spLock.release()

_thread.start_new_thread(core1_task, ())

while True:

spLock.acquire()

print( "message from Core_0 ")

utime.sleep( 0.5)

spLock.release()

  • Copy the above code and paste in your Thonny IDE window.
  • Save the code either on Raspberry Pi Pico or your computer and once it is successfully saved click on the ‘Run’ icon to run the code.
  • Now go to Shell section to check the result. If the Shell is not enabled then go to View >> Shell and check ‘Shell’.
  • Now in the shell section you should see the message printed from both the cores.

Fig. 8 Enabling Shell

Result

The result obtained from the above code is attached below. Where we can see the messages received or executed by both the cores as per the instructions provided in the micropython code.

Fig. 9 output printed on shell

Let’s take another example where we will interface some peripheral LEDs and will toggle those LEDs using different threads of execution or cores.

  • Most of the instructions are similar to the previous example with some additional ones. Here we are importing one more library ‘Pin’ (along with the previous ones) to access the GPIO pins of raspberry Pi Pico module.

Fig.10 importing necessary libraries

Fig. 11 declaring led objects

  • Next task is assigning the task for each core. Core_1 is assigned to make the led_1 (GPIO_14) to toggle along with printing the given message.

Fig. 12 Toggling LED with core_1

  • Core_0, which is the default one is assigned to make the led_0 (i.e., GPIO_15) toggle with a delay of 0.5sec. Rest of the programming instructions are similar to the previous example code so we are not explaining them again.

Fig. 13 toggling LED with core_0

Code

from machine import Pin

import utime # access internal clock of raspberry Pi Pico

import _thread # to access threading function

# declaring led object

led_0 = Pin( 14, Pin.OUT ) # led object for core_0

led_1 = Pin( 15, Pin.OUT ) # led object for core_1

spLock = _thread.allocate_lock() # creating semaphore lock

def core1_task():

while True:

spLock.acquire() # acquiring semaphore lock

print( " message from core_1" )

led_1.value( 1)

utime.sleep( 0.5) # 0.5 sec or 500us delay

led_1.value(0)

spLock.release()

_thread.start_new_thread( core1_task, () )

while True:

spLock.acquire()

print( "message from Core_0" )

led_0.value(1)

utime.sleep( 0.5)

led_0.value(0)

spLock.release()

Result

In the results attached below we can that two LEDs are attached with raspberry Pi Pico boar. Green (GPIO14) and Red (GPIO15) LEDs represent the output of Core_1 and Core_0 respectively.

Fig. 14 Core_1 output (GPIO 14)

Fig. 15 Core_0 Output (GPIO15)

Conclusion

In this tutorial, we learned how to access both the cores of the raspberry pi Pico module and to execute task or control peripherals with individual cores. We also learned the concept of threading and multithreading.

This concludes the tutorial. I hope you found this of some help and also hope to see you soon with a new tutorial on raspberry Pi Pico programming.

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