I am very new to Arduino and looking to develop some code for a project I am working on.
The basic setup is going to include these parts:
16x16 individual programmable LED matrix (6.3inches x 6.3inches)
Arduino Uno R3
1 Sonar Sensor (HC-SR04)
1 red LED to indicate power to the circuit
mini breadboard
The basic concept I am looking to create is this:
An object is going to be placed and then removed on top of a piece of clear plastic. The sonar will shoot across the clear plastic perpendicular to the plastic and be used to detect position of this object. This will then light up the LED’s in the matrix for where the object was placed. Basically the sonar will be stationary and I am looking to light up the leds in the matrix for where this object was.
I have some ideas referencing code readily available to create a radar system that displays objects on your computer, but instead my output is the led matrix.
I understand that you want the sonar to locate the object.
To do that you will have to sweep the sonar unit over the surface and note the angle of the sweep and the distance to the object when you detect it.
This will give you the POLAR co-ordinates of the object.
Then you will have to convert the POLAR co-ord to CARTESIAN co-ords so you can display it on your x-z array of LEDs.
Google
arduino radar distance sensor
It will give you many projects showing the principle.
BUT first if you are going to use sonic sensor, you should JUST write some code to test and get familiar with the device, rather than go the whole "hog" and try and develop a mass of code trying to do everything.
Can you tell us your electronics, programming, arduino, hardware experience?
I have built some of the models you are talking about for radar. I wanted to avoid having the sweeping motion and have the sonar mounted stationary, can this not be done?
I have electronics experience and programming experience in VBA. I have not worked with arduinos at all other than the radar and distance sensor programs I have researched and run online. I get the basic concept of how the sonar is finding the location, but unsure of how to translate that into a coordinate system for the LED matrix.
Hi,
Your sonar device can only give distance readings.
To get the angle you have to sweep, it assumes that the reflection it receives has come from in front of it or within its measuring angle.
Yes, I see what you are saying. It is able to find these locations by sweeping. I see how it is working with the google search.
This will not work for my application then. The end goal for this is to detect where an object hits in a 6.5x6.5 inch square. Think of a ball coming into contact with the clear plastic sheet. I need a way to detect where this ball came into contact with the plastic and light up the LED’s for where the ball hit accordingly.
Hi,
So the ball will only briefly be in contact with the surface, you may need to change your mind set and think about detecting the point of impact rather than the position of the ball.
You will need a system that is very fast to detect and find the position of the bounce.
You may need to look at the devices shown in this search, using a touch sensitive surface to detect the contact point.
Speed will be the most important factor if you are only bouncing into the detection area.
OK, so to make use of the quite wide beam of the sonar and get a location within a(n approximate) square, you use two sonars at right angles, just far enough away from the square so that each "sees" the whole square and which also makes the timing easier. You "ping" them alternately, each gives you a distance and those distances give you the "X" and "Y" coordinates in the square.
That seems like it will work well. I found an instructable article using 2 sonar modules at a 45 degree angle away from your detection area. I calculated the distance I would need to be away to make sure the sonar would cover the user area of the board.
The example and code I located outputs to processor almost exactly what I am looking for, it will output on a grid on the computer where the object is located. I am now trying to figure out exactly how to convert this from requiring processor but instead lighting up the correct LED in the 16x16 matrix based on where the object is detected.