0

R3 compatible data logger on Mega2560
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

R3 compatible data logger on Mega2560

by andresadafru on Wed Sep 04, 2019 6:23 pm

I am using an R3 data logger on a 2560 Mega. The RTC and SD card work fine. The problem is that when I try to connect to pins 3, 7, 44, 45, or 46, I get nothing. If I use pin 10, it works fine. Further, when I try without the shield, then all the pins respond as expected with valid information from the OneWire DS18B20. In both instances I am using the same sketch. I am not an engineer or a programmer. Just someone who thinks highly of your organization and your products and wants to learn.

Any thoughts on how to solve this?

andresadafru
 
Posts: 6
Joined: Wed Jul 25, 2018 8:10 pm

Re: R3 compatible data logger on Mega2560

by adafruit_support_carter on Wed Sep 04, 2019 6:26 pm

The DS18B20 is what you are trying to connect to 3, 7, etc. with the shield on?

And just the be sure, this is the shield you are using?
https://www.adafruit.com/product/1141

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: R3 compatible data logger on Mega2560

by andresadafru on Wed Sep 04, 2019 6:35 pm

Yes and Yes. I should correct the pins I have tried do not include pin 7. I have tried many of them, both connecting through the shield headers and directly (44, 45...). Thanks.

andresadafru
 
Posts: 6
Joined: Wed Jul 25, 2018 8:10 pm

Re: R3 compatible data logger on Mega2560

by adafruit_support_carter on Wed Sep 04, 2019 6:44 pm

The shield uses pins 13, 12, 11, and 10 to talk to the SD card. It also uses the SCL and SDA pins to talk to the RTC.

Pin 3 is totally free, so the shield should not interfere with its usage. Similarly for 44, 45, and 46.

So this seems odd. Can you post a photo showing how you have the DS18B20 connected to the MEGA with the shield. Also, the complete code listing for the sketch you are running which exhibits the issue.

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: R3 compatible data logger on Mega2560

by andresadafru on Wed Sep 04, 2019 10:03 pm

The result in Serial Monitor of connecting to pin 10 is this:
    Ferm1 = 36.50°C, Ferm2 = -127.00
The result for connecting in pin 3 is this:
    Ferm1 = 0.00°C, Ferm2 = 0.00

The code for the sketch differs in line 16. For pin 10 it reads:
    #define ONE_WIRE_BUS 10
whereas for pin 3 it reads:
    #define ONE_WIRE_BUS 3

Hope this helps. The temp of 36.5 °C was with the sensor in my mouth. Normal temp. Currently there is only one sensor, however, I am planning on adding several to the system.

Again, thank you for your attention.

ForForum.jpg
ForForum.jpg (115.65 KiB) Viewed 85 times


Code: Select all | TOGGLE FULL SIZE
/* Basic 2xDS18B20 code for serial monitor, bluetooth, Excel or w.h.y.
 Derived from Hacktronics.
 http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
 Use their address sniffer and substitute your
 numbers. Use Hacktronics connections diagram.
 Stay away from using parasite power
 -127C means bad connection
 85 means you haven't gotten a read yet, probably wrong order of commands
 Use your own LCD connections
 */

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 10

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

byte Thermo1[8] = {0x28, 0x6D, 0xC8, 0x5F, 0x05, 0x00, 0x00, 0xFC};
byte Thermo2[8] = {0x28, 0x09, 0xA9, 0xC0, 0x03, 0x00, 0x00, 0x95};
/*
 * My sensors are:
 * byte Thermo3[8] = { 0x28, 0xE3, 0x22, 0x30, 0x05, 0x00, 0x00, 0x68 };
 * byte Thermo4[8] = { 0x28, 0x1E, 0x74, 0x2F, 0x05, 0x00, 0x00, 0xFB };
 * byte Thermo5[8] = { 0x28, 0x35, 0xDB, 0x8D, 0x05, 0x00, 0x00, 0x47 };
 * byte Thermo6[8] = { 0x28, 0x8E, 0x18, 0x8E, 0x05, 0x00, 0x00, 0x5C };
 * byte Thermo7[8] = { 0x28, 0x04, 0xD5, 0x8D, 0x05, 0x00, 0x00, 0x3F };
 * byte Thermo8[8] = { 0x??, 0x04, 0xD5, 0x8D, 0x05, 0x00, 0x00, 0x?? };
 * byte Thermo9[8] = { 0x??, 0x04, 0xD5, 0x8D, 0x05, 0x00, 0x00, 0x?? };
 */

