Tajima Serial Connection Distance

( Serial I/F device is not correctly connected). Check connection of serial device (TFD, PC, etc.). Repai r o r correc t th e desig n data.

  1. Rs232 Serial Connection
  2. Tajima Serial Connection Distance Range
  3. Tajima Serial Connection Distance Chart

hii sir, i am working on HC-12 module from some months and the equipment runs 24/7, it was working well till now, but now it is not working fine, when i start the device, it works well for 3-4 hours , then after it does not receive or even transmit data signals.
i have changed its connection from software UART to hardware as well,i am powering it upto 4.5 volts and power adapter is capable of providing 2A current an also i have provided capacitor of 100nf as decoupling capacitor, but still i am getting this errors daily , every day i have to restart the device and it works nicely only for few hours,
i hope u might help me in this problem,
Thanking You sir,
Chandresh Suthar,

  1. Embroidery machine(s) with serial connection (RS232) Serial cable(s) to connect the machines Multiple serial ports (more than one machine) Who From. Pin Point International - serial cables Wilcom International - digitizing software Hirsch International - serial cables, Tajima embroidery machines.
  2. At the end the function will return the length of the pulse in microseconds. For getting the distance we will multiply the duration by 0.034 and divide it by 2 as we explained this equation previously. At the end we will print the value of the distance on the Serial Monitor. First do the wiring as shown in the picture.

Using ultrasonic sensors to measure distance of obstacles, taking into account temperature and humidity that affect the speed of sound.

  • 13,789 views
  • 2 comments
  • 37 respects

Components and supplies

Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
×1
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Breadboard (generic)
×1
Jumper wires (generic)
×1

Apps and online services

About this project

Measuring distances from our robot to other objects is one of the most common data we want to obtain. For example, if we are building an autonomous vehicle, we want to check its distance from obstacles to help it make the right decision about its course. There are also many more examples of robots that we want them to activate mechanisms when something or someone gets close to them.

One of the simplest, cheapest, and most accurate ways to measure distances is by using ultrasonic sensors. Their working principle is based on the fact that sound is reflected upon most objects and materials. These sensors have a transmitter that sends a short ultrasonic burst and a receiver that senses the ultrasound upon it’s return. Knowing the speed of the sound in the air (approximately 343 m/sec), we can calculate the distance it traveled, if we measure the time passed for the ultrasound to return to the sensor.

Working Principle

All ultrasonic sensors operate in a similar way. They send a short (a few microseconds long) ultrasonic burst from the transmitter and measure the time it takes for the sound to return to the receiver.

Let’s say that it took 10 milliseconds for the ultrasound to return to the sensor. That means:

  • That the time in seconds is 0, 01.
  • Knowing that sound travels in the air 343 meters for every second, we can calculate the distance in meters by simply multiplying seconds by 343. in our case 0, 01 x 343 = 3, 43 meters.
  • This is the distance that the ultrasound traveled to the obstacle and back to the sensor, so the obstacle is 3, 43/2 = 1, 715 meters away from the sensor.

Pros and Cons

The main advantages of using ultrasonic sensors to measure distance are:

  • They are cheap and there is a plethora of choices in the market,
  • They are not affected by the color or the transparency of obstacles,
  • They are not affected by lighting conditions,
  • They are pretty accurate on their measurements.

Their drawbacks are:

  • They don’t work well enough on obstacles with small surfaces.
  • The angle of the surface of the obstacle is crucial for the sensor.
  • Obstacles made from sound absorbing materials (for example sponges) are hard to be traced by the sensor, since the absorb sound.

Choosing a Sensor

There is a wide variety of ultrasonic sensors on the market, for most robotics platforms. For those who prefer working with the Lego platform, EV3 and the older NXT, include ultrasonic sensors. Some examples of using them in the classroom are:

If you are an Arduino or Raspberry Pi fan and want to dive more into how these sensors work, there are several options that you can find online. The most common and affordable choice is the HC-SR04, which costs less than a euro on ebay (August 2018). For more details and comparative tests with various ultrasonic sensors, I advise you to watch two detailed videos (here and here) from Andreas Spiess channel on Youtube.

Connecting the Sensor to Arduino and Programming

The HC-SR04 sensor has 4 pins:

  • VCC, that is connected to 5V,
  • GND, that is connected to Ground,
  • TRIG (Trigger), that is connected to the transmitter to send the ultrasonic burst,
  • ECHO, that is connected to the receiver.

There are two ways to connect the sensor to Arduino:

  • Connect TRIG and ECHO to different digital pins and make all the hard work and calculations in our program,
  • Connect TRIG and ECHO to the same digital pin and use a library to make all the calculations.

I am going to start from the second way (easy) and then stay longer on the first, which gives the programmer more control and as an educator I find it more interesting.

One Pin Connection and the NewPing Library

For my program to work I will need to install the NewPing library to my Arduino IDE, using the library manager.

Now I can write a simple program to print the distance obtained by the sensor to the Serial monitor.

I uploaded the program to the board and started testing.

Two Pin Connection – Calculating Distance From Time

