How to read signal using Neuron
-
Hi,
I have a problem with reading signal from my laser sensor using Neuron.I can't find a way to get information about signal.
I have Neuron S10x and connected to it signal from laser sensor.I use two alternative connections:
- one direct connection from laser sensor to RPI GPIO 40 - and this signal I read correctly
- one connection via Neuron Digital Input 2 - the same signal from the same laser sensor - but this I'm not able to read.
I tried clear raspbian OS and your image from https://files.unipi.technology/ jessie-2016-12-06.img.
On both OS I have the same, can read signal from RPI GPIO 40 but can't read any data from Neuron.All connections you can see on the attached file:
- cable read/yellow is direct connection between laser sensor and GPIO 40 on RPI
- cable blue/brown is the same signal connected to Neuron Digital Input 2 (you can see light on LED on Neuron)
Could you write me for example python code that I can read signal?
For RPI GPIO 40 I read it usingimport RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) PIN = 21 GPIO.setup(PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP) while True: if(GPIO.input(PIN) == 1): print("No Input signal detected") time.sleep(0.1) else: print("Input signal detected") GPIO.cleanup() Input signal detected Input signal detected Input signal detected Input signal detected Input signal detected Input signal detected Input signal detected
Can you show me similar example how to read data from Neuron ?
Connection details and what I get using evok.py web interface in attached files.
I would like to know how to read signals without evok, to be sure the problem is not in configuration of it.Thank you in advance for your help.
It is worth to note that on unipi image I see different result of command i2cdetect -y 1
This is what I see when use your image:
-
@lgab Hi! Neurons have completely different architecture than UniPi1. It does not use GPIOs for I/Os instead, there are up to three ARM CPUs that communicate with RPi.
I suggest you to take a clean Raspbian, install the latest development version from GitHub. It will provide you a websocket, rest or json API to the IOs.
More topics: https://forum.unipi.technology/search?term=neuron evok&in=titlesposts
-
You are right, installation from clear raspbian image and master version of evok from git works.
Can you show me example of python code that I can read that signal without evok.py?
It could be even fragment of evok code that just read data from selected Digital Input?Thank you in advance,
-
@lgab There is a TCP Modbus master daemon runnig under evok (already installed with evok) but does not provide 1Wire communication.
https://github.com/UniPiTechnology/neuron_tcp_modbus_overlay
Map of all registers/coils can be found here: http://downloads.unipi.technology
-
Thank you, now everything is clear.
Can you just confirm that below link is proper one for my neuron?
-
@lgab Yep, thats it. Some documentation might not be the latest so always check https://files.unipi.technology/index.php/s/zTmrEbQEvifNd6W?path=%2FProducts%2FNeuron%2FDocumentation
-
@lgab if you want to try with Socket connection, use the URI
ws://192.168.1.16:8088/ws
Next, if you want to update the DO2_14, you have to send something like this:
{"cmd":"set", "dev":"relay", "circuit":"2_14", "value":"1"} or {"cmd":"set", "dev":"relay", "circuit":"2_14", "value":"0"}
-
Thank you for all information.
I will try read data directly from modbus daemon.
-
@lgab my reason for using the socket solution is that it pushes changes of the inputs so that I don't need to poll