Jump to content

Search the Community

Showing results for tags 'ultrasonic'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 4 results

  1. I'm working on a project where I need to oscillate at 25khz. I've been using the PWM built into the MSP430G2553 and it doesn't seem to be accurate enough to give me exactly 25khz. I've been getting anywhere from 23khz to 27khz and cannot figure out why it's off by so much. I might be doing something wrong. Does anybody know what sort of accuracy I should expect from the on board PWM in the MSP430G2553. Is there a way to make it more accurate? I was looking at adding an external crystal, but would rather not add that complication if it isn't necessary.
  2. I have a code from an arduino to control servo position based on the distance output of the ultrasonic sensor. The servo just turns back and forth and there's no serial output at all. Everything is attached to the appropriate pins. I'm literally brand new at this so i really have no idea how to trouble shoot. Any help would be appreciated. This is the code i'm using. #include <Servo.h> //Setup the variables for the HC-SR04 const int trigPin = 3; const int echoPin = 4; // create servo object to control a servo // a maximum of eight servo objects can be created Servo myservo; // variable to store the servo position int pos = 0; void setup() { // initialize serial communication: Serial.begin(9600); // attaches the servo on pin 9 to the servo object myservo.attach(2); } void loop() { // establish variables for duration of the ping, // and the distance result in inches and centimeters: long duration, inches, cm; // The sensor is triggered by a HIGH pulse of 10 or // more microseconds. // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: pinMode(trigPin, OUTPUT); digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Read the signal from the sensor: a HIGH pulse whose // duration is the time (in microseconds) from the sending // of the ping to the reception of its echo off of an object. pinMode(echoPin, INPUT); duration = pulseIn(echoPin, HIGH); // convert the time into a distance inches = microsecondsToInches(duration); cm = microsecondsToCentimeters(duration); //Tell the Arduino to print the measurement in the serial console Serial.print(inches); Serial.print("in, "); Serial.print(cm); Serial.print("cm"); Serial.println(); // This if-else statement tells the Arduino at what distance // it should trigger the servo, what the servo should do, // and what it should do if the distance is too far away. if (inches <= 24) {sweep(3); } else if (inches >= 24) {myservo.write(pos); } // Tell the Arduino to wait 0.10 seconds before pinging the // Ultrasonic Sensor again. delay(100); } // Converts the microseconds reading to Inches long microsecondsToInches(long microseconds) { // According to Parallax's datasheet for the PING))), there are // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per // second). This gives the distance travelled by the ping, outbound // and return, so we divide by 2 to get the distance of the obstacle. // See: www.parallax.com/.../28015-PING-v1.3.pdf return microseconds / 74 / 2; } //Converts the Microseconds Reading to Centimeters long microsecondsToCentimeters(long microseconds) { // The speed of sound is 340 m/s or 29 microseconds per centimeter. // The ping travels out and back, so to find the distance of the // object we take half of the distance travelled. return microseconds / 29 / 2; } //This sub-routein is what dictates the movement of the servo void sweep(int NUM_OF_CYCLES) { // Tells the Arduino to start this loop at 0 and incriment it by 1 // each time the loop completes. This is how the Arduino knows to // stop the loop when a specific number of the // Sweep routein has been ran. for (int j=0; j<NUM_OF_CYCLES; j++) // goes from 0 degrees to 180 degrees for(pos = 0; pos < 180; pos += 1) { // in steps of 1 degree // tell servo to go to position in variable 'pos' myservo.write(pos); // waits 15ms for the servo to reach the position delay(10); } // goes from 180 degrees to 0 degrees for(pos = 180; pos>=1; pos-=1) { // tell servo to go to position in variable 'pos' myservo.write(pos); // waits 15ms for the servo to reach the position delay(10); } }}
  3. Here I summarize the hardware connections (schematic given below) and source code (attached) to build a Distance meter using MSP430 Launchpad and Ultrasonic Sensor HC-SR04. Project: Ultrasonice based Distance Meter with LCD Display Microcontroller: MSP430G2231 on MSP-EXP430G2 Launchpad Ultrasonic Ranging Module: HC-SR04 16 msp_dist.c
  4. hi, i'm new to the msp430 and i'm using the msp430G2553 on the launchpad. I need a sample code the read distance measure from maxBotix Maxsonar (Lv-MaxSonar-Ez). doesn't really matter what the code does as long as it read distance. thx
  • Create New...