NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » Distance sensor
January 26, 2011 by archee |
Hi, I have idea to measure and visualize road quality in my country mostly because its terrible. So I had an idea to put an sensor for measuring distance from my cars shock absorbers top till the bottom. The speed could be 10 times a second. I would like to hear some opinions on which sensors to use. I found in internet about ultrasonic sensors for measuring distance especially i think this one suits my needs the most. http://www.robotshop.com/eu/dfrobot-urm-ultrasonic-sensor-2.html but might be there is some other way. Like put one sensor on the bottom of shock absorber and other one on top of shock absorber, and measure distance between these too. Will be thankful for any information about distance measuring in electronics. Best regards, Arturs Vitols |
---|---|
January 26, 2011 by hevans (NerdKits Staff) |
Hi Archee, Neat project you have in mind. I think the biggest problem you are going to run into is the harsh environment of a car. Make sure you enclose your project well to withstand all the dust, rocks, and heat under your car. Just another suggestion for a sensor you could use is an accelerometer mounted at the bottom of the shocks. This point will spike up or down for bumps and holes and you should able to detect the sudden changes in acceleration. Humberto |
January 30, 2011 by archee |
Hi Humberto, That is a really good idea to use accelerometer, using accelerometer and knowing the speed I`m driving should make me able to calculate height of the bumps. Arturs |
February 02, 2011 by archee |
Hi, Now I`m trying to write my own display drivers, just for training my skills, and learning to understand data sheets. It was all fine I created a function which checks busy flag, and then sends data to LCD:
P4 is for RS pin on LCD all others are data pins. It works fine. When I want to send some data to LCD I just write:
but it takes twice as much space in code writing like this, so I decided to make on function that sends 8 bits.
and when I want to send some info to lcd i write in code
function nibb(); works perfectly, but finction nibb_8(); refuses to cooperate. Could someone explane me the flood in my plan..? why it`s not working..? Any kind of help will be appreciated. Thankful Arturs Vitols |
February 02, 2011 by hevans (NerdKits Staff) |
Hi archee, There are actually a couple of problems with your approach. You are correct that a string of numbers is really just an array of chars, however there is these a mapping between the ASCII representation of a character and the character you see. The ASCII representation of the character "0" is actually not the number 0, it is the number 48. You actually can't really encode the number 0 in a character easily since 0 is the null character which is usually used to indicate the end of a string. The other issue is that literal strings on microcontrollers a bit tricky since there are two memory spaces (RAM and program memory). By default our Makefile specifies not to put the .text section of the program into RAM since this is generally good practice in MCUs (you have very limited RAM). Instead we recommend literal strings be held on the Flash memory which is why we always use the PROGMEM macro when using strings. For much more info about this (and how to get around it) take a look at this thread. Humberto |
February 05, 2011 by archee |
Thanks Humerto, this info helped me a lot. At this part I really need some help I draw some sketches of how this system should look like:
I would really like to here some opinions on suggestible hardware and software solutions. Im not as smart as I wana be.. :D Arturs |
Please log in to post a reply.
Did you know that 20 LEDs can be controlled from 11 microcontroller pins, to make a twinkling heart outline? Learn more...
|