Thursday, July 30, 2015

Qml item state undefined

I'm working on a info screen application done in Qml that will be run on a Raspberry Pi. I'm doing the main coding on the desktop and everything runs well.

On the Pi I'm using a self build of Qt 5.4.2 and it worked very well, until yesterday that is. Suddenly I got no display of my info slides. Strange thing, it worked perfeclt fine before.

After a good bit of cursing I found that my Image didn't show, because for some odd reason the binding of

visible: root.state=='rotating'

was evaluated as false. Well, how the hell is that possible was the next question. And debug output of the state randomly said "undefined", eh ?? WTF!?

What I don't understand is how it suddenly crept up as I've used states before too in my app. Anyway, it turns out that it is a known bug (QTBUG-41649) in gcc-4.6 on arm that miss compiles a specific file in the Qml library.

 Fix applied and all seems well. I hope.

Thursday, July 02, 2015

More progress with wireless sauna temperature thingy

My original plan was to use a MSP430 based launchpad (cheap!) instead of an Arduino for the sensor part. I had major troubles getting any data to go trough so decided to first try with identical platforms and libraries. That worked so at least I knew that my NRF modules where ok.

I started to look into using the MSP430 based launchpad now, first I had some weird trouble that a simple test worked, then suddenly it didn't and sometimes just a part of the data got trough to the receiver. Digging into the enrf24 and RF24 libraries a bit more I found the reason (enrf24 uses dynamic payload (only!) by default, RF24 doesn't) and connecting my MAX6675 thermocouple amp also made the sending not work if I used a particular pin (I think it was 2.3?) on the launchpad, moving that to 1.4 fixed that issue.

Now it works!

I'm now powering the sensor with a USB power bank and that just wastes energy so next is to make everything as power efficient as I can and power it using a 3V coin-cell.

That should be possible as I can sleep most of the time as the temperature does not change that fast and often anyway.

Perhaps something like:
  • Average temperature, say for 3 samples, does not change much: Sleep 30 seconds
  • If temperature starts to change, sleep less, say 10 seconds
  • If temperature changes rapidly, sleep 5 seconds
  • Send temperature only when temperature changes
Comments ?

Thursday, June 25, 2015

How to get Cadense and speed information using gattool

Last post was a quick "Yay it worked" post. This explains the procedure in more detail.

First use hcitool to scan for your device (activate it in some way so that it powers on first)

Now you know the address, start gattool and connect

$ gatttool -b 00:18:31:E4:D7:89 -I
[   ][00:18:31:E4:D7:89][LE]> connect

Ask for the primary services:

[CON][00:18:31:E4:D7:89][LE]> primary
attr handle: 0x0001, end grp handle: 0x000b uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x000c, end grp handle: 0x000f uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0010, end grp handle: 0x001a uuid: 00001816-0000-1000-8000-00805f9b34fb
attr handle: 0x001b, end grp handle: 0x0029 uuid: 0000180a-0000-1000-8000-00805f9b34fb
attr handle: 0x002a, end grp handle: 0xffff uuid: 0000180f-0000-1000-8000-00805f9b34fb

Ask for the characteristics of the handler for the CSCP service (uuid 1816)

[CON][00:18:31:E4:D7:89][LE]> characteristics 0x0010 0x001a
handle: 0x0011, char properties: 0x10, char value handle: 0x0012, uuid: 00002a5b-0000-1000-8000-00805f9b34fb
handle: 0x0014, char properties: 0x02, char value handle: 0x0015, uuid: 00002a5c-0000-1000-8000-00805f9b34fb
handle: 0x0016, char properties: 0x02, char value handle: 0x0017, uuid: 00002a5d-0000-1000-8000-00805f9b34fb
handle: 0x0018, char properties: 0x08, char value handle: 0x0019, uuid: 00002a55-0000-1000-8000-00805f9b34fb

Ask for the character descriptor for the cadence information (uuid 2a5b)

[CON][00:18:31:E4:D7:89][LE]> char-desc 0x0011 0x0013
handle: 0x0011, uuid: 2803
handle: 0x0012, uuid: 2a5b
handle: 0x0013, uuid: 2902

Enable notification by writing 0100 to handle 0x0013.

[CON][00:18:31:E4:D7:89][LE]> char-write-req 0x0013 0100
[CON][00:18:31:E4:D7:89][LE]> Characteristic value was written successfully

You should now start to get notifications from the device
Notification handle = 0x0012 value: 03 ce 00 00 00 82 20 ea 00 be d8 
Notification handle = 0x0012 value: 03 cf 00 00 00 aa dd ea 00 be d8 

See the previous post for an explanation of the data.

Playing with CSCP Cycling Speed and Cadence using gattool

Inspired by a BB demo app I got myself a PanoBike CSCP BLE dongle a while back. Never had the time to do more than test it with the BB demo application and then I more or less forgot about it (and had no proper bike to use it on).

Today, inspiration hit me and I started to look at it a bit, for now first with gattool only.

Took a while to figure it out, BLE is a bit of a mystery with UUIDs and handles and so on.


Notification handle = 0x0012 value: 03 c8 00 00 00 06 99 e1 00 45 99

Byte 1: What data is available, crank=1 and wheel=2
Bytes: 2,3,4,5: Wheel revolutions
Bytes: 6,7: Wheel event timestamp

Bytes: 8,9: Crank revolutions
Bytes: 10,11: Crank event timestamp

Wednesday, June 24, 2015

Arduino based wireless sauna temperature sensor and display

I've been working on this on-and-off (more off than on..) for a couple of years now. The plan is to create a summercottage "automation" system, simply just a bunch of variouse sensors sending information to a base station with a display and perhaps some logging.

I first started with a MSP430 as the sensor board and a Raspberry Pi as the base station, but I never to get NRF24L01 TX/RX to work and forgot all about if again for a while.

Started thinking about it some weeks ago again and decided to try using the exact same NRF24L01 library and exactly the same platform and if that didn't work then either or both of my NRF24L01 boards must be broken.

After fiddling with the various settings I finally got them to talk, everything needs to match exactly or nothing will work.

At midsummer I got to try it out with a proper temperature sensor attached (and inside the sauna) the result can be seen in the video below:

Wednesday, June 17, 2015

Tuesday, June 16, 2015

Y-Radio BB10 version review issues

Don't know what the tester is doing but I've got it back now twice with a nice one-liner saying basically "No sound". Work for me so I wonder if the tester is doing something stupid like not having network connection ?

Anyway, submitted one now that complains loudly (in RED) if device is off-line, lets see if that helps.

YLE Radio application for BlackBerry 10