Monday 28 February 2022

Spintronics: Innovative crystals for future computer electronics

Computer chips and storage elements are expected to function as quickly as possible and be energy-saving at the same time. Innovative spintronic modules are at an advantage here thanks to their high speed and efficiency, as there is no lossy electrical current, rather the electrons couple with one another magnetically -- like a series of tiny magnetic needles which interact with almost no friction loss. A team of scientists has now found promising properties with crystals grown from rare-earth atoms, which offer hope on the long path towards usage as spintronic components.

A potential breakthrough for production of superior battery technology

Micro supercapacitors could revolutionize the way we use batteries by increasing their lifespan and enabling extremely fast charging. Manufacturers of everything from smartphones to electric cars are therefore investing heavily into research and development of these electronic components. Now, researchers have developed a method that represents a breakthrough for how such supercapacitors can be produced.

Friday 25 February 2022

New imager microchip helps devices bring hidden objects to light

Researchers have developed an innovative terahertz imager microchip that can enable devices to detect and create images through obstacles that include fog, smoke, dust and snow.

Live wire: New research on nanoelectronics

Researchers show that certain proteins can act as efficient electrical conductors. In fact, these tiny protein wires may have better conductance properties than similar nanowires composed of DNA, which have already met with considerable success for a host of human applications.

Thursday 24 February 2022

Development of a diamond transistor with high hole mobility

Using a new fabrication technique, engineers have developed a diamond field-effect transistor (FET) with high hole mobility, which allows reduced conduction loss and higher operational speed. This new FET also exhibits normally-off behavior (i.e., electric current flow through the transistor ceases when no gate voltage is applied, a feature that makes electronic devices safer). These results may facilitate the development of low-loss power conversion and high-speed communications devices.

Wednesday 23 February 2022

Detecting stressed-out polymer films, gels before they break

Stretchy films and squishy gels help make wearable electronics, soft robotics and biocompatible tissues a reality. But too much force can cause these polymers to break apart without warning. To detect stress before it's too late, researchers show they have designed a compound with 'wings' that makes these materials change color when they are stretched or crushed.

Tuesday 22 February 2022

Building artificial nerve cells

For the first time, researchers demonstrate an artificial organic neuron, a nerve cell, that can be integrated with a living plant and an artificial organic synapse. Both the neuron and the synapse are made from printed organic electrochemical transistors.

Thursday 17 February 2022

Uncovering unexpected properties in a complex quantum material

A new study describes previously unexpected properties in a complex quantum material, findings that have implications for future quantum devices.

New DNA computer assesses water quality

Synthetic biologists have developed a low-cost, easy-to-use, hand-held device that can let users know -- within mere minutes -- if their water is safe to drink. The new device works by using powerful and programmable genetic networks, which mimic electronic circuits, to perform a range of logic functions.

Wednesday 16 February 2022

Tuesday 15 February 2022

How To Measure Water Tank Depth Using Ultrasonic Sensor

In this tutorial, you’ll learn how to use an ultrasonic sensor. Specifically, you’ll learn how to use the HC-SR04 module with an Arduino to measure the depth of a water tank.

An ultrasonic sensor is one of those things that some people don’t like getting into just because it sounds complex to use and understand. But the fact is, it’s one of the most accessible and fun accessories for those who like to dabble in microcontrollers.

HC-SR04 Ultrasonic Sensor Front

This is especially true when talking about an Arduino, as there are a couple of very reliable libraries out there. And for those looking to get even more into the technicalities of the sensor, the GitHub repositories are open and available to all.

There are two things that make this type of sensor easy to use. Firstly, connecting it is very straightforward as it only requires direct connections between the module and microcontroller. Secondly, the module makes the functionality of the sensor relatively simple. You’ll understand this part better when I get into the workings of it later on.

What You’ll Need

To build this project you’ll need the following components

  • HC-SR04 Ultrasonic Sensor Module
  • Arduino UNO

And the circuit diagram looks like this:

Schematic for Arduino with HC-SR04 Ultrasonic Sensor

And you’ll need the following software:

Keep in mind that, in general, any kind of microcontroller should be able to run this type of project, but we’ll specifically be working with Arduino IDE. So to follow these instructions, your board must at least be compatible with that.

How Does an Ultrasonic Sensor Work?

The basic principle of an ultrasonic sensor is pretty basic: It sends out a sound wave from its speaker. When the sound hits an object, this creates an echo that bounces back to the sensor. The sensor uses a microphone to detect the echo.

The speed of sound waves is 343 m/s. So by multiplying this with the time the signal took to return, you get the distance that the signal traveled.

Since the signal first traveled to the object, then back, you can get the distance to the object by dividing by 2.

The HC-SR04 module needs a 10 µs pulse from the Arduino to trigger the sound wave being emitted from the module. The Arduino then waits for an incoming pulse from the module and uses the time it took to get the distance.

But you don’t have to think about this since the library you’re going to use includes everything needed.

How the Code Works

Regarding the code, the first thing to consider is the libraries that must be included. For this we only need one:

#include “HCSR04.h”

