-
-
Notifications
You must be signed in to change notification settings - Fork 3
ySensorsService
Small application running on android. Target is to provide sensors from device to use it where you want it.
Sensors:
- gps
- accelerometer
- magnetometer
Supporting:
- reading gps, accelerometer, magnetometer
- sending data to mqtt
- providing simple nmea informations at :19889 tcp. Fix for bug in <5.0 opencpn if you have problem with jumping boat next to .00 of seconds in your location. On new phones I think it's 64 bit arch problem rounding in <5.0 opencpn have bug. Rounding when conversion is made from decimal location no nmea 0182 $xxRMC there is bug. If fractions of seconds in your location is starting from .0054 you will be at .54 location it's happening at latitude and longitude and jump is appearing. This App is making conversion different way and it's hosted at tcp :19889 of the device running this.
- accelerometer, magnetometer rotation correction (setting and data on mqtt for now)
- adjustable refresh speed
Videos:
https://www.youtube.com/watch?v=mAqlO0_Jui0
I'm assuming that you have finished installation 01 and 02.
next step is to install ySensorsService.apk on device. Idea is that this device will be permanently attache to (in my case boat) so I will have motion on the device the same as the boat. :) Apk file is at main repository in _apk folder get newest version install it at the device. At first start you will have permissions requests. and then main screen will show up. In Mqtt url: set it to your device ip where you have your mosquitto from installation 02
if it's the same device it can be:
tcp://127.0.0.0:10883
press save settings
close the app
turn on your location in android
in termux terminal can by by loging by ssh enter command
$ am broadcast --user 0 -n pl.yoyo.ysensorsservice/.MyBroadcastReceiver -a pl.yoyo.ysensorsservice.intent.START_SERVICE --es socket_output "abc"
it should bring location icon next to clock up. or if you have > 7.0 android it will bring up notification that service is running
to check it enter command in termux
$ mosquitto_sub -t 'and/#' -p 10883 -V mqttv311 -d
it will show messages send by ySensorsService on mqtt layer :) nice !!
CTRL-c will kill process
on different device you can chack tcp layer nmea 0182. on linux in terminal use
@pc$ nc 192.168.43.241 19889
your ip adreess can be different in install 01 you can find how to get it for yours case.
after executing we will see $YSPING,, and $YSRMC,.... lines !
nice
back to oiyshTerminal. open web brawser and go to yours node-red service for me it's http://192.168.43.241:1880
in top right corner in menu select import. past code:
[ { "id": "21d6c7297be499c4", "type": "mqtt in", "z": "c7355d1ee607eb8f", "name": "", "topic": "and/mag", "qos": "2", "datatype": "auto", "broker": "229c7e793ed13195", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 120, "y": 220, "wires": [ [ "7f40ad6242497ea5" ] ] }, { "id": "7f40ad6242497ea5", "type": "function", "z": "c7355d1ee607eb8f", "name": "", "func": "node.status({\n text: \"HDG:\"+msg.payload\n \n});", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 300, "y": 220, "wires": [ [] ] }, { "id": "229c7e793ed13195", "type": "mqtt-broker", "name": "MqttAtLocal", "broker": "localhost", "port": "10883", "clientid": "NRclient", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "sessionExpiry": "" } ]
at the bottom select new flow. press import. put nodes on canvas.
at top right press deploy. if all is good you will have:
node pinkish "and/mag" line to node "function" and under it HDG: of your device !
NICE