Rank: 1503 based on 97 downloads (last 30 days) and 1 file submitted
photo

Zhuo Li

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Files Posted by Zhuo
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 Jan 2014 Screenshot I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li arduino simulink pack..., i2c arduino simulink ..., arduino simulink pack... 97 15
  • 5.0
5.0 | 2 ratings
Comments and Ratings by Zhuo View all
Updated File Comments Rating
23 Jan 2014 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li

Hi Ingmar, very sorry for the long waiting. I was traveling overseas last month. Last time when I was about to update it, I found the file was not in my hand. Now, I just submitted the update.

Honestly, I tested repeatedly but still didn't completely eliminate the timeout bug. But by setting a longer serial waiting time and adding more checking statements, the timeout very seldom shows up and can be tolerated for the code to proceed.

Regarding your problem, I guess maybe you can put a serial flush after your a.ITG3200Read function instead of an actual serial write. But anyways, as long as it works for you, you can keep your way. Good luck with your project.

25 Dec 2013 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li

Hi Ingmar, sorry for the inconvinience. I remember I discovered that not long after I uploaded the block, then I made some improvement but never got it updated. Now, I've updated it, you should be able to see the corrected file days later after Mathworks process it. It works better, but I sometimes still recieve the serial reading timeout error, and don't know how to eliminate it.

23 Jun 2013 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li

You're welcome Addie. I would say yes, it can be edited for Mega, but I imagine that to be a cumbersome job which includes augmenting the adiosrv.pde file, arduino.m file and the block files from Atmega328 to Atmega1280. I think it will be a better idea that you advise the developing team "MathWorks Classroom Resources Team" to release a separate package for Mega.

23 Jun 2013 Mittag-Leffler function Calculates the Mittag-Leffler function with desired accuracy. Author: Igor Podlubny

17 Jun 2013 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li

Hi Addie, for now, this block cannot work with Arduino Target package because it is of different mechanism. The Target package supports realtime target while the ArduinoIO is not "real" real time, it's a host-target structure. Sorry for the inconvenience.

Comments and Ratings on Zhuo's Files View all
Updated File Comment by Comments Rating
31 May 2014 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li irawan, addie

Hi,
Good sharing Ingmar

06 May 2014 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li Ingmar

Hi naxokite, It seems like you have the same problem as me. My solution was to change the arduino.m file provided by Zhuo Li.

Open the arduino.m file and scroll down to the part that reads out the I2C master. It is right around line 1539. You will find a line that says fwrite... at line 1581. This line sends the address to the arduino. It seems like you have to execute this line two times. Do not ask me why. If you copy that line and past it right behind it on line 1582 it should work.

Good luck with the project!

06 Feb 2014 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li naxokite

Great package! Thank you very much! I am having some trouble reading the temperature with a.i2cRead(hex2dec('5A'), hex2dec('07')) and I get the temperature delayed of one or something like that, each time I put my hand in fron t of the IR sensor, I have to execute that line of code twice in order to get 30 degrees because the first one gives me the ambient temperature and viceversa when I put my hand away, the first one still gives me the hand temperature(no matter how much I wait) and the second one gives me the real temperature, any help? Thanks!!

23 Jan 2014 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li Li, Zhuo

Hi Ingmar, very sorry for the long waiting. I was traveling overseas last month. Last time when I was about to update it, I found the file was not in my hand. Now, I just submitted the update.

Honestly, I tested repeatedly but still didn't completely eliminate the timeout bug. But by setting a longer serial waiting time and adding more checking statements, the timeout very seldom shows up and can be tolerated for the code to proceed.

Regarding your problem, I guess maybe you can put a serial flush after your a.ITG3200Read function instead of an actual serial write. But anyways, as long as it works for you, you can keep your way. Good luck with your project.

29 Dec 2013 I2C block for ArduinoIO simulink package This is an augmenting block that enables the ArduinoIO package with the I2C bus read capability. Author: Zhuo Li Ingmar

Hi Zhuo, big thanks for the quick response. I'm looking forward to your update. In the mean time, I wrote an extra function to read out the gyroscope that I was talking about.

I found a library supporting the gyroscope so it was rather easy to supplement the arduino.m, the adiosrv.pde and simulink library with an ITG3200 (the gyroscope) Read function.

It is quite funny because in the beginning I received the same error. The first time I executed my a.ITG3200Read function I received the time out error. But when I executed a second fwrite right after the a.ITG3200Read function I received the values. Any fwrite function would do the trick (the values were also send if I did an a.analogRead).

So I fixed the problem by adding a second fwrite command in de arduino.m file right after the first one because it seemed that after the first fwrite, the values were stored in the arduino and by executing the second fwrite it was read by matlab.

I'm not much of a programmer but I can imagine that this solution is at least a bit unorthodox. But to be honest, it seems to do the trick so I am not going to worry about it.

I am still looking forward to your update though, because your block is far more general from what I have done.

Contact us