NMaas
Posts: 29
Joined: Sat May 12, 2012 2:51 pm

Wolfram and custom i2c Device

Thu May 29, 2014 5:56 pm

Good evening,

I found out about Wolfram beeing able to communicate with i2c Devices - but sadly only on the prebuilt example of an RPi Weatherstation ( http://community.wolfram.com/groups/-/m/t/157486 ). Does anyone know wheter its possible to use Wolfram with custom i2c Devices, like an TMP100 temperature sensor?

Thanks a lot,

Nico

User avatar
Gavinmc42
Posts: 4508
Joined: Wed Aug 28, 2013 3:31 am

Re: Wolfram and custom i2c Device

Fri Aug 01, 2014 3:38 am

Yep the i2c examples suck, never could figure out the weather station code, think it had a device driver?

You can call external system commands like i2cget -y 1 xx
Took me ages to figure it out, then I forgot how to do it:(
Seem to remember you can call external functions but cannot pass parameters as well?
Shell scripting?

One thing I had luck with was to use python to read the i2c sensors, write the data to a file then get Mathematica to read the file.
Since everything in Linux is a file, possible to read directly?

I use Cypress PSoC1's a lot for custom i2c sensors, I/O etc
CY8C28445 has 4 x 14bit ADC's, 2 x i2c ports, one for programming/RPi comms, the other for combining other i2c sensors data.
Even has software i2c, so any pin can be programmed for i2c I/O.
Programmer miniprog3 has i2c option, very useful for debugging any i2c device/register.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Hellmut1956
Posts: 5
Joined: Mon Nov 17, 2014 10:29 pm

Re: Wolfram and custom i2c Device

Tue Nov 18, 2014 11:43 am

I am getting the impression that the guys at Wolfram are still pretty immature in documenting their stuff when it comes to connected devices, interfacing with hardware that has not been pre developed by them and when the intended use gets beyond what they target.

I am interested in using Mathematica and SystemModeler to do "Design by Modeling" with "Hardware and Software in the Loop". So as written here it seems to be that you have to "discover by yourself" how to do it! The path that I am studying right now goes via WSTP, but it is kind of searching for the data required in an environment that does not have the purpose to tell you this directly. The minimum I would have expected from Wolfram would have been kind of a "Hello World" example where you can write something to external hardware and have an LED light up on any GPIO and the ability to read the status of a GPIO and have this done by using variables in the Wolfram code.

I am saving the money right now to buy Mathematica and SystemModeler license for none commercial use.

Rgds Hellmut

NMaas
Posts: 29
Joined: Sat May 12, 2012 2:51 pm

Re: Wolfram and custom i2c Device

Tue Nov 18, 2014 12:49 pm

Hello Hellmut,

I have already solved the problem as I have written my own MathLink bridge specific to the used chips (I2C/SPI) in my thesis by using the wiringPi Library.
Actually it is quite easy and the guys at Mathematica are working on resolving some dependency issues I came up with :).

Regards,

Nico

Return to “Mathematica”