The Forum » 'BB', Our Main Discussion Forum : Come in Here ! > Picaxe Humidity Sensor
Login Register Search Recent Posts

leea1561

Posted: 3 August 2017 12:29 PM
 

Member Since:
27 July 2017
Posts: 5
Points: 8


This post was awarded 1 point!

I am a year 9 student at Mission heights junior college.  We are currently working on a picaxe based project.  The problem I have is I am using a humidity sensor and I can't get it to read any measurements.

Could anybody please help with a code I can try to get my sensor to read.  I have tried readadc and readtemp (ds18b20) which works ok. 

Thanks any help is appreciated.


Last updated 10 August 2017 12:31 PM by leea1561

Andrew H

Posted: 6 August 2017 12:23 PM
 

Member Since:
15 June 2011
Posts: 3604
Points: 463


This post was awarded 1 point!

Need some details :)
Here are some systems I have used

These use

the I2C protocol so you have to read the data sheets to get this working and figure out how to convert the nyumbers in the registers to %Rh.  You can get other types and examples from the UK Rev Ed Picaxe site and 'how to do it' with I think... analogue outputs and readadc etc...  I have example code but no spare modules, you will need to get them first.

~ Andrew

 

 



Andrew H

Posted: 6 August 2017 12:25 PM
 

Member Since:
15 June 2011
Posts: 3604
Points: 463


This post was awarded 1 point!



leea1561

Posted: 10 August 2017 12:38 PM
 

Member Since:
27 July 2017
Posts: 5
Points: 8


This post was awarded 3 points!

Hi Andrew,

Thanks for your reply, could you help me with the code so I know which sensor will match this?

Regards,

Amanda

>>>
As below, the DHT11 is NOT compatible with the picaxe08M2 or I have not seen it used yet
I Have managed to make the above circuit work and have a spare unit and some code if you are keen to try it

https://duckduckgo.com/?q=instructable+DHT11+arduino&t=ffab&atb=v77-1_u&ia=web

There are heaps of examples and tutorials.

My Picaxe approach with a different technology and micro is Very different but if you are keen then I can send you a working example as spare for you and your teacher to evaluate and test ideas out with until I come past your school next time.

~ Andrew



leea1561

Posted: 10 August 2017 12:43 PM
 

Member Since:
27 July 2017
Posts: 5
Points: 8


This post was awarded 3 points!

Can you also tell me the best place to buy the humidity sensor from? I have bought the existing ones from surplustronics, but these are the only ones they have.

Thanks,

Amanda

>>> Hi, The information for the Surplustronics device and information for an Arduino is located here:
https://www.surplustronics.co.nz/products/7257-digital-temperature-and-humidity-sensor

There will be a lot of information out there on the www for this approach if you do some www searches.
I recomend using instructables.  They are GREAT as they have step by step 'how to' do just about everything.

E.g.
... and Temperature (DHT11) Sensor to Arduino and including DHT11 Library

https://duckduckgo.com/?q=instructable+DHT11+arduino&t=ffab&atb=v77-1_u&ia=web

There are heaps of examples and tutorials.

My Picaxe approach with a different technology and micro is Very different but if you are keen then I can send you a working example as spare for you and your teacher to evaluate and test ideas out with until I come past your school next time.

~ Andrew

 


Last updated 10 August 2017 12:44 PM by leea1561

leea1561

Posted: 24 August 2017 12:59 PM
 

Member Since:
27 July 2017
Posts: 5
Points: 8


This post was awarded 1 point!

Hi Andrew,

Thanks for your offer of an example humidity sensor with picaxe, can I please take you up on this offer.  In the meantime I am exploring using the DHT11 with an arduino, but I am more familiar with the picaxe so using the arduino may be difficult for me.  If you are sending it tome can you please send it at this address care of my teacher.

Thanks,

Amanda

>>> In the post today.
Sorry for delay, been in Dunedin
When you get it e-mail me for some example code to make it work
~ Andrew



Andrew H

Posted: 31 August 2017 3:53 PM
 

Member Since:
15 June 2011
Posts: 3604
Points: 463


This post was awarded 1 point!

Hi

I will send you this set up in a few days.

Good if you can tell me the kind of output you want it to send.

To A Debug Screen ?

To A Serial Text (F8) message screen

or

F9 Data Logger screen  etc

 

I can send you the code for each as well to hack about with.

~ Andrew



leea1561

Posted: 26 October 2017 12:28 PM
 

Member Since:
27 July 2017
Posts: 5
Points: 8


This post was awarded 1 point!

Hi Andrew,

I have recieved your circuit and it downloads okay. Could you please send me the sample code as per your previous email below.

Thanks,

Amanda

 

>>Hi

I will send you this set up in a few days.

Good if you can tell me the kind of output you want it to send.

To A Debug Screen ?

To A Serial Text (F8) message screen

or

F9 Data Logger screen  etc

 

I can send you the code for each as well to hack about with.

~ Andrew

 

 



Andrew H

Posted: 28 October 2017 10:21 AM
 

Member Since:
15 June 2011
Posts: 3604
Points: 463


This post was awarded 1 point!

Here are some code blobs:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

WPU:
pokesfr %10001100, %000000110        'WPU on

Setup_I2C:
hi2csetup i2cmaster, %10000000, i2cfast, i2cbyte


'CMD_SOFT_RESET= 0xfe
 hi2cout %10000000,($FE)
 pause 500 'Wait a bit after reset

'CMD_READ_USER_REG = 0xe7
 hi2cin 0xE7,(b0)
 serout 0,N2400,(#bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0,13,10)
 pause 100

'CMD_WRITE_USER_REG = 0xe6
 hi2cout 0xE6,(%10000001)
 pause 100

'CMD_READ_USER_REG = 0xe7 to see if any changes were stored / took place
 hi2cin 0xE7,(b0)
  serout 0,N2400,(#bit7,#bit6,#bit5,#bit4,#bit3,#bit2,#bit1,#bit0,13,10)
 pause 100

do 'Main loop starts here

Temperature:
 hi2cin 0xE3,(b1,b0)             'MSB,LSB 'CMD_READ_TEMP_HOLD = 0xe3
 w1 = w0 / 256
 w2 = w1 * 176
 w3 = w2 / 256
 w12 = w3 - 47 * 10
 
Humidity:
 hi2cin 0xE5,(b1,b0)             'MSB,LSB 'CMD_READ_HUM_HOLD = 0xe5
 'w0 = 31872                'Test value for 54.8 % Rh.
 w1 = w0 / 256
 w2 = w1 * 125
 w3 = w2 / 256
 w11 = w3 - 6 * 10

Bat_Voltage:                'This is a method to infer battery voltage
 calibadc w10                'Read a 1.024 volts fixed absolute internal refference voltage.
 w10 = 25500 / w10             'Rough calc b3 to 10'ths of a volt
 
Tx_Data:

Tx_Temperature:
 serout 0,N2400,(13,10,#w11)
 nap 5

Tx_Rh:
 serout 0,N2400,(13,10,#w12)
 nap 5

Tx_Bat_Voltage:                'This is a method to infer battery voltage
 serout 0,N2400,(13,10,#w10)
 nap 5

loop

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Prob best you e-mail me direct picaxe@gmail.com if you want ALL the code samples and more importantly the data sheets so you can use it with a dwino or a pi etc...

~ Andrew

 

 



You need to be a member to post.