Best way to exchange data between arudino and linux for IoT


hello,

i'am developing application on arduino yun, receive data several sensors , has send them via curl context broker. have explanations different ways exchange info between 2 cores of yun. ysing bridge class right have put lot of data lot of different keys. don't know if bad sure sounds bad. checking mailbox class can't understand how works. best practices, there standard or something?

i've not used mailbox class much, haven't found need it.

the bridge.put() , bridge.get() methods have serious drawbacks in mind, @ least far data communications go. slow, , there no way know value has been set, option poll keys , changes. means if same value written twice, there no way know it. method works if data pnlybthe current value important, thermostat setpoint, limiting if want every data sample go through.

my go-to method of communications between 2 sides of yun process class. works direct serial connection between two. has disadvantage it's not quite fast raw serial connection, has advantage can have several processes running, each own independent data stream, , can still use other bridge library functions if needed.

i put of processing down in linux side possible, , have sketch dumb i/o processor. sketch has global instance of process() object launches linux side script asynchronously , serves data path. data collected, written process object, using same methods you'd use serial class. on linux side, script reads stdin , parses data, needs do, , writes response data stdout. sketch can read data process object, serial class.

it's important linux side script running in unbuffered mode. example,
python runs in buffered mode output data buffered until there large amount, sent big block. if amount of output data low, seem it's doing nothing long time, sketch large amount of data @ once.

for python, can including "-u" option couple different ways:
  • put in shebang first line of script, after python executable name: "#!/usr/bin/python -u" - use method if pass name of script process object, example: "process.runasynchronously("/mnt/sda1/myscript.py);"
  • explicitly add option in runasynchronously call, example: "process.runasynchronously("/usr/bin/python -u /mnt/sda1/myscript.py);"


Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > Best way to exchange data between arudino and linux for IoT


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???