Jump to content

Log in or register to remove this advert

New rules on moisture content come into effect today


Woodworks
 Share

Recommended Posts

7 hours ago, openspaceman said:

The problem is I do not code, not since fortran4 and a little O for a Psion.

 

I adapted someone else’s code a long time ago and cannot remember what or how I did it.

 

See below:

 

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import serial, time, struct, array
from datetime import datetime

ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # Set this to your serial port
ser.baudrate = 9600

ser.open()
ser.flushInput()

byte, lastbyte = "\x00", "\x00"
cnt = 0
while True:
    lastbyte = byte
    byte = ser.read(size=1)
#    print("Got byte %x" %ord(byte))
    # We got a valid packet header
    if lastbyte == "\xAA" and byte == "\xC0":
        sentence = ser.read(size=8) # Read 8 more bytes
#        print "Sentence size {}".format(len(sentence))
        readings = struct.unpack('<hhxxcc',sentence) # Decode the packet - big endian, 2 shorts for pm2.5 and pm10, 2 reserved bytes, checksum, message tail
#        print array.array('B',sentence)
        pm_25 = readings[0]/10.0
        pm_10 = readings[1]/10.0
        # ignoring the checksum and message tail
        
        if (cnt == 0 😞
            line = "PM 2.5: {} μg/m^3  PM 10: {} μg/m^3".format(pm_25, pm_10)
            print(datetime.now().strftime("%d %b %Y %H:%M:%S.%f: ")+line)
        cnt += 1
        if (cnt == 5):
            cnt = 0
 

It doesn't even rhyme FFS  🙂

Edited by Stubby
  • Like 1
  • Haha 3
Link to comment
Share on other sites

Log in or register to remove this advert

On 06/05/2021 at 11:44, Stubby said:

OK that is also fair comment . I suppose it depends on the background and life style of said oldie . My Dad died at 96 and I am 67 and I know whats what to do with whats its 😁

You were 68 in January, stop trying to hide your real age!

Link to comment
Share on other sites

13 hours ago, openspaceman said:

Have a go with this:

 

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import serial, time, struct, array
from datetime import datetime

 

# added so we can easily join file path later
import os

 

ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # Set this to your serial port
ser.baudrate = 9600

ser.open()
ser.flushInput()

byte, lastbyte = "\x00", "\x00"
cnt = 0
while True:
    lastbyte = byte
    byte = ser.read(size=1)
#    print("Got byte %x" %ord(byte))
    # We got a valid packet header
    if lastbyte == "\xAA" and byte == "\xC0":
        sentence = ser.read(size=8) # Read 8 more bytes
#        print "Sentence size {}".format(len(sentence))
        readings = struct.unpack('<hhxxcc',sentence) # Decode the packet - big endian, 2 shorts for pm2.5 and pm10, 2 reserved bytes, checksum, message tail
#        print array.array('B',sentence)
        pm_25 = readings[0]/10.0
        pm_10 = readings[1]/10.0
        # ignoring the checksum and message tail
        
        if (cnt == 0):
            line = datetime.now().strftime("%d %b %Y %H:%M:%S.%f: ")
            line += ",PM 2.5: {} μg/m^3 , PM 10: {} μg/m^3".format(pm_25, pm_10)
            print(line)

 

            # location, not too familiar with the Pi so this is google aided
            file_path = "/home/pi"
            # file name built with year, month, day is a common option for log files
            # it can be per hour, week or whatever by changing the format code, see
            # https://strftime.org/
            file_name = time.strftime("PM %Y-%m-%d.csv")
            # open the file, add to the end and close it again
            with open(os.path.join(file_path, file_name), 'at') as f:
                f.write(line + "\n")


        cnt += 1
        if (cnt == 5):
            cnt = 0

 

Link to comment
Share on other sites

On 07/05/2021 at 22:59, openspaceman said:

The problem is I do not code, not since fortran4 and a little O for a Psion.

 

I adapted someone else’s code a long time ago and cannot remember what or how I did it.

 

See below:

 

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import serial, time, struct, array
from datetime import datetime

ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # Set this to your serial port
ser.baudrate = 9600

ser.open()
ser.flushInput()

byte, lastbyte = "\x00", "\x00"
cnt = 0
while True:
    lastbyte = byte
    byte = ser.read(size=1)
#    print("Got byte %x" %ord(byte))
    # We got a valid packet header
    if lastbyte == "\xAA" and byte == "\xC0":
        sentence = ser.read(size=8) # Read 8 more bytes
#        print "Sentence size {}".format(len(sentence))
        readings = struct.unpack('<hhxxcc',sentence) # Decode the packet - big endian, 2 shorts for pm2.5 and pm10, 2 reserved bytes, checksum, message tail
#        print array.array('B',sentence)
        pm_25 = readings[0]/10.0
        pm_10 = readings[1]/10.0
        # ignoring the checksum and message tail
        
        if (cnt == 0 😞
            line = "PM 2.5: {} μg/m^3  PM 10: {} μg/m^3".format(pm_25, pm_10)
            print(datetime.now().strftime("%d %b %Y %H:%M:%S.%f: ")+line)
        cnt += 1
        if (cnt == 5):
            cnt = 0
 

I didn't use the pi directory just logged it to home, it didn't like the string μg/m^3  in line 43 but worked when those were deleted.

 

Thanks, perhaps we can chat about it some time?

Link to comment
Share on other sites

On 08/05/2021 at 23:12, openspaceman said:

I didn't use the pi directory just logged it to home, it didn't like the string μg/m^3  in line 43 but worked when those were deleted.

 

Thanks to @Dan Maynard I was able to save a logfile and produce a chart for about 11 hours today, some 8000 records.

Below is the result from outside the front window of this room 1.2m from the ground, 6m from a holly hedge and a further 6m to a minor through road. The results are for pm2.5 in microgram per m3 of air.

 

I did not operate any machines (deference to Sunday) but did light the stove at 20:15 just to see the result as it was fairly warm this evening.

 

From the timing of the other spikes I suspect local barbecues but I was out most of the afternoon.

 

particulates.thumb.png.06518d4d5ed9d6ffdfc8fcfbd2b1481c.png

Link to comment
Share on other sites

Dear woodsure clipboard man. I do not contrary to reports sell wood fuel or need to pay the £600 to register with the scheme. I am a performance artist. My activity in my wood is a contemplative expression of existentialism, embodied in wood as a medium. Each lovingly crafted 'log' is in fact formed by a creative process of ritual zen axe manipulation, the forged Swedish steel edge acting as a counterpoint to the yielding fruits of mother nature. I am sponsored in my art by local people who live in cold houses. I urge them to think deeply on each log about nature's transient cycles, the meaning of life, and the latent solar energy trapped in the fabric of the wood from the fusion of the sun, hurtling across the boundless void of the universe. I'm extremely upset if after buying my art the thrill wears off and they decide to combust it releasing the energy contained within, although destruction is in itself another transformative creative process that nurtures new artworks such as 'Ashpile number III'.  I'm hoping to enter my work 'Dumpy bags worth for fifty quid' in The Turner Prize next year. Yours, The Artist.

  • Like 5
Link to comment
Share on other sites

On 06/05/2021 at 13:01, Doug Tait said:

In my experience it's the other way round. The older people I know are completely aware of what seasoned wood is, and many could ID it from looking at a log.

 

The younger people are less knowledgeable. One of my neighbours (40's) asked me if I knew what was wrong with their log burner as it wouldn't light, I said it was probably the softwood logs that weren't seasoned (I felled and rung up the tree for them 6wks earlier). The response was "but it's firewood in a wood burner! We'll need to get someone to look at the stove".

 

And a friend in his 30's bought a house, I did some tree work in the garden and he was left a decent pile of rounds, with instructions how to split and stack for seasoning from me and his elderly neighbour. The pile got swamped in grass and nettles til you couldn't see it and a few months later he asked if it was ready to burn. His elderly neighbour and I raised an eyebrow.

There are all different kinds of people at any age!

A friend and I cut up some dry firewood for an old man in his village.  He wanted a certain length and thickness for his stove so it took a bit longer to produce.   The old fella took out a garden hose and started sprinkling the wood with water, said it made it last longer............... 

  • Like 1
Link to comment
Share on other sites

59 minutes ago, Billhook said:

There are all different kinds of people at any age!

A friend and I cut up some dry firewood for an old man in his village.  He wanted a certain length and thickness for his stove so it took a bit longer to produce.   The old fella took out a garden hose and started sprinkling the wood with water, said it made it last longer............... 

Maybe he'd seen the documentary about the Mary Rose, that wood lasted well in water!

  • Haha 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


  •  

  • Featured Adverts

About

Arbtalk.co.uk is a hub for the arboriculture industry in the UK.  
If you're just starting out and you need business, equipment, tech or training support you're in the right place.  If you've done it, made it, got a van load of oily t-shirts and have decided to give something back by sharing your knowledge or wisdom,  then you're welcome too.
If you would like to contribute to making this industry more effective and safe then welcome.
Just like a living tree, it'll always be a work in progress.
Please have a look around, sign up, share and contribute the best you have.

See you inside.

The Arbtalk Team

Follow us

Articles

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.