Omega <--> Arduino (Dock) Communication
At present, the only code currently available for communication between the Omega and the Arduino on the Arduino Dock is via I2C as represented by the code in https://github.com/OnionIoT/neopixel-tool on the Omega side and in https://github.com/OnionIoT/Onion-Arduino-Library on the Arduino side.
However, this code is almost exclusively oriented towards controlling the Adafruit Neopixel
It is my intention to write an Omega library and associated Arduino library that will provide the Omega with control of and access to the Arduiono pins using similar techniques to those referenced in the above libraries.
This code will use similar methods to communicate between the two using I2C and will provide functions to access the Arduiono pins similar to thos described in https://www.arduino.cc/en/Reference/HomePage. With this it will be relatively straight forward to adapt and use any Arduino code sketches and libraries that make Arduiono pin access to run directly on the Omega.
Regarding access to Arduiono shields that use I2C:
- Since the Arduino on the Arduino Dock uses I2C in slave mode for communication with the Omega it cannot operate as an I2C master to control I2C based shields.
- However: any I2C Arduino shield plugged in to the Arduino Dock is visible to the Omega as an I2C device, it is relatively straight forward to adapt any associated Arduino code to run directly on the Omega using the Omega's I2C capability - I have done so for a couple of Arduino I2C shields with no problems.
Thus, it will be relatively straight foward to provide the Omega with access to Arduino capabilities directly.
I would appreciate any comments, feedback, suggestions etc. on all the above
This leaves one open issue from my perspective that is not so straightforwardly resolved.
That is: communication from the Arduino to the Omega.
The kind of things I am thinking of are situations were the Arduino code would need to notify the Omega of events etc. on the Arduino.
While it would be possible to use I2C to repeatedly poll the Arduino to see if there was anything to communicate from the Arduino to the Omega, this would be a bit complex and add unnecessary processing load to both the Omega and the Arduino.
Currently, there is no mechanism - hardware or software - that I know about that could effectively handle this situation.
What I am proposing to do on my Arduino dock is to solder in links from one or more Arduino pins to GPIO pins on the docked Omega. Then using the Omega GPIO pin interrupt handling capabilities, attach an IRQ handling function to the relavent GPIO pins, then when the Arduino wishes to communicate with the Omega, it changes the state of the relevant Arduino pin that will trigger the Omega IRQ function which can then communicate with the Arduino to obtain any necessary information.
Again, I would appreciate any comments, feedback, suggestions etc. on this
@Kit-Bishop Keep in mind that the ATmega chip (Arduino) runs at 5V and the Omega runs at 3.3V. The completely sound solution would be to use a bidirectional logic-level shifter.
@Lazar-Demin Thanks for the quick reply on this and the reminder of the signal level differences.
I agree that having a bidirectional logic-level shifter would be ideal, but:
- I can't see how i could physically fit the shifter on to the Arduino Dock
- I understand that the Omega GPIO pins are 5v tolerant - reference Electrical Characteristics in https://wiki.onion.io/Documentation/Hardware/Omega-Hardware
So I will probably take my chances with direct wiring
As an aside, my ideal for the Arduino Dock would have been for the Omega GPIO pins to be mapped to (a sub-set of) the Arduino pins via built in bidirectional logic-level shifters - but we can but dream
-interesting idee, to work with arduino/onion, are you planning to make it for onion in C / python or something else
-can you not from 5v to 3.3v with a resistor bridge or something?
@Anco-van-der-Kolk I will be writing the library in C/C++
While I am far from being an expert in Python, I believe the bulk of my library will be callable from Python just as is done with the current code for Neopixel control.
Though I have no idea as to how the interrupt from the Arduino to the Omega could be handled in Python - sorry
Regarding using a resistor bridge for change from 5v to 3.3v - yes, since the signal is only needed one way (Arduino -> Omega), this would be feasible if it is really needed.
Two suitably chosen resistors in series - one end to GND the other end to the Arduiono pin and the mid-point to the Omega pin