DSM501a - Arduino | Arduino | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
DSM501a - Arduino
Avatar
Sintra Air
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
1
March 24, 2017 - 6:43 pm
sp_Permalink sp_Print

 Hello comunity, I'm new here.

 

Have been able to post DHT readings to my channel with no problems at all.

Recently, I've been trying, with no any success to post data from a dust sensor, the DSM501a.

So, I can read the sensor on Arduino serial, but once I try to implement it on the sketch that I'm using to upload DHT sensor, this part of the code seems to stop everything 🙁

void setup ()

// Initialize DSM501
dsm501.begin(MIN_WIN_SPAN);

// wait 60s for DSM501 to warm up
for (int i = 1; i <= 60; i++)
{
delay(1000); // 1s
Serial.print(i);
Serial.println(" s (wait 60s for DSM501 to warm up)");
}

Any ideas?

Avatar
rw950431

Forum Posts: 250
sp_UserOfflineSmall Offline
2
March 25, 2017 - 7:31 am
sp_Permalink sp_Print

Does it print anything to Serial?

 

The code you posted is missing a closing }- I assume there is one in the real code.

Avatar
Sintra Air
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
3
March 25, 2017 - 7:01 pm
sp_Permalink sp_Print

Hey!

 

It was printing.

 

Problem "kinda" solved.

It started posting information, but sometimes it just stops for radom 20 or 30min periods.

Maybe now related with the power supply, I think. Or arduino's memory. 

Next step: debug power supply.

 

I moved that part of the code on the void setup () 

to after all the ethernet operations before sending.

I think it might be related with timeouts.

 

//------ENC28J60----------
//if correct answer is not received then re-initialize ethernet module
//changed from 220 to 2800
if (res > 220){
initialize_ethernet();
}

res = res + 1;

ether.packetLoop(ether.packetReceive());

//200 res = 10 seconds (50ms each res)
if (res == 200) {

//_____________ TIME for DESPERATED MEASURES
dsm501.begin(MIN_WIN_SPAN);
dsm501.update();
int p=(dsm501.getPM25()/100);

// field1=(Field 1 Data)&field2=(Field 2 Data)&field3=(Field 3 Data)&field4=(Field 4 Data)&field5=(Field 5 Data)&field6=(Field 6 Data)&field7=(Field 7 Data)&field8=(Field 8 Data)&lat=(Latitude in Decimal Degrees)&long=(Longitude in Decimal Degrees)&elevation=(Elevation in meters)&status=(140 Character Message)
byte sd = stash.create();
stash.print("field1=");
stash.print(t);
stash.print("&field2=");
stash.print(h);
stash.print("&field3=");
stash.print(p);
stash.save();

 

I have lots of ideas, the problem is putting them to the practice.

Fortunately there are so many possibilities nowadays, and there is internet, the biggest library in the world =D

Avatar
Sintra Air
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
4
March 26, 2017 - 1:35 pm
sp_Permalink sp_Print sp_EditHistory

So, I was powering everything from arduino uno board.

 

Today I repurposed an old Sat Receiver's power supply, which supplies multiple voltages (3.3, 5, 7 and 12V, all with common groud), and powered everything (ethernet shield 3.3v, DSM501a 5v, dht11 5v and the arduino itself with 7v.
still to add a gas sensor, as soon as it arrives at my location.

The insane behaviour seems to have stopped.

Although, I had one 20min pause, in about 5 hours of sending data every minute. Not perfect, but can't complain. It could be internet connection, or even a thingspeak problem. 

Can't debug live, because the device is far away from home.

Will be now for a 48h run to check for stability.

 

BTW, channel here: https://thingspeak.com/channels/230655 Laugh

Avatar
Sintra Air
New Member
Forum Posts: 4
sp_UserOfflineSmall Offline
5
April 2, 2017 - 7:41 am
sp_Permalink sp_Print

So, conclusion, just in case someone is in the same situation:

 

It was a program problem. It still is, but I found a way out.

SRAM, as far as I understood was being corrupted, making the arduino behave strange and random.

Using the comand: asm volatile ("  jmp 0");  after the last action performed by the program, helped a lot.

It "clears" all the volatiles and the system runs smooth with no problems at all.

 

Might be a dirty way to do the thing speak forever with no interruptions, but the fact is that it works like a charm.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: alexparrado
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 250

Vinod: 142

piajola: 73

vespapierre: 63

Adarsh_Murthy: 59

cstapels: 54

Newest Members:

chrissaxon

getty

l3inbin

ossan

gbalychik

wul

Forum Stats:

Groups: 4

Forums: 17

Topics: 1242

Posts: 4315

 

Member Stats:

Guest Posters: 1

Members: 5546

Moderators: 0

Admins: 2

Administrators: Hans, lee