Problem Initializing BMP280 Sensor after SD Card Insertion

wendolw

  • Newbie
  • *
    • Posts: 2
    • View Profile
I am configuring the BMP280 pressure sensor for a science project using instructions provided at Rocket Altimeter Logger[tinycircuits.com]. The instructions are well-written, and provide a direct interface with the device. First, I tested the TinyShield USB using the "blinking" sample code. Then, I uploaded the actual code for the pressure sensor. Initially, this also was successful. However, the remaining instructions do not provide a link to a serial monitor to display data output. To address this issue, I ran the program in the Arduino Sketchbook (Arduino.cc) environment. I transferred the written code for the sensor and data logger (4 programs: TinyShield BarometricPressure, BMP280.CC, BMP280.h, Altimeter_DataLogger) to the Sketchbook to monitor its output on the Serial Monitor. The board and port designations were correct. I was able to obtain sequential output (time-temp-pressure) from the device, displayed on the serial monitor. However, when I attempted to load the SD card to download the data (turning off the device before inserting the SD card), the sensor stopped working. On the serial monitor, I received an error message, "BMP Init failed". It appears that running the code in the Arduino.cc environment is compromised when the SD card is introduced to download the data, leaving definitions of the BMP280, imprecise. Please provide general feedback, or a specific recommendation for, a) code correction for the data output interface, and/or b) how to secure a link to the serial monitor on the Rocket Altimeter Logger page. Thank you.


wendolw

  • Newbie
  • *
    • Posts: 2
    • View Profile
I am publishing a solution to the above "pressure sensor initializing" problem that I initially posted here on 3-1-2019. I hope that this solution and the references/citations listed, will help others who wish to build the TinyCircuits Rocket Altimeter as a fully functioning unit using late model MacBook laptops running on macOS Sierra operating systems with versions 10.9, and up (my MacOS Sierra was version 10.12.6).

Rocket Altimeter Build Using MacOS Sierra Version 10.12.6   3-29-2019

BUILD SEQUENCE
•   Initializing Stack Hierarchy (Bottom to Top)
1.   Lithium Battery
2.   TinyDuino Processor
3.   TinyShield USB
4.   TinyShield Barometric Pressure Sensor
5.   TinyShield Micro SD

•   Step One: Charge the Lithium Battery
1.   Charge the Lithium Ion battery by connecting the TinyDuino Processor to the USB TinyShield and plug in the USB chord to your computer.
2.   A yellow LED will turn on showing that the battery is charging.
a.   When the LED turns off, the battery is fully charged. 

•   Step Two: Load the Drivers
1.   Before starting, the proper drivers must be installed to detect the COM ports. These drivers must be installed before downloading any codes from the codebender plugin (https://codebender.cc/).
2.   Go to http://www.ftdichip.com/Drivers/VCP.htm
a.   The page contains VCP drivers currently available for FTDI devices.
b.   Virtual COM port (VCP) drivers cause the USB device to appear as an additional COM port available to the PC. 
c.   Application software can access the USB device in the same way as it would access a standard COM port.
3.   Open VCP Drivers for Mac OS X 10.9 and above, for 64-bit functionality, listed as 2.4.2, click on icon, and follow installation instructions.

•   Step Three: Disable the Apple USBFTDI Drivers
1.   Go to Applications Folder/Utilities folder. Select Terminal.
o   PROBLEM:
FTDI devices are not instantly usable in MacOS High Sierra. There may be trouble connecting FT231R chip devices to a 2018 MacBook Air with C-Ports. The devices appear in the USB device tree (System Information -> Hardware -> USB), but do not show up as a serial device using Arduino.


o   SOLUTION:
2.   Download the 2.4.2 drivers from FTDI's website http://www.ftdichip.com/Drivers/VCP.htm and install. The install will succeed, but due to Apple's built-in FTDI drivers, they will not work.
3.   Reboot computer and enter recovery mode via powering down and, then holding down CMD + R on reboot.
4.   In Recovery Mode, open terminal from utilities at the top of the screen and type the following command to temporarily disable System Integrity Protection:
csrutil disable

The computer will then prompt you to reboot to make the changes take effect.
5.   On reboot, we now will disable the Apple FTDI drivers, which can be reversed later if desired.
6.   Open Terminal and type the following code:
      sudo touch /library/extensions
       sudo mv AppleUSBFTDI.kext AppleUSBFTDI.disabled

Now you will have successfully disabled Apple's built-in FTDI drivers and replaced them with FTDI v2.4.
7.   Restart your computer in recovery mode. Shutdown, hold Command + R and open terminal in the Utilities tab. Enter the following to “re-enable” Apple's System Integrity Protection.
csrutil enable

8.   One final restart and then the USB serial devices should all be loading properly.

•   Step Four: Download Code
1.   Before starting, the proper drivers must be installed to detect the COM ports. These drivers must be installed before downloading any codes from the codebender plugin (https://codebender.cc/).
2.   To reiterate, and as noted in the Tiny Circuits’ instruction published on their website, titled Rocket Altimeter  (https://tinycircuits.com/blogs/learn/130916679-rocket-altimeter-logger), “once the drivers are successfully installed, the program below can be downloaded to your computer or directly uploaded to your TinyDuino processor.”
3.   You now have to navigate to the main codebender sketch page to access their serial monitor (https://codebender.cc/sketch:145121#Altimeter_DataLogger.ino)
4.   “The sensor used for the barometric pressure shield is the BMP280 from Bosch.
5.   The first sample of code shows the data coming from the sensor in the COM port while the second code logs the data to the microSD card.
6.   In order for the data to be logged, the SD card must be inserted before the TinyDuino is switched on.
7.   When the device logs a data point, a green LED on the processor will flash on and off.
8.   The code is setup to export the data points as a .csv file so it can be opened directly into Microsoft Excel.” 

•   References & Attributions:
1.   https://superuser.com/questions/1135730/how-to-release-reset-serial-port-ftdi-devices-mac-osx
2.   Garrett Johnson/Superuser Forum (excellent post on drivers & MacOS)
3.   Alain O’Dea/Superuser Forum (helpful addendum to the G. Johnson post)
4.   Tiny Circuits Staff [Ben Rose – timely response with excellent technical advice]
« Last Edit: March 29, 2019, 09:57:23 PM by wendolw »


 

SMF spam blocked by CleanTalk