Hello,
I am working on my first project ever and I have 2 SEN15805 boards which I try to get reading from.
My connection looks something like this, but I have removed the INT wire:
At first I tried to run the Basic Readings example from the arduino library but I got no result at all, then I added the while(!Serial); line on the code and at least I can see results but I only get this result: Device failed to setup- Freezing code.
The Basic Reading code:
/******************************************************************************
Example1_BasicReadings.ino
Example for the TMP117 I2C Temperature Sensor
Madison Chodikov @ SparkFun Electronics
May 29 2019
~
This sketch configures the TMP117 temperature sensor and prints the
temperature in degrees celsius and fahrenheit with a 500ms delay for
easier readings.
Resources:
Wire.h (included with Arduino IDE)
SparkFunTMP117.h (included in the src folder) http://librarymanager/All#SparkFun_TMP117
Development environment specifics:
Arduino 1.8.9+
Hardware Version 1.0.0
This code is beerware; if you see me (or any other SparkFun employee) at
the local, and you've found our code helpful, please buy us a round!
Distributed as-is; no warranty is given.
******************************************************************************/
/*
NOTE: For the most accurate readings:
- Avoid heavy bypass traffic on the I2C bus
- Use the highest available communication speeds
- Use the minimal supply voltage acceptable for the system
- Place device horizontally and out of any airflow when storing
For more information on reaching the most accurate readings from the sensor,
reference the "Precise Temperature Measurements with TMP116" datasheet that is
linked on Page 35 of the TMP117's datasheet
*/
#include <Wire.h> // Used to establish serial communication on the I2C bus
#include <SparkFun_TMP117.h> // Used to send and recieve specific information from our sensor
// The default address of the device is 0x48 = (GND)
TMP117 sensor; // Initalize sensor
void setup()
{
Wire.begin();
Serial.begin(115200); // Start serial communication at 115200 baud
while(!Serial); // I ONLY ADDED THIS LINE
Wire.setClock(400000); // Set clock speed to be the fastest for better communication (fast mode)
Serial.println("TMP117 Example 1: Basic Readings");
if (sensor.begin() == true) // Function to check if the sensor will correctly self-identify with the proper Device ID/Address
{
Serial.println("Begin");
}
else
{
Serial.println("Device failed to setup- Freezing code.");
while (1); // Runs forever
}
}
void loop()
{
// Data Ready is a flag for the conversion modes - in continous conversion the dataReady flag should always be high
if (sensor.dataReady() == true) // Function to make sure that there is data ready to be printed, only prints temperature values when data is ready
{
float tempC = sensor.readTempC();
float tempF = sensor.readTempF();
// Print temperature in °C and °F
Serial.println(); // Create a white space for easier viewing
Serial.print("Temperature in Celsius: ");
Serial.println(tempC);
Serial.print("Temperature in Fahrenheit: ");
Serial.println(tempF);
delay(500); // Delay added for easier readings
}
}
I am pretty sure that the wires are in the correct order in terms to the Arduino pins (SDA/SCL) and the power led is fine but I have no idea why I get no reading at all!
Any help would be appreciated, thank you!
P.S.
This is the same for both of the Sen15805 boards.
Double-check that the correct ‘Board’ and ‘COM’ ports are selected in the programming IDE (it should say “Arduino Nano 33 BLE”, you may need to click on “Boards Manager” and install the files 1st) and you can determine the board’s COM port by unplugging/plugging it back in, and watching to see which COM port appears/disappears
I have installed from the board manager the 2 possible packages for Arduino Nano 33 BLE but I get the same results with either of them.
My schematic looks like this:
When I add the following lines on the code above:
Serial.print("Current Device Address: ");
Serial.println(sensor.getAddress(), HEX); // Prints the current address of the device in Hex
I get this result in the Serial Monitor:
→ Current Device Address: 0
Thanks for your time and answer!
Are each of your boards set to different addresses?
What happens if you use only one board?
I try to use them separately. I have only 1 board connected.
I told that I have 2 SEN15805 boards and I take the same results from both so I dont think the boards are faulty. I have even tried a different Arduino Nano 33 BLE and I get the same results.
Even when I run an I2C scanner, I can not find any boards connected.
It could be that the code you’re using doesn’t work on the Nano 33 BLE or possibly something special needs to be done with the Nano 33 BLE to use I2C. I haven’t used either the TMP117 or the Nano 33 before so I can’t help much with debugging but a good sanity check would be to try the TMP117 on an Uno just to make sure it’s functional.
Unfortunately I do not own any other arduino besides the Nano 33 BLE.
I measured the Voltage between the 3.3V pin and the GND pin and I got 3.32V so the power seems ok.
Then I measured the resistances (while power was off) on the 3.3V pin and the SCL pin and I got 2.18kΩ,
and when I measured between the 3.3V pin and the SDA pin I did not get a constant value, but it kept going from 60kΩ to 210kΩ.
So there is a problem with the I2C resistances on the board? What values of resistance should I get normally?
I thought I should get 2,35kΩ on both pins(SDA/SCL) since there is 2 resistances of 4.7kΩ parallel to each other?
Thanks again for your answers.
P.S.
I even tried the Adafruit library getting the same results
You need to solder [headers to the board, plug the board into your breadboard and then plug your wires into the breadboard. Just sticking the wires through the holes in the board won’t work.](https://upload.wikimedia.org/wikipedia/commons/b/bf/6_Pin_Header.jpg)
At first I tried with the headers I got with the package of SEN15805, it was the same results. Why would wires through the holes not work though?
Edit:
If I put the headers without soldering them and put it on the bread board I would not get precise readings?
And if I solder wires through the holes without headers would that affect the connections?
edit2:
In the hook up guide of MAX30105 which I also got
https://learn.sparkfun.com/tutorials/ma … -guide/all
It shows that you can put wires through the holes and solder them to use them away from a bread board, so why if not soldered not to work properly?
Without the solder, you’re not getting a solid electrical connection between the board and the header/wire.
Soldering the headers would be your best bet, that gives you the flexibility of using the sensors in a different project later if you want too.
Thank you very much for your answer. I will try and solder the headers or the wires though the holes and see what kind of results I get.
When I measure the resistance (without power) on the 3.3V pin and the SDA/SCL pin what kind of value should I get?
@YellowDog Thank you so much for your answer. Indeed after soldering the wires though the holes 1 (out of 2) temp boards works perfectly. The other keeps not showing results but I will try to re-solder different wires in case they are faulty.
Thank you again, you really helped me a lot!