# Help with altimeter build

**URL:** <https://discuss.bluerobotics.com/t/help-with-altimeter-build/6419>\
**Category:** Ping Sonar Devices\
**Created:** [November 26, 2019, 5:44am UTC](https://discuss.bluerobotics.com/t/help-with-altimeter-build/6419 "2019-11-26T05:44:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimbongaerts](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@pimbongaerts](https://discuss.bluerobotics.com/u/pimbongaerts)\
**Post date:** [November 26, 2019, 5:44am UTC](https://discuss.bluerobotics.com/t/help-with-altimeter-build/6419/1 "2019-11-26T05:44:45Z")

</div>

Was hoping to see whether anyone may be able to help me with the following. I used the BR Ping/Bar30 sensors in combination with an Arduino Uno + LCD + [Datalogging Shield](https://learn.adafruit.com/adafruit-data-logger-shield/wiring-and-config) to build a simple altimeter for our camera scooter. The idea was that it can help us keep consistent altitude while conducting diver-based underwater surveys, while at the same time logging altitude/depth every second.

I managed to get it all working except for the SD card logging: for some reason the Arduino freezes up when I try to use both the Ping and SD card reader. If I comment out the `init_sdcard()` function - everything works fine (except of course logging to SD card). Similarly, SD card logging works fine when I comment out the `init_sonar()` function. I can’t figure out what’s causing the conflict - as far as I know there are no overlapping/conflicting pins (I cut a trace on the datashield to reassign chipselect to pin 8).

Just wanted to post a [link to the code here](https://github.com/pimbongaerts/altimeter/blob/master/altimeter.ino) - to see if anyone spots something obvious that I missed? First arduino project for me - so any help would be greatly appreciated! Otherwise altimeter itself worked great - [see short video snippet of it in action here.](https://youtu.be/MPSLyS0Zb7o)

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [November 26, 2019, 8:09pm UTC](https://discuss.bluerobotics.com/t/help-with-altimeter-build/6419/2 "2019-11-26T20:09:36Z")

</div>

It sounds like there is a conflict in the mcu resources required by the software serial library and the sd card library. If you google arduino spi + software serial, you will find a lot of similar experiences: [SPI and SoftwareSerial Not Working Together - Programming Questions - Arduino Forum](https://forum.arduino.cc/index.php?topic=562282.0). Sadly, this can be difficult to resolve.

One quick thing to try: It looks like you are not using the hardware serial port on your arduino, that’s connected to the arduino RX and TX pins. Move the ping to those pins, and try removing the softwareserial lines.

Instead use `static Ping1D ping { Serial };`

and `Serial.begin(9600)`

---

<div class="post-metadata">

**Author:** ![pimbongaerts](https://avatars.discourse-cdn.com/v4/letter/p/9dc877/32.png) [@pimbongaerts](https://discuss.bluerobotics.com/u/pimbongaerts)\
**Post date:** [January 6, 2020, 1:26am UTC](https://discuss.bluerobotics.com/t/help-with-altimeter-build/6419/3 "2020-01-06T01:26:31Z")

</div>

Finally got around to trying this - and it worked. Thank you!

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [January 6, 2020, 6:22pm UTC](https://discuss.bluerobotics.com/t/help-with-altimeter-build/6419/4 "2020-01-06T18:22:02Z")

</div>

Closed on January 6, 2020, 6:22pm UTC