float tempC, Ferm1, Ferm2,  Ferm3, Ferm4, Chamber, Bath, KeeLow, KeeHigh, BathHot, BathCold;

void setup(){
  Serial.begin(9600);
  sensors.begin();
 
 
  sensors.setResolution(Thermo1, 10);
/*No resolution command means default to 12 bit
 
  sensors.setResolution(Thermo2, 10);
*/

  delay(1000);//Wait for newly restarted system to stabilize
}

void loop() {
  sensors.requestTemperatures();  // call readings from the addresses
  Ferm1 = sensorValue(Thermo1);
  Ferm2 = sensorValue(Thermo2);

  Serial.print("Ferm1 = ");
  Serial.print(Ferm1);//if (Ferm1, 6); will give me 6 decimal places
  Serial.print("°C, Ferm2 = ");
  Serial.println(Ferm2);

  delay(1000);
}

//sensorValue function
float sensorValue (byte deviceAddress[])
{
  tempC = sensors.getTempC (deviceAddress);
  return tempC;
}

andresadafru
 
Posts: 6
Joined: Wed Jul 25, 2018 8:10 pm

Re: R3 compatible data logger on Mega2560

by adafruit_support_carter on Thu Sep 05, 2019 1:12 pm

Please post another photo showing the soldering on the under side of the shield.

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: R3 compatible data logger on Mega2560

by andresadafru on Thu Sep 05, 2019 10:30 pm

I kept the same orientation of the SD card, on the left side of the picture.
Attachments
IMG_1490_.jpg
IMG_1490_.jpg (108.56 KiB) Viewed 61 times

andresadafru
 
Posts: 6
Joined: Wed Jul 25, 2018 8:10 pm

Re: R3 compatible data logger on Mega2560

by andresadafru on Sat Sep 07, 2019 8:05 am

Any thoughts or questions?

andresadafru
 
Posts: 6
Joined: Wed Jul 25, 2018 8:10 pm

Re: R3 compatible data logger on Mega2560

by adafruit_support_carter on Mon Sep 09, 2019 12:14 pm

The soldering may be a little thin on some pins. But let's go back to the sensor hook up.

In your first photo above, I can't fully see how the sensor is wired to the shield - can't see what wires are what in terms of the sensor pins. What wires correspond to what pins on the sensor?

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: R3 compatible data logger on Mega2560

by andresadafru on Mon Sep 09, 2019 2:59 pm

In the first picture, the red wire is coming from the OneWire sensors. It is soldered in the same horizontal line as a pink wire and one end of the 4.7KΩ resistor. That line corresponds to the top horizontal line in the picture of the back of the shield. You would see there a piece of wire connecting things coming through. My attempt to make a 5V bus.

The green wires: there is one connected to A0 and carries the current from the white wire. The second green wire, electrically separate, is the digital signal carrier for OneWire sensors. The white and pink wires are from a photoresistor and together with the tan color resistance make up the voltage divider setup.

Back to the top picture, the black wires are: one from the OneWire sensors, one from the tan resistor to the ground bus. The both connect to my attempt at a ground bus that can be seen on the underside of the board in the second picture.

The blue wire has been soldered in common with the OneWire green (signal leg) and the 4.7 KΩ pull-up resistor. The blue wire goes to the different Arduino pins that can be the OneWire input pin. It has worked on pin 10, but fails on all the others, as I initially mentioned.

I hope this helps.

I see something interesting in your data logger page, https://www.adafruit.com/product/1141. The fist picture, on the left side of the screen, is the shield I have. The second and third pictures show small white pipe symbols between the holes in the two top and bottom rows which have been designated for GND, 5V, and 3.3V. I guess that is the power and ground buses I needed and did not make very elegantly.

andresadafru
 
Posts: 6
Joined: Wed Jul 25, 2018 8:10 pm

Re: R3 compatible data logger on Mega2560

by adafruit_support_carter on Mon Sep 09, 2019 3:29 pm

It could be what you suggest with the power rails. It sounds like you have an older version of the board where the prototyping area did not have the 5V/3V/GND power rail sections. So double check all that and any other wiring/soldering.

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.