• In response to UKIP gloating on facebook..

    2015_04_22_21_26_35_March_Cambridgeshire_Free_Discussion

    So, this popped up via my town’s facebook group. I couldn’t resist responding. If you’re curious, here’s the wikipedia page on the Indian mars probe.

    My response to this, and the assorted “Yeah!”, “We should give them nothing” etc, I responded as follows;

    Do you understand what an amazing achievement that was? The normal cost of any western probe to Mars? Hell, I’d gladly pay more tax I can’t afford to for that stunning gem.
    It was, and still is absolutely incredible they did it for so little, and with
    so little. It’s giving them a reason to strive, to push for something different, for knowledge and understanding and plain old new technology. You know, just that thing humanity must get more of quickly, or watch our world burn from a fire of our own making. We fail, we get to watch our grandchildren or our great grandchildren die. All of them.

    I probably shouldn’t have, and hyperbole just a bit on the All Die prediction, but eh, we do nothing about oil running out & climate change, we’re probably all screwed. We’re still probably all screwed anyway, but..

    I wonder if this has anything to do with the slow-motion civilization collapse depicted in my current read, Ready Player One?

     



  • After Death (mind-dump thoughts on digital death)

    So, here’s something that’s been coming to mind of late, especially with the recent death of Leonard Nimoy.

    Our digital lives varnish after our death. Oh, don’t get me wrong, they’ll last a little longer than our deaths — the server this blog is hosted on for example will stay running. However, it won’t get maintained, that’s what I do, so over time it’ll get hacked, or will break. My brother might take over maintaining it for a while, but in the end, the words and thoughts stored here (some hidden from public view) will vanish.

    Archive.org is great, it’ll keep a copy of these words for posterity.. but who’ll ever read them?

    I’m not sure if I’m morbid at the moment, or it’s just depression talking, but this all feels so.. transient. These words won’t have the lasting power of those stored on a book, in the end they’re stored on media that’ll die a lot faster than a book degrades, stored correctly. Not to mention, they’re stored in a particularly complex format, that isn’t human readable in any way without the right filter and conversions.

    I guess, this is really just underlining the importance of Archive.org and their ilk. Not that I suppose anyone’ll care about what’s stored here.. much as the most read post here is my brother’s posts on linux beep music ;)
    http://kirrus.co.uk/2010/09/linux-beep-music/



  • Low Carb Hot Chocolate

    One of my bosses sent me this, his favourite easy recipe for a nice hot chocolate style drink. Saving it here so I remember to do it..

    Half a tin of coconut milk in a saucepan.
    Simmer.
    Stir in as much cocoa as you want, and chunks of chocolate too, if you like it thick.
    Add some xylitol to sweeten.
    Pour into a mug.
    Thick, astonishingly satisfying and good for you.

    (Obviously, only pour into a mug once all the cocoa has mixed and chocolate melted – I use a whisk, and add a capful of vanilla essence too).



  • R.A.O.K

    An explanation more beautiful than my words could ever be:
    Giving Is The Best Communication – Thai Mobile Ad…: http://youtu.be/JPOVwKPMG8o

    The World full of horrible injustices, life is cruel and unfair. Survival of the fittest is now survival of the richest.

    And the worst thing?
    It feels like you’re just too powerless, poor or insignificant against the size if it.

    Starvation, Cancer, HIV, Natural disasters whatever.

    Well the truth is there is something you can do to change the world.

    And its cheap, and simple and should make someone smile.

    Its called A Random Act Of Kindness or RAOK.

    Just do one small thing to improve the life of a stranger.
    See that a Girl sobbing? Go give her a tissue.
    Give your elderly neighbour a Christmas card or invite him round for a cup of tea.
    Hold the door open for someone.
    Carry a lighter just in case someone asks for a light.
    Give out free hugs (I did this once. It was hugely fun. I made sure I got all the people with the saddest expressions ;) ).

    Have a think. Be good to people, even if you don’t know them.

    Simple
    Leave a note that says ‘pass it on’

    Now you may never know the difference that a small random act of kindness makes to that stranger. But this is not about fame or fortune, its about changing the world one small random act of kindness at a time.

    My hot tip? Why just one RAOK?

    Share the love.

    And Dear stranger,
    If you find this, pass it on, and have a brilliant week!
    Sincerely,
    Anon
    (I know my name is on here, but who I am doesn’t matter. Thank me by doing a RAOK and asking them to pass it on ;) )



  • WordPress Cookies

    Here’s a list of cookies wordpress sets when you login. Because I can’t find this list anywhere on the net and I need it.

    wordpress_[HASH] — admin panel auth cookie
    wp-settings-3 — settings cookiewp-settings-time-3 — settings cookie
    wordpress_test_cookie — cookie used to test that wp can set cookies. Honestly guys, really?
    wordpress_logged_in — another auth cookie

     



  • Garreth Tinsley CV

    Garreth Tinsley Curriculum Vitae 2014
    Garreth Tinsley Curriculum Vitae 2014

    Garreth Tinsley’s Curriculum Vitae

    2014

     

    Just a quick and cheeky post to hopefully get myself listed on google ;-). (SEO baby!)

    If you’re looking for my CV, here it is

    CV_GTinsley-8_engineering [PDF]

    http://bit.ly/GarrethTinsleyCV [Microsoft Word On-line Viewer]

    bit.ly/GarrethTinsley [CV and Acheivements bundle, Word Online Viewer]

    It goes a little something like this (first page only):

     

    Now, I’m sick of the sight of my own name, so Hi JT, thanks for hosting this ridiculously self-promoting post on your blog!



  • Microsoft Outlook Add-ins

    Just a super-quick post here.

    If you’re looking for addons or plugins for Microsoft Outlook to help you organize your emails and extend the functionality of Outlook

    (note Outlook is very extensible, as with all Microsoft Office applications you can write Visual Basic code for Applications to hook into it’s functions. Absaloutely fantastic for hacking excel as I have been doing for the last few weeks – my work needs to invest in a proper database program for sure *sigh*)

    You’d do no better than looking here

    Snapfiles Outlook Add-ons

    http://www.snapfiles.com/freeware/comm/fwoutlook.html

     

    They have addons that are useful – and unlike most of the sites on i’ve found so far – up to date and compatible with recent versions (2003+) of Outlook.

    Hope this helps folks!

     



  • Rfduino Chip vs Thermometer

    Well, I’ve now debugged a few issues with my scripts from my last post.
    (made them a bit more fault tolerant and actually take notice of $? exit statuses) .
    Recap: Temperhum (USB) -> Raspberry Pi -> Xively chart, now also
    RFDuino (bluetooth wireless) -> Raspberry Pi -> Xively chart

    Tip:  If you’re struggling with the bluetooth on linux giving rx timeout errors (check the syslog if it’s not in the console),
    update the software with the following commands:

    sudo apt-get update
    sudo apt-get upgrade

    The Rfduino has been sitting next to my usb Temperature and Humidity sensor for a few weeks collecting data.

    IMG_20140514_223244041r
    RFDuino and Temperhum

    Since it had been both collecting data for a few weeks and sending them to Xively / Pachube / Cosm, I had a quick look to see how closely the readings match.

    Rfduino vs thermometerr

    The graphs do show correlation, thank goodness, but it looks like the RFDuino’s temperature scale isn’t right. The RFDuino is only updating the graph once a minute whereas the Temperhum is 2x a minute.

    I didn’t really expect great accuracy for the RFduino thermometer seeing as it’s measuring from the chip. But this would still be useful in some more basic cases.

    I think next on the roadmap for the RFduino is connecting sensors/remote controls (it would be cool to attach my RelaySockets to this and control the 2 connected relays via bluetooth from my Pi and Android smartphone!

     

    My Humidity and Temperature sensor

    A Temperhum from PCSensor.

    A great little bit of kit – once you work out the conversion values for the C++ USB/i2c/HID code that lets linux talk to the thing!



  • Getting Rfduino working with Linux

    Intro:

    I ordered this nifty ‘RFduino’, an arduino-compatible device which was also my first ever kickstarter purchase over a year ago now.
    However, when the device arrived, the company behind it seemed exclusively interested in the iPhone handset to the detriment of all other platforms.
    Personally, the lock in monopolistic attitude of Apple and its customers really gets my goat, but I digress.

    The lack of support and that the device arrived half a year late left me with a sour first taste of Kickstarter.

    Since then, I’ve played with the Rfduino using JT’s iGear (no, I don’t know why fell into the Apple pit either) using the only app available to use the sketch it comes with – the internal thermometer

    But that’s rather limiting!! I bought this device with plans to build a Wireless ‘Internet of Things’ sensor network for my house.

    I have designs on talking to every platform available using protocols such as mqtt, backends like rrdtool and web interfaces for my housemates to see and control the action.

    This is something I’ve been dreaming and sketching out  for years, because lets face it, who doesn’t think having the lights turn out when you leave is super cool?

    So without further ado, how do we get the RFduino to talk to a linux machine, in my case a Raspberry Pi running Raspbian.

    Ingredients:

    Hardware:

    You will need

    • Internet connection to download tools
    • Bluetooth packages installed (bluez-tools)

    Howto:

    Power on the  RFduino and linux machine. I used two Alkaline AA batteries to power the RFduino although Rechargeables do work.

    Install the Bluetooth 4 usb adaptor on the linux machine
    Install the necessary bluetooth programs:

    sudo apt-get install bluetooth bluez bluez-utils bluez-firmware

    (you may need to reboot the machine afterwards, I don’t believe I did)

    Bring up the bluetooth interface:

    sudo hciconfig hci0 up

    Run a Low Energy scan to find the address of your RFduino:

    sudo hcitool lescan

    Should elicit results similar to this:
    EA:BA:20:48:37:80 (unknown)
    88:D8:CD:08:12:FA (unknown)
    99:D8:CD:10:66:FA (unknown)
    DD:AF:13:17:23:80 RFduino

    Select and copy the MAC address given for the RFduino on your system.

    (I have no idea why you have to scan as root, someone please leave a comment if you do, and if theres a way to run as a normal user…groups?)

     

    Read the temperature attribute from the RFduino using gatttool. Paste your devices MAC address in instead of mine of course.

    sudo gatttool –device=DD:AF:13:17:23:80 –interactive
    [   ][DD:AF:13:17:23:80][LE]>
    [   ][DD:AF:13:17:23:80][LE]> connect
    [CON][DD:AF:13:17:23:80]][LE]>char-read-uuid 2221
    [CON][DD:AF:13:17:23:80][LE]>
    handle: 0x000e value: 00 00 a8 41 00 00 00 00 00 00 00 00
    [CON][DD:AF:13:17:23:80][LE]>disconnect
    [   ][DD:AF:13:17:23:80][LE]>quit

    Now from that exchange with the RFduino, we have gained a long hexadecimal string.
    From a post on the RFduino forum, I learned that the value we want is always after the ’00 00′ string (in bold above).
    This is the temperature read from the RFduino’s internal sensor * 8.
    So we need to convert this to Decimal and divide by eight to retrieve the temperature value in celsius (American readers, why aren’t you on SI units yet? :P).

    Convert the hex value to decimal temperature

    decimal=$((0xa8))
    decimal=$(($decimal/8))
    echo $decimal
    21

    The above method returns an integer value. This is because Bash has limitations working with numbers that are not whole (decimals).
    Workarounds use the command bc to interpret string inputs as decimal numbers. I think there is a method to define variable types in bash, but I didn’t get very far with this.

    My attitude is that once you start hitting the limitations of a shell scripting language, it’s time to migrate to a proper programming/interpreted language (at least python).
    Spending hours and using multitudes of additional programs make it work is often pointless.

    Just think, if you had to run the script on a embedded system without most of those commands, wouldn’t it just be better to do it in C++?

     

    Next time:

    Now that I’ve successfully read the values being sent by the RFDuino I need to figure out how to automate the process – in non-interactive mode.

    These commands do the same thing but respond differently

    sudo gatttool -b [MAC] –char-read  –handle=0x000e
    Characteristic value/descriptor: 00 00 a8 41 00 00 00 00 00 00 00 00

    sudo gatttool -b [MAC] –char-read –uuid=2221
    handle: 0x000e   value: 00 00 a8 41 00 00 00 00 00 00 00 00

    Simple bash script to read temperature in celsius (accuracy is lost here as the decimal is converted to an integer)

    #!/bin/bash
    stringZ=$(gatttool -b [MAC] –char-read  –handle=0x000e)
    stringZ=${stringZ:39:2}
    hex=$((0x$stringZ))
    decimal=$(($hex/8))
    echo $decimal
    exit

    don’t forget:
    chmod +x [whatever you called the script]

    and run it as root:
    sudo [whatever you called the script]

    Afterword:

    I won’t pretend to understand the naming conventions of Bluetooth 4.0/LE.
    I don’t! I spent a whole day looking into it and could not find a single source that easily explained the structure, naming, and profiles. If someone has seen something good, please post in the comments!

    It’s frustratingly close, like I can see there is a neat logic to it, but I just don’t care to spend any more time trying to figure it out, when all I want to do is use it. This does make it slightly more hacky and less neat and quick of course, but that’s life!

     

    Sources:

    gattool commands to read the sensor:

    http://lilyhack.wordpress.com/2014/02/03/ble-read-write-arduino-raspberry-pi/

    howto convert hex to decimal on the command line:

    http://linuxcommando.blogspot.co.uk/2008/04/quick-hex-decimal-conversion-using-cli.html

    howto do calculations on the command line:

    http://www.tldp.org/LDP/abs/html/arithexp.html

    Hacked up way of using gatttool non-interactively, using ncurses and a python script:

    http://thomasolson.com/PROJECTS/BLE/RFduino/LINUX/

    Bash string manipulation:

    http://www.thegeekstuff.com/2010/07/bash-string-manipulation/

    Others:

    http://joost.damad.be/2013/08/experiments-with-bluetooth-low-energy.html