After this, we must declare all the variables and constants that we are going to use. This section is split into two parts: pin configuration constants and the variables associated with storing the data:

/*PIN CONFIG*/
const int trig = 12; //Trigger pin
const int echo = 13; //Echo pin

*/VARIABLES*/
float distBuff; //Buffer for the raw distance taken by the sensor
int tankFinal; //Final percentage value for how full the tank is
float allDist; //The sum of all the distances in allDist
float avgDist; //The average of all the distances in allDist
int i; //Random variable used to control the loop

Here we initialize the class of the ultrasonic sensor module and as you can see, we add the pins that it is going to use:

HCSR04 hc(trig, echo); //HCSR04 Initialization (trig pin, echo pin)

Within the setup function, all we need to do is initialize it for serial communication:

void setup() {
  Serial.begin(9600); //Serial communication initialization
}

Then, inside the loop function we code the process taken by the Arduino which is going to be repeated over and over again:

void loop() {
  allDist = 0; //Restart the distance sum
  
  for(i = 0;i < 25;i++){
    delay(5); //delay between each reading to avoid an error
    distBuff = hc.dist(); //Taking distance
    if(distBuff > 0 && distBuff < 301) //We ensure we only take values between the physical possible ranges
    {
      allDist = allDist + distBuff; //Summing the distances
    }
  }
 
  avgDist = allDist / 25; //Dividing the distances to get the average
  tankFinal = map(avgDist, 2, 300, 100, 0); //Converting the average into percentage
  Serial.println(tankFinal); //Print the percentage value
}

The code first ensures that the variable in charge of storing the sum is empty, then we have a loop in charge of taking 25 readings from the sensor, ignoring any readings outside the distance of the water tank. After all the readings are taken, we calculate the average and then use the map function to convert the distance to the percentage of the tank.

Issues Encountered While Testing

Although I have used this sensor module in other projects, I tried a slightly different approach to make it work this time: I added a smoothing algorithm for the data coming from the module. Without the smoothing, I could just print the data obtained each time, but in this case, I take a certain number of readings and calculate the average. Nothing extraordinary or anything that I haven’t done with many other projects before.

However, I was getting a recurring error in my readings, which materialized in this way:

  • The code starts.
  • The code perfectly reads the height between my table and the ceiling at 49%.
  • I use an object to simulate something at 90%, which works as intended.
  • Then the readings get stuck at around 70% when I remove the object. They don’t go any lower.
  • I use an object to simulate something at 90% again, which again works as intended.
  • The readings then return to the correct state at 49% when I remove the object.
  • This issue then repeats again from 3.

I spent a large amount of time checking the library that I was using and made several changes to it. I also tried restarting the module every time I took a reading, but nothing seemed to work and I kept having the same issue. I began to think the module itself was faulty, but after further testing, I came to an important realization.

When I actually monitored the raw data itself, the readings gave perfect results, but this would stop as soon as I stopped printing the raw data. So I attempted to simulate the printing time by adding a delay. I began with a long delay of 30ms, which successfully eliminated the issue. After that, I tried delays from 1ms until I got successful readings at 5ms.

This kind of behavior is not completely out of the ordinary for me as some modules do need a bit of time to process data to avoid various types of interference. The catch was that if that had been the problem, it would have happened with every reading, but in this case, it was switching back and forth every time it went over 70%. I looked for some information in one of the many datasheets of the module, and one of them suggested a 60 ms measurement cycle “in order to prevent trigger signal to the echo signal”.

Honestly, I still don’t know what that means. Truth be told, I haven’t been able to find a more professional datasheet about this module, but the module does need some added time for its measurement cycle to work without issue. This may not be obvious in most online tutorials since they all use a print function after each reading, which takes time and works as an unintended measurement cycle delay.

Complete Code

#include "HCSR04.h"

/*PIN CONFIG*/
const int trig = 12; //Trigger pin
const int echo = 13; //Echo pin

/*VARIABLES*/
float distBuff; //Buffer for the raw distance taken by the 
int tankFinal; //Final percentage value for how full the tank is
float allDist; //The sum of all the distances taken by the sensor
float avgDist; //The average off all the distances in allDist
int i; //Random variable used to control the loops

HCSR04 hc(trig, echo); //HCSR04 Initialization (trig pin , echo pin)

void setup() {
  Serial.begin(9600); //Serial communication initialization
}

void loop() {
  allDist = 0; //Restart the distance sum
  
  for(i = 0;i < 25;i++){
    delay(5); //delay between each reading to avoid an error
    distBuff = hc.dist(); //Taking distance
    if(distBuff > 0 && distBuff < 301) //We ensure we only take values between the physical possible ranges
    {
      allDist = allDist + distBuff; //Summing the distances
    }
  }
 
  avgDist = allDist / 25; //Dividing the distances to get the average
  tankFinal = map(avgDist, 2, 300, 100, 0); //Converting the average into percentage
  Serial.println(tankFinal); //Print the percentage value
}

Testing the HC-SR04 With a Water Tank

