Problem with ultrasonic sensor - what are pins 16/17?

I am troubleshooting my blimpduino in autonomous mode. I have tracked it down to the ultrasonic sensor. I am using the serial console while manually holding the assembled gondola. My ultrasonic sensor returns an altitude of 0 almost all the time. Occasionally I will get a reading of something around ~250 and then within 3 - 4 system_refresh() prints, it goes back to zero. This is regardless of what I have the sensor pointing at (the roof, the floor, or even my hand about 12" in front of it).I think I have found another issue, but it could just be my noob status with arduino. I have read the MaxSonar EZ4 datasheet and I think I have a pretty solid grasp on the timing and how to use the PW and RX ports, which is what the blimpduino code is using to get the distance reading. What has really thrown me for a loop though is that its using pin 15 as the EZ4 "RX" pin and pin 16 as the EZ4 "PW" pin. Call me crazy, but the atmega168 doesn't have digital pins 15 and 16. According to http://arduino.cc/en/Hacking/PinMapping168 it only has up to pin 13. I know the link to that chip is a different package style than the one on the blimpduino, but shouldn't the pin naming be the same? ( I was mapping blimpduino pins to the above referenced diagram using the naming found in the datasheet at http://www.atmel.com/dyn/resources/prod_documents/doc2545.pdf )For that matter, I see some of the LEDs using pins higher than 13 as well (east led is using pin 17 for example).What gives? Is there some funky pin configuration on the blimpduino or should it be like any other atmega168 arduino pinout?If all this pin stuff is correct and I just don't understand it, then why is my ultrasonic sensor acting this way?

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I figured out the pin mapping. Pins 15 and 16 used for the ultrasonic sensor are the same as analog pins 1 and 2, physically known as PC1 and PC2 or ADC1 and ADC2 in terms of ATMega mapping. All so clear now :) The basic pinout diagram I found doesn't show both the digital pin ID and the analog pin ID, so I didn't know digital pin 15 was the same as analog pin 1.

    Now that I have that down....

    I was spending a little more time learning more about the blimpduino board, looking at the EAGLE files, etc, and I came across something interesting that might be the cause of my ultrasonic sensor issue. I see the board has a solder jumper on the bottom to select between PWM and Analog modes from the EZ sensor. On the B6 board (or at least on mine), the default solder position is in AN mode, but the source code for version 1.1.1 is clearly treating it as if it was in PW mode. This made me think I might have old code. Sure enough, there is a file dated newer than 1.1.1 in the google code repo and when I looked at the code, the raw_ultrasonic function seems to be using analog reading code instead of the pwm code found in 1.1.1.

    I am going to try the unversioned code on google dated may 23rd and hopefully have better luck with the sensor.
  • I haven't found a good source of logical vs physical pin layout. I did just come across this page which helps a little, but as a beginner, it's hard to say which pin is which on the different physical format atmega chips.

    http://www.arduino.cc/playground/Learning/Pins

    If this page does apply to the blimpduino, then it looks like the code is using a couple of the analog pins to try and talk to the EZ4. So maybe it is a sensor problem.

    I will take you up on your offer and PM you my address. Thanks Chris!!
  • 3D Robotics
    It's a standard Arduino. Are you sure you're not confusing physical pins with logical pins?

    Sounds like you've but a bum ultrasonic sensor or a soldering problem. Want me to send you a replacement sensor so you can test? You can send it back if that's not the issue.
This reply was deleted.

Activity

DIY Robocars via Twitter
RT @gclue_akira: 柏の葉で走行させてるjetracerの中身 #instantNeRF #jetracer https://t.co/giVvuE4hP7
Jul 4
DIY Robocars via Twitter
Cool web-based self-driving simulator. Click save when the AI does the right thing https://github.com/pncsoares/self-driving-car
Jul 4
DIY Robocars via Twitter
RT @donkey_car: Human-scale Donkey Car! Hope this makes it to a @diyrobocars race https://www.youtube.com/watch?v=ZMaf031U8jg
Jun 25
DIY Robocars via Twitter
Jun 25
DIY Robocars via Twitter
Jun 16
DIY Robocars via Twitter
RT @GrantEMoe: I won my first @diyrobocars @donkey_car virtual race! Many thanks to @chr1sa @EllerbachMaxime @tawnkramer and everyone who m…
Jun 13
DIY Robocars via Twitter
RT @gclue_akira: JetRacerで自動走行したコースを、InstantNeRFで再構築。データセットは別々に収集 #jetracer #instantNeRT https://t.co/T8zjg3MFyO
Jun 13
DIY Robocars via Twitter
RT @SmallpixelCar: SPC 3.0 Now the motor also works. This car is doable. I just need to design a deck to mount my compute and sensors. http…
Jun 13
DIY Robocars via Twitter
RT @SmallpixelCar: My new car SPC 3.0. https://t.co/CKtkZOxeNQ
Jun 7
DIY Robocars via Twitter
RT @SmallpixelCar: High speed at @diyrobocars thanks @EdwardM26321707 for sharing the video https://t.co/o4317Y2U1S
Jun 7
DIY Robocars via Twitter
RT @SmallpixelCar: Today at @RAMS_RC_Club for @diyrobocars. Used @emlid RTK GPS and @adafruit @BoschGlobal IMU. Lap time 28s https://t.co/R…
May 28
DIY Robocars via Twitter
May 15
DIY Robocars via Twitter
May 14
DIY Robocars via Twitter
May 13
DIY Robocars via Twitter
RT @f1tenth: Say hi to our newest #F1TENTH creation for @ieee_ras_icra next week in Philly. It’s going to be huge! 😎 🔥 @AutowareFdn @PennEn…
May 13
DIY Robocars via Twitter
May 11
More…