Naga 0 Posted June 3, 2014 Share Posted June 3, 2014 I tried DHT11 with this library (post #19), and Stellaris launchpad LM4F120XL. It works fine with some changes already suggested in this thread. I tried with both 4.7K and 10K resistor both works. But I get only 8BIT resolution data from DHT11 (Byte0 and 2) . It might be something wrong with the sensor itself as someone reported in another forum. Energia version is 0101E0011. here is the summary I had to change DHT22_430.h from ----- #if defined(__MSP430G2452__) || defined(__MSP430G2553__) || defined(__MSP430G2231__) // LaunchPad specific #include "Energia.h" #else // error #error Platform not supported #endif to --- #include "Energia.h" on DHT22_430.cpp from ------ if (counter > 8) to --- if (counter > 13) For me 15 also worked here. In the same file I had to comment out /// _temperature *= 256; /// _humidity *= 256; on the main sketch Serial.print("RH% \t"); Serial.print(h); // no divide by 10 and following two lines commented out // Serial.print("."); // Serial.print(h%10); Serial.println(" %\t"); Serial.print("oC \t"); Serial.print(t); // no divide by 10 and following two lines commented out // Serial.print("."); // Serial.print(t%10); Serial.println(" *C"); Quote Link to post Share on other sites
mic 0 Posted June 22, 2014 Share Posted June 22, 2014 (edited) Hello once again I have problem with Stellaris LM4F120 Launchpad and DHT22 (connected on PB_7). I'm using LCD 5110(3,3v) + DHT22(tested on 5v+ resistor 10kOhm & 3,3v + resistor 10kOhm ) + on I2C BMP085(3,3v), TinyRTC (5v), HD44780 20x4(5v) (all on PD_0 & PD_1) When I'm using only LCD5110 + DHT22 without <Wire.h> liblary included, both are working well: When I'm using LCD5110, DHT22 + all I2C devices with <Wire.h> I get on HD44780: Also TinyRTC gives me a strange dates for example 2050/07/21 When I'm disconnecting DHT22 and running the same code as in case above, I get: So it looks like a problem with running I2C and DHT22 at the same time. -> Fixed changed connection of the I2C devices to module 1. Thanks mic Edited July 3, 2014 by mic Quote Link to post Share on other sites
laga 1 Posted October 18, 2014 Share Posted October 18, 2014 Hello all, I just tried the example code in Energia 13 and get the following error when compiling. I deleted my energia preferences to not avail. The library resides in its own directory inside my ~/sketchbook/libraries/ and shows up in the Energia menu. [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-g++, -c, -Os, -w, -ffunction-sections, -fdata-sections, -mmcu=msp430g2553, -DF_CPU=16000000L, -MMD, -DARDUINO=101, -DENERGIA=13, -I/home/laga/download/energia-0101E0013/hardware/msp430/cores/msp430, -I/home/laga/download/energia-0101E0013/hardware/msp430/variants/launchpad, -I/home/laga/sketchbook/libraries/DHT22_430_main, /tmp/build3433782599202339748.tmp/DHT22_430.cpp, -o, /tmp/build3433782599202339748.tmp/DHT22_430.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-g++, -c, -Os, -w, -ffunction-sections, -fdata-sections, -mmcu=msp430g2553, -DF_CPU=16000000L, -MMD, -DARDUINO=101, -DENERGIA=13, -I/home/laga/download/energia-0101E0013/hardware/msp430/cores/msp430, -I/home/laga/download/energia-0101E0013/hardware/msp430/variants/launchpad, -I/home/laga/sketchbook/libraries/DHT22_430_main, /tmp/build3433782599202339748.tmp/DHT22_430_main.cpp, -o, /tmp/build3433782599202339748.tmp/DHT22_430_main.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/twi.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/WInterrupts.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/random.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/wiring.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/wiring_analog.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/wiring_shift.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/wiring_pulse.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/wiring_digital.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/usci_isr_handler.c.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/Tone.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/WMath.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/Stream.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/IPAddress.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/Wire.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/main.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/new.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/HardwareSerial.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/Print.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/WString.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-ar, rcs, /tmp/build3433782599202339748.tmp/core.a, /tmp/build3433782599202339748.tmp/TimerSerial.cpp.o] [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-gcc, -Os, -Wl,-gc-sections,-u,main, -mmcu=msp430g2553, -o, /tmp/build3433782599202339748.tmp/DHT22_430_main.cpp.elf, /tmp/build3433782599202339748.tmp/DHT22_430.cpp.o, /tmp/build3433782599202339748.tmp/DHT22_430_main.cpp.o, /tmp/build3433782599202339748.tmp/DHT22_430_main/DHT22_430.cpp.o, /tmp/build3433782599202339748.tmp/core.a, -L/tmp/build3433782599202339748.tmp, -lm] DHT22_430_main/DHT22_430.cpp.o: In function `DHT22::DHT22(unsigned char)': DHT22_430.cpp:(.text._ZN5DHT22C2Eh+0x0): multiple definition of `DHT22::DHT22(unsigned char)' DHT22_430.cpp.o:DHT22_430.cpp:(.text._ZN5DHT22C2Eh+0x0): first defined here DHT22_430_main/DHT22_430.cpp.o: In function `DHT22::begin()': DHT22_430.cpp:(.text._ZN5DHT225beginEv+0x0): multiple definition of `DHT22::begin()' DHT22_430.cpp.o:DHT22_430.cpp:(.text._ZN5DHT225beginEv+0x0): first defined here DHT22_430_main/DHT22_430.cpp.o: In function `DHT22::temperatureX10()': DHT22_430.cpp:(.text._ZN5DHT2214temperatureX10Ev+0x0): multiple definition of `DHT22::temperatureX10()' DHT22_430.cpp.o:DHT22_430.cpp:(.text._ZN5DHT2214temperatureX10Ev+0x0): first defined here DHT22_430_main/DHT22_430.cpp.o: In function `DHT22::humidityX10()': DHT22_430.cpp:(.text._ZN5DHT2211humidityX10Ev+0x0): multiple definition of `DHT22::humidityX10()' DHT22_430.cpp.o:DHT22_430.cpp:(.text._ZN5DHT2211humidityX10Ev+0x0): first defined here DHT22_430_main/DHT22_430.cpp.o: In function `DHT22::get()': DHT22_430.cpp:(.text._ZN5DHT223getEv+0x0): multiple definition of `DHT22::get()' DHT22_430.cpp.o:DHT22_430.cpp:(.text._ZN5DHT223getEv+0x0): first defined here DHT22_430_main/DHT22_430.cpp.o: In function `DHT22::DHT22(unsigned char)': DHT22_430.cpp:(.text._ZN5DHT22C2Eh+0x0): multiple definition of `DHT22::DHT22(unsigned char)' DHT22_430.cpp.o:DHT22_430.cpp:(.text._ZN5DHT22C2Eh+0x0): first defined here collect2: ld returned 1 exit status Quote Link to post Share on other sites
laga 1 Posted October 25, 2014 Share Posted October 25, 2014 Dear all, I found out why the example won't compile for me. DHT22_430.cpp.o is included twice in the linking step, hence the errors about 'multiple definitions'. If I copy the example sketch into a new sketch, it compiles just fine. Before, I would just select the example from the examples menu and get the error I pasted above. Working line: [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-gcc, -Os, -Wl,-gc-sections,-u,main, -mmcu=msp430g2553, -o, /tmp/build1383130571671707338.tmp/sketch_oct25b.cpp.elf, /tmp/build1383130571671707338.tmp/sketch_oct25b.cpp.o, /tmp/build1383130571671707338.tmp/DHT22_430_main/DHT22_430.cpp.o, /tmp/build1383130571671707338.tmp/core.a, -L/tmp/build1383130571671707338.tmp, -lm] Broken line: [/home/laga/download/energia-0101E0013/hardware/tools/msp430/bin/msp430-gcc, -Os, -Wl,-gc-sections,-u,main, -mmcu=msp430g2553, -o, /tmp/build1383130571671707338.tmp/DHT22_430_main.cpp.elf, /tmp/build1383130571671707338.tmp/DHT22_430.cpp.o, /tmp/build1383130571671707338.tmp/DHT22_430_main.cpp.o, /tmp/build1383130571671707338.tmp/DHT22_430_main/DHT22_430.cpp.o, /tmp/build1383130571671707338.tmp/core.a, -L/tmp/build1383130571671707338.tmp, -lm] Best, Michael Quote Link to post Share on other sites
OzGrant 22 Posted January 11, 2015 Share Posted January 11, 2015 Am about to use a DHT22 in a TIVA that's running wire.h (plus using Energia 14) Mic, a few posts ago, said this configuration fails when I2C is in the mix. Is this the case. Or to put it simply has anyone got a DHT22 TIVA lib, that works when I2C is also used. Quote Link to post Share on other sites
OzGrant 22 Posted January 11, 2015 Share Posted January 11, 2015 DHT22 now works on the Tiva and can now get on with where I was 3 days ago with the F5529, but now have the freedom of rom space. I must commend Rei VILO on his smart use of #define DEBUG, this made lib fault-finding a breeze. Be nice if all libs have this sort of feature, so that later lib iterations (to cater for new devices) can be checked. One bug I had (not sure if you can call a hardware bug a bug- never mind) was R9 & R10. They are zero link resistors that connect pins 14 & 23 together, as well as linking pins 15 & 24 together. Was getting all sorts of strange results until I unsoldered them. Grant Rei Vilo 1 Quote Link to post Share on other sites
Rei Vilo 695 Posted March 8, 2015 Author Share Posted March 8, 2015 One bug I had (not sure if you can call a hardware bug a bug- never mind) was R9 & R10. They are zero link resistors that connect pins 14 & 23 together, as well as linking pins 15 & 24 together. Was getting all sorts of strange results until I unsoldered them. I'm glad it works now. Thank you for the accolade. R9 and R10 on the Stellaris / Tiva C LaunchPad redirect an I Quote Link to post Share on other sites
RobLewis 7 Posted April 12, 2015 Share Posted April 12, 2015 I think I'm looking at the latest version, and line 82 of the .cpp file says: #if defined(__MSP430G2452__) || defined(__MSP430G2553__) || defined(__MSP430G2231__) // LaunchPad specific Can I just add the MSP430F5529 to this list? Quote Link to post Share on other sites
Rei Vilo 695 Posted April 12, 2015 Author Share Posted April 12, 2015 Can I just add the MSP430F5529 to this list? Sure, or you can even remove that line and the corresponding #else and #end statements. Quote Link to post Share on other sites
rinhbt 0 Posted May 9, 2016 Share Posted May 9, 2016 Idk why but I've run this with my Tiva C TM4C123G without actually modding anything ( except the part that require exactly device, i've erased it ). So why'd you guy so confuse about the Sysclk. I choose my Tiva C (80Mhz) and this code is working fine But can I ask you a question please ? how is those debug code work, i mean those debug bits received 40 debug 2, F8, 1, 4A, 45 =? 45 debug checksum NO debug RH% 760 debug oC 330 and i am trying to connect this to a 16x2 LCD. hope it gonna work Quote Link to post Share on other sites
rinhbt 0 Posted May 9, 2016 Share Posted May 9, 2016 I finally connect the DHT22 with my Tiva C TM4C123G and the code have been work, but when I try to mod the code so it can show info on my LCD. the code is as following: #include "Energia.h" // Include application, user and local libraries #include "DHT22_430.h" #include "LiquidCrystal.h" #define DHTPIN PD_0 //Stellaris //#define DHTPIN P1_4 //MSP430 DHT22 mySensor(DHTPIN); boolean flag; LiquidCrystal lcd(PD1, PD2, PD3, PE1, PE2, PE3); void setup() { Serial.begin(9600); Serial.println("\n\n\n*** DHT22 test starts"); Serial.println("PUSH2 to end"); pinMode(PUSH2, INPUT_PULLUP); mySensor.begin(); lcd.begin(16, 2); } void loop() { delay(2000); // for Stellaris a lower value has a greater deviation // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) flag = mySensor.get(); int32_t h = mySensor.humidityX10(); int32_t t = mySensor.temperatureX10(); // check if returns are valid, if they are NaN (not a number) then something went wrong! if (!flag) { Serial.println("Failed to read from DHT"); } else { Serial.print("RH% \t"); Serial.print(h/10); Serial.print("."); Serial.print(h%10); Serial.println(" %\t"); Serial.print("oC \t"); Serial.print(t/10); Serial.print("."); Serial.print(t%10); Serial.println(" *C"); lcd.setCusor(0, 1); lcd.print("RH% \t"); lcd.print(h/10); lcd.print("."); lcd.print(h%10); lcd.println(" %\t"); lcd.setCusor (0, 2); lcd.print("oC \t"); lcd.print(t/10); lcd.print("."); lcd.print(t%10); lcd.println(" *C"); } if (digitalRead(PUSH2)==LOW) { Serial.println("\n\n*** End"); Serial.end(); while(true); // endless loop } } but unfortunately it show the bug that: core.a(main.cpp.o): In function `main':main.cpp:(.text.startup.main+0x2): undefined reference to `setup' main.cpp:(.text.startup.main+0x6): undefined reference to `loop' collect2.exe: error: ld returned 1 exit status i don't really know what happen and for the code in the .cpp file, I don't understand the DEBUG section of it, really confused Quote Link to post Share on other sites
Rei Vilo 695 Posted May 25, 2016 Author Share Posted May 25, 2016 As the 5110 and 7110 screens are deprecated, consider an OLED 128 x 64 I Quote Link to post Share on other sites
hashmir33 0 Posted June 16, 2016 Share Posted June 16, 2016 Hello! I am new to msp430 and Energia Compiler and I found this library for DHT22 that you posted several years ago and I really need some help: I need to send the data from the sensor to a GSM module SIM 808 (works with AT commands) through serial port. When I run the example I get in the serial monitor the debug info lines and then the values. My big question is:Are the debug lines affecting my commands sent to the GSM Module and if so...how can i remove them? Please help:) Thank you in advance! debug bits received 40 debug 2, F8, 1, 4A, 45 =? 45 debug checksum OK debug RH% 690 debug oC 290 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.