For a more realistic testing environment, I used a water tank that I have in my house. This is an underground water tank and had been getting a healthy amount of water over the last few days, so I was expecting the tank to be over half full.

Two things to bear in mind are that when doing real-life tests, the ultrasonic sensor can receive pulses from a fairly wide range of directions, so testing it in a very open space can give you shaky readings. Plus, you need to be careful with the material you are testing it with: cushions, for instance, are really bad at making sound bounce.

According to the manufacturer, the tank is 3-metres deep, but no one seems sure about the rest of the dimensions. In this case, it isn’t important, but if you want to get a bit more creative, calculating the volume would help you estimate the time it takes for the tank to empty if it doesn’t receive any water.

Making a prototype for this sensor is not that complicated since connecting it up is straightforward enough. Here you can see how I attached my Arduino UNO to a small breadboard to have an easier time testing it, and the schematic of the connection:

Schematic of Arduino with HC-SR04

One thing to be aware of is that if anyone testing this would like to enclose the device, they need to leave the “eyes” of the device outside the enclosure. After this, it is just a matter of setting an output device, which in my case was just my PC. As you can see in the code, I’m repeatedly sending the processed data through serial communication, so you can use the serial monitor to show the results:

Arduino serial monitor output

However, I wanted to see the results in a more interesting way so I used a program called Processing. Here, Processing receives the serial data, and converts it into the graphic and number you can see below:

Result of water tank depth shown in Processing

This was the actual result of the test, and below you can see the tank and how the test was performed:

In the following video, you’ll be able to see how the percentage of the tank decreases the further I take the sensor away from the water. Note that this test was done one day later which is why the initial percentage is less than the 71% shown above.

An ultrasonic sensor can sound intimidating but, in reality, it is quite simple to use, and the best part is that it can allow you to do many things. For instance, it is often used for obstacle detection in robots, and as with other things in electronics, the only limit is the imagination of the creators themselves!

Another very convenient thing is that the module is easy to find and inexpensive. I know that I kind of skipped the Processing part, but that is mostly software-related and would require its own article.

Copyright Build Electronic Circuits

Monday 14 February 2022

Scientists discover new electrolyte for solid-state lithium-ion batteries

Scientists have created a chlorine-based solid-state electrolyte for lithium-ion batteries that offers improved performance.

Mapping the quantum future with smart TV technology

Scientists have created the first ever 2D map of the Overhauser field in organic LEDs, shedding light on the challenges we face in designing accurate quantum-based technologies.

Friday 11 February 2022

Graphene spintronics: 1D contacts improve mobility in nano-scale devices

Researchers may have cleared a significant hurdle on the path to quantum computing, demonstrating step-change improvements in the spin transport characteristics of nanoscale graphene-based electronic devices.

This bizarre looking helmet can create better brain scans

Researchers have developed a dome-shaped device, which fits over a person's head and can be worn during a brain scan, that boosts MRI performance, creating crisper images that can be captured at twice the normal speed. Eventually, the magnetic metamaterial has the potential to be used in conjunction with cheaper low-field MRI machines to make the technology more widely available, particularly in the developing world.

Thursday 10 February 2022

Rare earth elements await in waste

Scientists applied their flash Joule heating process to coal fly ash and other toxic waste to safely extract rare earth elements essential to modern electronics and green technologies.

Saturday 5 February 2022

Making metal–halide perovskites useful in planar devices through a new hybrid structure

Two of the main drawbacks of using tin (Sn)-based metal halide perovskites (MHPs) in thin-film transistors have been simultaneously solved by an innovative hybrid 2D/3D structure. New findings will help unlock the potential of environmentally benign Sn-based MHPs in CMOS technology, paving the way for flexible and printable electronic devices.

Friday 4 February 2022

Observation of quantum transport at room temperature in a 2.8-nanometer CNT transistor

A research team has developed an in situ transmission electron microscopy (TEM) technique that can be used to precisely manipulate individual molecular structures. Using this technique, the team succeeded in fabricating carbon nanotube (CNT) intramolecular transistors by locally altering the CNT's helical structure, thereby making a portion of it to undergo a metal-to-semiconductor transition in a controlled manner.

Wednesday 2 February 2022

Researchers set record by preserving quantum states for more than 5 seconds

A team of researchers has maintained a qubit coherence time for a record five seconds. The qubits are made from silicon carbide, widely found in lightbulbs, electric vehicles and high voltage electronics.

Cap Half Full #7 – Opamp basics and the 4000 series IC

In this episode we talk about operational amplifiers (opamps) and the 4000 series IC that Øyvind has been writing a series of posts on. We also accidentally came across an error on Arrow’s website 😉.

Listen to the Podcast

Show Notes

The fauty circuit from arrow.com website (found here https://www.arrow.com/en/research-and-events/articles/fundamentals-of-op-amp-circuits):

Oyvind’s list of 4000 series IC:

https://www.build-electronic-circuits.com/4000-series-integrated-circuits/

Copyright Build Electronic Circuits

New circuit boards can be repeatedly recycled

Researchers have developed a new PCB that performs on par with traditional materials and can be recycled repeatedly with negligible material...