Skip to main content

Featured post

A* ALGORITHM BASICS FOR PATH FINDING & HEURISTICS METHODS : ARTIFICIAL INTELLIGENCE

 A* ALGORITHM BASICS FOR PATH FINDING A* , widely used  known form of best-first search & path planning algorithm nowadays in mobile robots,games. this is the function for A*,                                     f(n) = g(n) + h(n) g ( n ) is the cost of the path from the start node to n , and h ( n ) is a heuristic function that estimates the cost of the cheapest path from n to the goal This will find cheapest f(n) value in neighbor nodes to archive goal node. check below image  A to B path finding with g(n),h(n),f(n) value In the final level check below image Now we will check the Algorithm // A* Search Algorithm 1. Initialize the open list 2. Initialize the closed list put the starting node on the open list (you can leave its f at zero) 3. ...

Microcontroller Programming Beginning with Arduino

Micro-controllers

  • Tiny, self­contained computers in an IC
  • Often contain peripherals
  • Different packages available
  • Vast array of size and power availible 

Sensory Input

  • Robots need to be able to receive input from the
  • world in the form of sensory input.
  • Micro-controllers handle this input.
  • Thousands of sophisticated sensors available
  1. Pressure/Force Sensors
  2. GPS Locators
  3. Gyroscopes
  4. Wheel Encoders
  5. In-fared Proximity Detectors
  6. Accelerometers
  7. Ultrasonic Range-finders
  8. Alcohol Vapor Density Detectors

Arduino 


  • Development board for the ATMega328
  • Inludes
    •    Programmer,
    •    Voltage Regulators
    •    Serial to USB Converter
  • CHEAP ­­ $30! Has everything you need! 

Arduino C Template

   void setup() {
     // Setup stuff to only run once at the beginning  
   }
   void loop()
  {
    // This function gets called indefinatly
  }

 Peripherals

  •  Analog to Digital Converters (ADC)
  • Counters/Timers (TMRx)
  • PWM Modules (CCP/PWM)
  • Serial Ports (UART)
  • Many, many more....

 Digital I/O

  •  Only HIGH and LOW values
  • Each pin configurable to do input or output
  • pinMode(pinNumber, pinState)
  • pinMode(13, INPUT)
  • pinMode(13, OUTPUT)

 Digital I/O (Part II)


  • Output
    • digitalWrite(pinNumber, HIGH/LOW)
  • Input
    • int val = digitalRead(pinNumber)

Arduino Digital I/O Example

int ledPin =  13;
void setup() {
  // Set the digital pin as output:
  pinMode(ledPin, OUTPUT);     
}
void loop()
{
  // Bring the pin high (1)
  digitalWrite(ledPin, HIGH);
}

 Serial Interface (UART)

  •  Communicate with other microcontrollers or PC'sAsynch. 
  • communication Arduino libraries make it extremely easy
  • Serial.begin(baudRate)
  • Serial.println(”String To Send”)
  • int bytesWaiting = Serial.Availible()
  • Char incomingData = Serial.read()

 Arduino Serial Example

void setup() {
     Serial.begin(9600);  // Setup baud rate for Arduino to Pc taking
}
void loop() {
    Serial.println(”Give me input”);  // output data in Serial monitor
    while(Serial.availible() < 1) {     // if there's data waiting for
       char input = Serial.read();     // get a byte of data from serial connection
    }
}

 Analog to Digital Converter(ADC)

  •  Take analog voltage as input on one of the pins
  • Return digital representation to program
  • Different numbers of bits change precision.
 
 

 Light Sensors

  • Photoresistors
  • Extremely Simple to Use
  • Resistance changes with light
  • Measure voltage over the sensor with an ADC, and you're done
  • Many more complicated sensors
  • simulate this behavior for simplicity

 Arduino ADC Example