As an educator, I find it more interesting to dig in the working principal of things, even if that means more work for my students. In order to do so in this example we will have to forget the luxury of the NewPing library and make all the calculations ourselves. First of all I changed the schematic by connecting the TRIG and ECHO to different digital pins.

Before I can start coding there are some things I need to clarify:

  • TRIG (Trigger) has a default LOW state and when we change it to HIGH it starts sending ultrasonic burst.
  • When ECHO receives the bouncing sound it returns a HIGH pulse to the Arduino.
  • I will use the pusleIn function to measure the time the ECHO pin stays in HIGH state. This functions returns time in microseconds.

Now I can start my algorithm:

  • Set TRIG pin to HIGH.
  • Wait for a short period of time (10 microseconds).
  • Set TRIG pin to LOW. Now I have sent a short ultrasonic burst.
  • Get the time from ECHO pin in microseconds.
  • Convert microseconds to seconds (division by 1.000.000).
  • Calculate the distance the sound traveled in meters. Multiply seconds by 343 m/sec.
  • Now I have the distance I meters. I will convert it to centimeters by multiplying by 100.
  • This is the distance the sound traveled to the obstacle and back. So the distance of the obstacle from the sensor is half of that. So I divide distance by 2.

I upload the program to my board and the sensor works as with the NewPing library, returning decimal values since all my variables are float.

Digging Even Further – Finding the Actual Speed of Sound Based on Temperature and Humidity

So far I used the speed of sound to calculate distance from time, assuming that this is a constant value of 343 m/sec. That is not actually true. Speed of sound depends on the “density” of the mean it travels through. In solid materials the speed of sound is greater than liquids and in liquids sound travels faster than through gases.

The ultrasonic sensor sends sound through air which is a gas. In gases the speed of sound is affected mostly by the gas temperature, less by the gas humidity and even less by the gas pressure. For example in air with pressure of 1 Atm and

  • Temperature of 0 degrees Celsius (32 F) and 50% humidity, the speed of sound is 331.61 m/sec,
  • Temperature of 20 degrees Celsius (68 F) and 50% humidity, the speed of sound is 343.99 m/sec,
  • Temperature of 30 degrees Celsius (86 F) and 50% humidity, the speed of sounds is 350, 31 m/sec και
  • Temperature of 30 degrees Celsius (86 F) and 90% humidity, the speed of sound is 351, 24 m/sec.

Rs232 Serial Connection

There are many online calculators for the speed of sound. I used the one on http://www.sengpielaudio.com/calculator-airpressure.htm to get the above results.

Since I had a cheap temperature – humidity sensor lying around (DHT11 Temperature and Humidity Sensor), I decided to improve the calculations in my code, using these two values to estimate a more accurate speed of sound value.

First of all I embedded the new sensor in my schematic. Typical DHT11 sensors have either 3 pins (5V, GND and Signal) or 4 pins (5V, GND, Signal and NULL). The connections are as follows:

  • 5V DHT11 –> 5V Arduino
  • GND DHT11 –> GND Arduino
  • SIGNAL DHT11 –> A0 pin Arduino

The next step was to add the measurement of temperature and humidity in my code using the dht.h library, which you can download from here. I followed the step by step tutorial from Brainy Bits and now the only thing I needed was to calculate the actual speed of sound.

After a long search, I found that the formula needed was originally published in 1993 by Owen Cramer in his work “The variation of the specific heat ratio and the speed of sound in air with temperature, pressure, humidity, and CO2 concentration.”. I was also happy to find a JAVA implementation by a research team from the Univeristy of Sao Paolo Brazil. With a few tweaks to adjust it to my code the full program is as follows:

I uploaded the program to my board and starting testing. I was happy to have more accurate measurements, even if that does not play a significant role in small distances of few cm.

Using the Ultrasonic Sensor in Class

The use of ultrasonic sensors in educational robotics is very common and there are hundreds of examples over the internet, either using the Lego platform or Arduino and Raspberry pi. Recently tinkercad added a new command block for getting the distance from an ultrasonic sensor.

I find particularly interesting, for educational purposes, the analytical way of calculating the distance, from the time the sound takes to travel to the obstacle and back.

In a previous project (smart trash can), that we implemented with my students from the evening club Young Hackers, we spent a lot of time to fully understand the algorithm that calculates distance from time using an analytical worksheet (in greek). We implemented the algorithm using a block style language (Ardublockly) that helped students a lot to understand every step of the way.

Code

Arduino
https://create.arduino.cc/editor/ioarvanit/f40b3d40-6174-42e8-af37-4a8148e3e419/preview?embed
Arduino
https://create.arduino.cc/editor/ioarvanit/4bc3e019-2bd0-4239-87ab-c873a7df435b/preview?embed
Arduino
https://create.arduino.cc/editor/ioarvanit/a1fcc9a8-9e7a-48ce-87c9-4313a8986c70/preview?embed

Schematics

Author

Giannis Arvanitakis
  • 3 projects
  • 35 followers

Tajima Serial Connection Distance Range

Tajima Serial Connection Distance

Published on

August 21, 2018

Tajima Serial Connection Distance Chart

Write a comment

Members who respect this project

and 29 others

See similar projects
you might like

Table of contents

Write a comment