You are not logged in.
Pages: 1
Topic closed
Can I take analog inputs to REX, from real world devices via the Rasp pi's SPI bus ?
Thanks!
Offline
Hi,
yes you can. Please have a look at our GitHub examples repository, namely the \Integrating_external_devices\SPI folder. The MCP3008 is probably the most popular ADC.
Links to the examples repository can be found here:
https://www.rexcontrols.com/documentation-and-support
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline
Sorry Jaroslav but as a new user to RexControls, I am going to need a bit more hand holding here.
For example when I attempt to load mcp3008_exec.mdl into RexDraw, I get an error code 27 dialogue box about file name / module name being different. Is that important or can it be ignored?
Once mcp3008_exec.mdl is loaded by clicking past the error code notification window, I get a blank window with no coding apparent. Is that normal or is that due to the error?
If I load the mcp3008_exec.mdl (again by clicking past the code 27 error) and then call for a rexLang object from the library am I correct in my understanding that "Specify the SPI bus by the fname parameter of the REXLANG function block." means that I should change its fname parameter to "/dev/spi0.0" ?
I am looking forward to seeing this work.
Thanks,
Brian H.
Offline
Hello Brian,
hope you wouldn't mind if I will try to answer your questions instead of Jaroslav
Please, can you tell me which version of RexDraw do you use at the moment?
I'm also wondering if you haven't renamed the exec or task .mdl file. If so, you can get an error message about the file name because those two file are internally "connected". This error will be fixed in new release, however those two files needs to stay "connected"
According to your last question: you are right - you should change Rexlang "fname" parameter to "/dev/spi0.0" (or the correct SPI bus device found in your RPI).
Regards, Tomas
Offline
Thanks Tomas,
I am running version 2.10.7.5386 of RexDraw on Win XP.
I opened the mcp3008_exec.mdl file just as it came from the GitHub download. When I got the error message I wondered if I was supposed to rename it to just exec.mdl so I created a copy and renamed it but still got the error message. I boggled at that point.
Thanks again,
Brian H.
Offline
Hello Brian,
thanks for reporting this! Here is the MCP3008 example in a zip file. It is ready to use, no errors or warnings should appear. Open the mcp3008_exec.mdl file, the mcp3008_task should open automatically. Please compare it to the files which you have from GitHub so that we can find the source of the problem. Thanks!
As for the SPI, use the command below to list the available SPI bus.
ls /dev/spi*
In the example I use /dev/spidev0.0 in the fname parameter of the REXLANG function block.
Hope this helps!
Monarco HAT for Raspberry Pi - Lightweight I/O for monitoring, archiving and control.
Raspberry Pi in industrial automation!
Offline
Thanks Jaroslav, that seems to have helped and I can now see the signals operatin as I vary the voltages to the ADC inputs.
Cheers,
Brian H.
Offline
Pages: 1
Topic closed