int sensorPin = 0;
void setup() {
     Serial.begin(9600);
// Setup baud rate for Arduino to Pc taking 
     pinMode(sensorPin , INPUT); // Assign sensorPin as a input
}
void loop() {
     // read the value from the sensorpin 0
     sensorValue = analogRead(sensorPin);
 
     // Print sensor value to the Serial monitor
     Serial.println(sensorValue);
}

 

 PWM Modules (CCP)

  •  Create PWM signals on output pins
  • Measure PWM signals on input pins
  • CCP stands for Capture/Compare
  • What is PWM, anyway?

 Pulse Width Modulation(PWM)


  • Transmit analog values using a single digital input/output pin through careful timing.
  • A PWM signal consists of two values 
  • Period: how long before the signal repeats
  • Pulse Width: how long the signal is HIGH before it goes LOW.
  • Duty Cycle: % of time the signal is HIGH, or
  • (Pulse Width / Period)

 PWM In Robotics

  • The average voltage (Duty Cycle * Voltage) can be
  • used to control the speed of DC motors.Innaccurate, poor strength, braking, and other problems exist.
  • Servo Motors and Speed Controllers.

 Servo Motors

  • DC Motor with gears allow for high torque
  • Embedded microcontroller monitors PWM input and motor position.
  • Vary pulse width to change position of motor

 Speed Controllers 

  • Embedded microcontroller varies voltage on output lines based on PWM input.
  • Results in constant voltage to motors rather than intermittent.
  • Allow a second, more powerful, power supply to drive large motors.
  • Alter pusle width to change the speed of the motor

 Arduino PWM Command


  • AnalogWrite(Pin, DutyCycle)
  • DutyCycle = 0  →  0%, 127  →  50%, 255  →  100%
  • Pin can be 3, 5, 6, 9, 10, or 11
  • Frequency of about 490HtzOther periods are possible, but not with AnalogWrite

 Arduino PWM Example

int Pin = 9;
void setup()
{
   pinMode(Pin, OUTPUT);
}
void loop()
{
  analogWrite(Pin, 127);  // Generate 50% duty cycle on ”Pin”
}

Easy to learn Arduino.. please guys learn with intrest and share it
Robinroy peter

Comments

Popular posts from this blog

A* ALGORITHM BASICS FOR PATH FINDING & HEURISTICS METHODS : ARTIFICIAL INTELLIGENCE

 A* ALGORITHM BASICS FOR PATH FINDING A* , widely used  known form of best-first search & path planning algorithm nowadays in mobile robots,games. this is the function for A*,                                     f(n) = g(n) + h(n) g ( n ) is the cost of the path from the start node to n , and h ( n ) is a heuristic function that estimates the cost of the cheapest path from n to the goal This will find cheapest f(n) value in neighbor nodes to archive goal node. check below image  A to B path finding with g(n),h(n),f(n) value In the final level check below image Now we will check the Algorithm // A* Search Algorithm 1. Initialize the open list 2. Initialize the closed list put the starting node on the open list (you can leave its f at zero) 3. ...

Getting Started with ARGoS Large-Scale Swarm Robot Simulator in Ubuntu

ARGoS (Autonomous Robots Go Swarming) is a multi-robot simulator designed to support large teams of robots. Its design is pretty different from the design of other simulators. Its most distinctive feature is that the 3D simulated world can be divided in regions, and each region can be assigned to a different physics engine. Furthermore, ARGoS' design revolves around the concept of tunable accuracy. In other words, in ARGoS, everything is a plug-in (robot models, sensors, actuators, physics engines, visualisations, etc) and the user can select which plug-ins to use for an experiment.  Since different plug-ins have different accuracy and computational costs, users can choose which plug-ins to use for each aspect of the simulation and assign resources only where it matters. This makes the simulation as fast as possible. At the time of writing, ARGoS supports the Swarmanoid robots (foot-bot and eye-bot) and the e-puck. ARGoS supports Linux and Mac OSX. Binary packages are availa...

How to compile C++ file in ROS environment

let see how make one c++ file as executable or make it compile in ros environment let create one package call test so we will add test1.cpp to compile, then we have to change in 3 place in cmakelist.txt file here test1.cpp we named this executable as test1   add_executable(test1 src/test1.cpp)    add_dependencies(test1 ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})    target_link_libraries(test1    ${catkin_LIBRARIES}  )  these r the main changes we need to do in cmakelist. if we need to add another c++ file then let see  that's all lets compile for more details just check below video

Translate