1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

PIC data logger

Discussion in 'Microcontrollers' started by Nigel Goodwin, Apr 10, 2016.

  1. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    Yes, all are on the same frequency - I allocate each remote unit a single letter code A, B, C or D, and send the code from the PC followed by a simple single letter instruction (in this case 'a'). So the PC sends out 'Aa' (no Cr/Lf) and waits for the reply (the reply is prefixed with A as well), then it sends out 'Ba' and so on. So it's dead simple, you can also send 'Av' and get a version ID back from the remote unit as well - while I was initially playing with them I used considerably more commands, for setting an a RTC, reading data from an on-board FRAM etc. but for this specific project none of that was needed.
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi,
    I am using the USB to Rs232 cable assembly from Amazon for connection between the HC12 and PC.
    Image A05 is a test TX/RX between the HC12 and PC, using a VBasic GUI.
    The intention is to get the Remote and Base units debugged using VBasic before conversion to Lazarus.

    E
     

    Attached Files:

    • A04.gif
      A04.gif
      File size:
      50.2 KB
      Views:
      85
    • A05.gif
      A05.gif
      File size:
      13.7 KB
      Views:
      81
  3. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Nigel,
    A little extra info on the HC12 transceivers that others may find useful.

    Using a HC12 with the supplied spiral wire antenna,
    RS232 settings: 9600 baud, N81
    The HC12 has the recommended 1N4001 diode from the +5V supply to HC12, giving 4.3v at Vin.

    Transmitting temperature and humidity from a DHT22 sensor at one second rate.

    Transmitter located indoors and the Receiver located in a garden shed.
    So the TX signal has to pass thru 3 brick walls, 10 metres of free space and the shed.

    Started with AT+Px = 8 , [20dBm], good strong signal at the RX
    Stepping down the Px value in increments from 8 to 3
    At Px=3 [5dBm] the RX, the signal would be sometimes be missed, depending upon movement of the RX PCB.

    E

    BTW: hope you don't mind me adding this to your Thread.:)
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK

    Not at all, good to know :D

    Incidentally, I've had two sensors running off batteries (6xAA), and the humidity readings massively increase as the batteries get towards the end of their life - I'm currently adding a couple of resistors to an A2D pin to monitor the battery voltages as well.
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    Have you considered a step up psu like this,? 5 off for £1.0 [Amazon]
    Runs off 3 * AA battery NiCd or Recharge.

    E
     

    Attached Files:

    • A03.gif
      A03.gif
      File size:
      45.3 KB
      Views:
      86
  7. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    Actually I even have some of them :D

    But I'm just testing things at the moment, I'm not particularly planning running them off batteries.
     
  8. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,568
    Likes:
    128
    Location:
    Caribbean
    How about, feeding an ESP8266-12E Dev board via it's ADC and making it a wifi hotspot?
     
  9. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    You mean apart from you don't use an ADC to read the temp/humidity sensor :D

    You can read the sensor directly from an ESP (there's a Lua library for it), and I've done just that as well.
     
  10. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE
    hi Nigel,
    The HC12's are working fine, image posted showing the results using VB5.
    The image shows the data from the Remote displayed on a PC,, Temp,RH%, 2 ADC,s a PIR bit and LDR bit, together with 4 PORT bits.
    The data is time tagged and can be logged by the VB5 program.
    As you may recall I had NRF radio's for this set up, but I could not get the required radio range.
    The final stage is to modify my receiver for SD card onboard logging.
    I am using 18F4520's as the SD card program needs at least 1K free RAM.

    For info only, the HC12 will work OK with the 5 wires extended to 1.5mtrs, as do the USB/RS232 modules.

    Eric
     

    Attached Files:

  11. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,568
    Likes:
    128
    Location:
    Caribbean
    So, that sensor runs on the i2c?

    What abt i2c comms (or RS232) between a PIC and the ESP826612e..so that I can get bidirectional comms to the PIC via the internet and an android app?

    Doable?
     
  12. fourtytwo

    fourtytwo Member

    Joined:
    Jul 8, 2016
    Messages:
    28
    Likes:
    1
    Location:
    Boudica's county, UK
    I also have a DHT22 but I don't have much faith in it's humidity readings, it's used to control a dehumidifier who's internal sensor appears to be useless. The DHT22 however gives readings that depart by up to 20% from a simple commercial battery powered temperature/humidity LCD display the difference being greatest in the mornings, of course with only two devices I don't really know which is wrong except the DHT22 takes a long time to settle down after power up and also if you blow on it etc. Anybody else compared these with a reference device of some kind ?
     
  13. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    No, it uses it's own system - nothing like I2C.

    Depends what you mean by 'comms'?, as far as I'm aware you can't just make a simple serial connection from PIC to Phone, via the Internet?.

    As far as I'm aware (and what I'm playing with) what you do is upload the data to a MYSQL database using PHP, and POST or GET commands.
    Or you can run a webserver directly on the ESP, and access it via a browser on the phone.
     
  14. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    749
    Likes:
    75
    Location:
    Worcestershire UK
    My current project* uses a HIH6030 (I2C) Temperature and RH sensor , claims to be 4.5% ... I have no means of knowing !
    ( * PIC24 will water my allotment green house tomatoes and collect a days data and TX via HC-12 ).
     
    Last edited: Jul 25, 2016
  15. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,174
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    ONLINE

    Attached Files:

    • A03.gif
      A03.gif
      File size:
      34.4 KB
      Views:
      64
    • A04.gif
      A04.gif
      File size:
      30.1 KB
      Views:
      62
    Last edited: Jul 25, 2016
  16. granddad

    granddad Active Member

    Joined:
    Jan 18, 2015
    Messages:
    749
    Likes:
    75
    Location:
    Worcestershire UK
    Thanks for that Eric , the site said 50% RH the sensor on my desk said 54% , ( near enough for my use) must be my heavy breathing...
    NG Thanks for the posts on this subject.
     
  17. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,304
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    I'm playing with similar modules. My first tests are without a control PIC, so I have a switch as a PTT. I've tried sending data through one and I'm receiving it with a second radio.

    If I want it connected to a device sending data 1/sec, without a PIC, is it correct that I would need to keep the PTT in TX mode. In my mind, this doesn't seem 'good', so am I also correct that I must have a PIC switching PTT on/off to use them in this way?
    Camerart.
     
  18. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    I'm not really sure what you mean by PTT?, you just send serial data (5V RS232) to the module, and it sends it out to the other module(s).

    What kind of data are you trying to send, and why no processor?.
     
  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,304
    Likes:
    11
    Location:
    Dorset UK.
    Hi N,
    (PTT push to talk, SEND/RECEIVE)
    I was trying to make the minimum set-up for sending data, from a device. E,g, sending GPS from a moving object, back to BASE. This afternoon, I did just that, and it dawned on me that I had to have the carrier signal on at all times waiting for the Data signal (Not good) So I've answered my own question! I have to have a PIC that switches SEND on 'send data', then switch off till next data.
    Thanks, C.
     
  20. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,203
    Likes:
    640
    Location:
    Derbyshire, UK
    I know what PTT stands for, it just doesn't apply to these RS232 radio modules :D

    I'm still totally baffled, what modules are you using?, presumably something completely different to what I'm using?.
     
  21. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,304
    Likes:
    11
    Location:
    Dorset UK.
    Hi Nigel,
    Sorry, I searched for threads using similar radio modules to mine, and probably clicked on yours by mistake. The one I use is a radio module DRA818 and not a Wifi module. Anyway, I have answered my question, by tests earlier today.
    Cheers, Camerart.
     

Share This Page