This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anyone datalogging?
#1
Anyone else recording data? For a while now I've been saving various bits to sqlite. Seems to be one of the easiest plus the database is just one file so you can copy it across to another machine to play with. Pus there's a PHP webpage available which makes it easy to  go in and set up or just  have a look 
Little bit of node red if anyone is inerested -
Code:
[
   {
       "id": "ab86fbfb.82f1c8",
       "type": "switch",
       "z": "f1a0cb4.fe86138",
       "name": "Is it eng data?",
       "property": "msg.payload.updates.values.path",
       "propertyType": "jsonata",
       "rules": [
           {
               "t": "cont",
               "v": "propulsion",
               "vt": "str"
           }
       ],
       "checkall": "false",
       "outputs": 1,
       "x": 180,
       "y": 240,
       "wires": [
           [
               "aaed95ff.c274e8"
           ]
       ]
   },
   {
       "id": "aaed95ff.c274e8",
       "type": "change",
       "z": "f1a0cb4.fe86138",
       "name": "create msg.eng etc",
       "rules": [
           {
               "t": "set",
               "p": "eng",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"propulsion.engine.temperature\"].$number(value)-273.15",
               "tot": "jsonata"
           },
           {
               "t": "set",
               "p": "alt",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"propulsion.alt.temperature\"].$number(value)-273.15",
               "tot": "jsonata"
           },
           {
               "t": "set",
               "p": "exh",
               "pt": "msg",
               "to": "msg.payload.updates.values[path=\"propulsion.exh.temperature\"].$number(value)-273.15",
               "tot": "jsonata"
           }
       ],
       "action": "",
       "property": "",
       "from": "",
       "to": "",
       "reg": false,
       "x": 190,
       "y": 280,
       "wires": [
           [
               "7a2b1aa3.f272f4"
           ]
       ]
   },
   {
       "id": "7a2b1aa3.f272f4",
       "type": "function",
       "z": "f1a0cb4.fe86138",
       "name": "create INSERT topic eng",
       "func": "// set flow variables to signalk data\nif (msg.eng !==undefined) {var eng = flow.set(\"eng\", msg.eng.toFixed(1));\n    //msg.topic= \"INSERT INTO engine  (eng) VALUES (\" + flow.get(\"eng\") + \" );\" ;\n}\nif (msg.alt !==undefined) {var alt = flow.set(\"alt\", msg.alt.toFixed(1));\n    //msg.topic= \"INSERT INTO engine  (alt) VALUES (\" + flow.get(\"alt\") + \" );\" ;\n}\nif (msg.exh !==undefined) {var exh = flow.set(\"exh\", msg.exh.toFixed(1));\n    //msg.topic= \"INSERT INTO engine  (exh) VALUES (\" + flow.get(\"exh\") + \" );\" ;\n}\n\n// create sqlite insert commend\nmsg.topic= \"INSERT INTO engine  (eng, alt, exh) VALUES (\" + flow.get(\"eng\") + \",\" + flow.get(\"alt\") + \",\" +  flow.get(\"exh\") + \" );\" ;\n//msg.topic= \"INSERT INTO engine  (eng) VALUES (\" + flow.get(\"eng\") + \" );\" ;\nreturn msg;\n   ",
       "outputs": "1",
       "noerr": 0,
       "x": 430,
       "y": 260,
       "wires": [
           [
               "c8b0c6b1.e1b078",
               "dc2bd84f.dcb9a8"
           ]
       ]
   },
   {
       "id": "c8b0c6b1.e1b078",
       "type": "delay",
       "z": "f1a0cb4.fe86138",
       "name": "",
       "pauseType": "rate",
       "timeout": "5",
       "timeoutUnits": "seconds",
       "rate": "1",
       "nbRateUnits": "1",
       "rateUnits": "minute",
       "randomFirst": "1",
       "randomLast": "5",
       "randomUnits": "seconds",
       "drop": true,
       "x": 430,
       "y": 300,
       "wires": [
           [
               "8d7a3b1d.824788"
           ]
       ]
   },
   {
       "id": "8d7a3b1d.824788",
       "type": "sqlite",
       "z": "f1a0cb4.fe86138",
       "mydb": "fe279cd9.bbe82",
       "name": "",
       "x": 690,
       "y": 300,
       "wires": [
           []
       ]
   },
   {
       "id": "fe279cd9.bbe82",
       "type": "sqlitedb",
       "z": "",
       "db": "/home/pi/database/boatdata.db"
   }
]
 I tried influxdb with grafana which was really good with lots of plotting options but just too big and hogged too much resources so that had to go.
What isn't going so well with sqlite is plotting - any one know of any python or PHP that would fit the bill? My programming skills aren't that far ahead of hello world Smile  What would be fantastic would be to plot a days battery voltage over voltage from a week or month before to see if there's much difference and maybe get a bit of notice if they aren't so well. Already just seeing how quick the engine warms up and things like that has been really interesting.  Cool
Such a powerful tool, a little Pi, openplotter and node red - systems into the thousands can't do a load of things which it can. 
Ta
Reply


Messages In This Thread
Anyone datalogging? - by PaddyB - 2017-11-14, 10:03 PM
RE: Anyone datalogging? - by shark24 - 2017-11-15, 10:19 AM
RE: Anyone datalogging? - by PaddyB - 2017-11-15, 10:51 AM
RE: Anyone datalogging? - by shark24 - 2017-11-15, 11:45 AM
RE: Anyone datalogging? - by PaddyB - 2017-11-15, 02:27 PM
RE: Anyone datalogging? - by tocan - 2017-11-15, 03:13 PM
RE: Anyone datalogging? - by PaddyB - 2017-11-15, 03:45 PM
RE: Anyone datalogging? - by tocan - 2017-11-15, 05:20 PM
RE: Anyone datalogging? - by tocan - 2017-11-15, 03:51 PM
RE: Anyone datalogging? - by shark24 - 2017-11-15, 04:49 PM
RE: Anyone datalogging? - by tocan - 2017-11-15, 09:06 PM
RE: Anyone datalogging? - by shark24 - 2017-11-16, 11:10 AM
RE: Anyone datalogging? - by PaddyB - 2017-11-16, 10:46 AM
RE: Anyone datalogging? - by tocan - 2017-11-16, 09:01 PM
RE: Anyone datalogging? - by shark24 - 2017-11-17, 01:23 PM
RE: Anyone datalogging? - by PaddyB - 2017-11-17, 02:09 PM
RE: Anyone datalogging? - by tocan - 2017-11-17, 09:09 AM
RE: Anyone datalogging? - by tocan - 2017-11-17, 02:35 PM
RE: Anyone datalogging? - by PaddyB - 2017-11-17, 03:09 PM
RE: Anyone datalogging? - by shark24 - 2017-11-19, 09:08 AM
RE: Anyone datalogging? - by tocan - 2017-11-19, 04:44 PM
RE: Anyone datalogging? - by shark24 - 2017-11-19, 06:14 PM
RE: Anyone datalogging? - by tocan - 2017-11-19, 07:16 PM
RE: Anyone datalogging? - by shark24 - 2017-11-19, 08:21 PM
RE: Anyone datalogging? - by tocan - 2017-11-19, 11:23 PM
RE: Anyone datalogging? - by PaddyB - 2017-11-22, 11:54 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)