Archive for category Personal

Solar Powered Temperature & Humidity BLE Beacon Fun With Linux

Overview

Solar Powered temperature and humidity sensing beacon with super capacitor storage for nighttime operation.

http://www.cypress.com/documentation/development-kitsboards/cyalkit-e02-solar-powered-ble-sensor-beacon-reference-design

http://www.cypress.com/documentation/development-kitsboards/cyalkit-e03-solar-powered-ble-sensor-5-pack

Another low effort blog post with mainly notes to myself that others might find useful.

TODO: pics

TODO: screenshot of app

TODO: Crude Linux dumping commands

sudo hcitool lescan --duplicates --passive >/dev/null &
sudo hcidump --raw|grep -A2 "50 A0 00" 

> 04 3E 2A 02 01 03 00 28 20 03 50 A0 00 1E 02 01 04 1A FF 4C 
  00 02 15 00 05 00 01 00 00 10 00 80 00 00 80 5F 9B 01 31 00 
  01 6F 68 C3 B9
--
> 04 3E 2A 02 01 03 00 1A 1B 17 50 A0 00 1E 02 01 04 1A FF 4C 
  00 02 15 00 05 00 01 00 00 10 00 80 00 00 80 5F 9B 01 31 00 
  02 6C 66 C3 C5 
# Temperature Sensor
TEMP [℃] = 175.72 x (TEMP x 256) / 65536 – 46.85
Example: TEMP = 0x67 [hex] = 103[dec]
TEMP [℃] = 175.72 x (103 x 256) / 65536 – 46.85 = 23.85[℃]

# Humidity Sensor
RH[%] = 125 x (HUMIDITY x 256) / 65536 – 6
Example: HUMIDITY = 0x74 [hex] = 116[dec]
RH[%] = 125 x ( 116 x 256) / 65536 – 6 = 50.64[%]

Sometimes errors when starting lescan

sudo hciconfig hci0 reset

USB Debug Stick

The supplied debug stick for programming the beacons is partially usable with linux with no special drivers. The stick has a mode switch for BLE scanning mode and interfacing with the beacons serial interface / charging it.

$ sudo dmesg
[132354.828122] usb 1-1: New USB device found, idVendor=04b4, idProduct=f139
[132354.828133] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=128
[132354.828140] usb 1-1: Product: Cypress KitProg
[132354.828147] usb 1-1: Manufacturer: Cypress Semiconductor
[132354.828153] usb 1-1: SerialNumber: BLE1304041XXXXXXXXX
[132354.837228] hid-generic 0003:04B4:F139.000C: hiddev0,hidraw0: USB HID v1.11 Device [Cypress Semiconductor Cypress KitProg] on usb-0000:00:14.0-1/input0
[132354.838599] cdc_acm 1-1:1.2: ttyACM0: USB ACM device
# With debian or probably ubuntu
sudo apt install ckermit

cat < cyalkit.kermit
set line /dev/ttyACM0
set speed 115200
set handshake none
set flow-control none
set carrier-watch off
set local-echo on
set terminal newline-mode on
connect
quit
EOF

kermit -y cyalkit.kermit
# Press ctrl-\ and then q to quit

TODO: device config

help
Get uuid, input:uuid+Enter
Set uuid, input:uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx+Enter
Get major, input:major+Enter
Set major, input:major xxxx+Enter
Get minor, input:minor+Enter
Set minor, input:minor xxxx+Enter
Get txpwr, input:txpwr+Enter
Set txpwr, input:txpwr *+Enter
Get rssi, input:rssi+Enter
Set rssi, input:rssi *+Enter
Get itrvl, input:itrvl+Enter
Set itrvl, input:itrvl *+Enter
Get coid, input:coid+Enter
Set coid, input:coid xxxx+Enter

Get nid, input: ednid+Enter
Set nid, input: ednid x...x(20 char)+Enter
Get bid, input: edbid+Enter
Set bid, input: edbid x...x(12 char)+Enter
Get edtxpwr, input:edtxpwr+Enter
Set edtxpwr, input:edtxpwr * * * *+Enter
Get edframe, input:edframe+Enter
Set edframe, input:edframe + one or some of uid/url/tlm+Enter
Get edstate, input: edstate+Enter
Set edlock, input: edlock xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx+Enter
Set edunlock, input: edunlock xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx+Enter
Get eduri, input:eduri+Enter
Set eduri, input:eduri (url or hex string)+Enter
Get edadpwr, input:edadpwr+Enter
Set edadpwr, input:edadpwr * * * *+Enter
Get edtxmode, input:edtxmode+Enter
Set edtxmode, input:edtxmode LOWEST/LOW/MEDIUM/HIGH+Enter
Geblue 0Command format error!!er
Set editrvl, input:editrvl *+Enter
edreset, input: edreset+Enter

Get sensor, input:sensor+Enter
Set sensor, input:sensor on/off+Enter
Get mode,input: mode+Enter
Set mode,input: mode BLEBeacon/Eddystone/EDTest+Enter
Initialize, input: init+Enter
Get ver, input: ver+Enter
Exit, input: exit+Enter

Unplug USB Stick.

Attach sensor to the stick.

Push switch towards Usb port

TODO: advert dumping with usb stick

Push switch away from usb port

cat the tty

TODO: linux parsing

TODO: iBeacon format
Different advertisment flags might break simpler softer – link to beacontools
Major is beacon id
Minor is temp/humidity – Equations
Shame its not eddystone with sensor values, thought programmable firmwares from cypress community forums might help

Wireshark Bluetooth Dumping

$ sudo hcitool lescan --duplicates --passive >/dev/null &
$ xhost +local:
$ sudo wireshark
$ xhost -

TODO: Wireshare dump example
00:A0:50:XX:XX:XX mac

TODO: Crude Range analysis

Can I change tx power in a useful way?

Does itrvl setting in DM allow a different timer / battery usage ?

I added support to beacontools for this format (https://github.com/citruz/beacontools/pull/8)

sudo apt install libbluetooth-dev
sudo pip install beacontools[scan]

No Comments

Can Anyone Explain My Gas Bill Power Discrepancy

I’ve been trying to figure out how much my gas / heating / showers were costing me, but I’ve hit a fairly big discrepancy that I can’t explain.

I have a brand new 28kW/h rated boiler, with 98% efficiency rating, and according to the service manual it will consume 28.57kW/h max worth of gas, or 3.02 m^3 per hour.

I have found through measurement of having a 7 minute hot shower that the boiler was running full whack, consuming exactly at the rate claimed by the guide, 3.02 m^3, but this equates according to my bill to be 34 kW/h.

Where is the extra energy going / being wasted?

Boiler Stats Value Units
Gas Max Flow Rate 3.02 m^3/hr
Max Heat In: 28.57 kW/h
Max Heat Out: 28 kW/h
(Calculated Efficiency) 98.0049002450122 %
Meter Readings
Used 12.5 ft^3
Duration 7 min
Metric Conversion 0.35375 m^3
Flow Rate 3.03214285714286 m^3/hr
Gas Qualities / Constants
Calorific Value 39.7
Conversion Factor 1.02264
kW/h / MJ 3.6

kW/h at Max Flow = Max m^3/h (3.02) * Calorific Value (39.7) * Conversion Factor (1.02264) / kWh per MJ (3.6)

kW/h at Max Flow = 34.0578889333333

,

2 Comments

Chili Beer

image

With Chillies in! Yum.

Where: Byres Road Peckhams
Cost: £1.89
Strength: 4.2% Vol
Verdict: Better than expected, light lager with subtle and warming chili taste. Small Bonus for screw top, slightly overpriced. 7/10

The first two bottles had only one chili in, this one has two, same strength of chili flavour though it still feels like winning a little prize.

,

1 Comment

Barclaycard RFID Exploring

Waived my card over my Arduino Powered SM130 RFID reader to see what it would say..

image

Student Card: Mifare 1K(2) : 2ADEXXXX

Barclay Card: Unknown Tag(FF) : 09A1XXXX

It’s compatible with the usual RFID standards to some degree, enough to give the same serial number every time, unlike my passport which randomises its ID each activation, but not surprisingly it doesn’t read on my basic reader, probably a more advanced one would get further..

2 Comments

IPv6 Sage Certified

Yay, thanks to their new free DNS service, I have been able to complete Hurricane Electrics IPv6 certification course, and they are sending me a T-Shirt!

Highly recommend working your way through their course if this interests you.

IPv6 Certification Badge for darkskiez

,

No Comments

New RFID Barclaycard

Got a new barclaycard with RFID in the post today

I wonder if the RFID bit is MiFare compatible.. will try my reader later, not sure I’m happy about it.

The chip/pin bit seems to be compatible with my co-operative/Smile.co.uk card reader too, which surprised me but pleases me that I wont need lots of incompatible bits of junk for two-factor authentication.

,

No Comments

Hello World

Just getting started on this blog. Cant even think of a good name for it yet, nevermind a caption =]

Don’t expect this to be wordy or regularly updated, and I expect will probably be more of a tech diary than a personal blog, but we’ll see how things develop, as I would rather facebook did not own all data about my life.

No Comments