Categories

I’m done with scripting Simulink

Hi!

Hope you guys had a nice long week-end! Mine was quite busy so I didn’t spend much time on the project.

However, in my last post I said that I wanted to finish the digital part of the electric scheme and the script for Simulink.
And here we are, at the middle of the week:

  • I’m quite close to the end of the electric scheme after the second review from Alexis. There only remains to design the antenna for the LoRa chip and to re-assign the pins of the MCU for an easier routing.
  • I finished the scripts for Simulink and they are on master! They are able to:
  1. Convert the output format of the discovery card to a MatLab input format.
  2. Test the algorithms on an input and save the output curves as pictures.
  3. Test the algorithms in a large number of inputs. And this time it’s really quicker than the previous version.

So for the end of the week, I want us to finish the electric scheme so that we can do the routing part as soon as possible and send it to the printing.

I will then work on the server part as we need one with a small database to connect our devices and interact with them. We planned to make it in Python, but didn’t choose a host and a framework, so I will need to find what best suits our project.

Have a nice end of the week!

Xavier Chapron

Quite a quick week…

Hi!

Quite soon to post for my job for the end of the week, but I will be in Amsterdam during this long week-end. Therefore I won’t work on BreathUp before Wednesday.

Ok so in my last post I said that I wanted to finish in the evening the electrical schematics (the digital part) for the PCB, and actually I finished it as expected at 2am and an half. 🙂

I got some feedback from Alexis today, and therefore had some minor changes to do. Especially, we will be using a quite powerful MCU that comes with a lot of pins so I’ve chosen to connect all the peripheral components pins to the MCU so that we will be able to choose any configuration. But we will change that because it will make the PCB routing quite harder, and it might be already hard enough…

I’ve also spent some time on the automation of the use of Simulink and found a way to speed up our tests. That is not ready yet, but that will come soon.

So for the end of the next week, I will need to have finished the schematics on the digital part.
And that would be good if I also could finish the scripts for Simulink.

Have a nice week-end !

Xavier Chapron

Setting integration tests and working on electrical schematics

Hi!

The first part of the week was quite productive. In my last post I said that I wanted to work on a fully integrated processing chain and on the PCB schematics.

And here we are, on Wednesday:

I’ve started to design the schematics, that’s not finished yet, but I will spend my evening on it because I really want to make a list of questions and have some feedback from Alexis before the long week-end.
A bad news is that we might have some real difficulties with the battery autonomy because after some datasheet reading and calculation I found that the maximum current needed will be 700mA/h…

Secondly, I succeeded to create an automated test of our algorithms from Simulink and C for a database. Here are the main difficulties I had to overstep:

  • The main part of our algorithms is still in a Simulink model. This model includes in its configuration the input file, the sample time and the simulation time and we want to change those parameters for the different files in our database. The best thing I found is to edit the model file (.mdl) with a Python script to change theses values.
  • The next step was to find a way to launch the simulation from command line. And I finally found a way to give to Matlab instructions to do that.
  • Finally, we want to run some C algorithms on the outputs to qualify them. So we need to convert the Matlab output file into a file that will be easy to parse in C.

And here are the difficulties that still remains:

  • I want to be able to get the sample time and simulation time from the input files, not from an hard coded parameter in the script.
  • This is really slow, one minute per file, so about half an hour for our actual database… I think I can improve this, but I need to make tests and spend time on it before confirming it.

Now that I am getting used to Matlab and Simulink from command line, I want to create some scripts that would improve our efficacy. For example with a script that will allow, in a few seconds, to get the different curves after filtering from the csv data exported from the ADC testing card.

Eventually, I made a good start with the PCB and the test automations and I will continue this work for the small end of the week.

Xavier Chapron

Tough week for BreathUp but with some results

Hi!

My most important job was to finally have the exact list of component we will need. Therefore I chose a lot of them with the help of Alexis but I need to make some tests on the led and on some connectors to really finalize this task, that should occur before Wednesday.

I also wanted to start the PCB schematics, but I didn’t have the time, therefore I will do it before Wednesday.

Finally, I worked a lot on the algorithms and on Simulink. I started alone on Thursday when I discovered that with a lot of efforts, we could compile an easy Simulink project for a cortex-M4.

Then with Benjamin, we worked on the algorithms on Saturday. That was a really tough and obscure job as we didn’t have any data to process… But Laurent finally gave us some records. Therefore, we tried some algorithms on them. The bad news is that we discovered that their algorithms don’t work, that we won’t be able to split the ECG and EMG signals so easily… The good news is that we are know capable to filter the EMG.

To conclude this week, I wrote a python script to format MatLab data in a text file that Benjamin can read with a C program that can count the number of heart cycles.

The really bad news is that I wanted to create a script that would test automatically the Simulink and C programs on a database. And that is when I discovered that we won’t use Simulink conversion to C for our embedded system… It’s a total mess, we were not really expecting some clean code, we knew that we would have some issues regarding inputs and outputs. But not that the whole processing chain would be in one big function that weighs 18Mo…

So for next week Benjamin and I will need to find a way to create a C processing chain and I will work on the schematics while Benoît and Alexandre will hopefully give us some real datas they finally succeeded to acquire.

Comming back soon!

Xavier Chapron

Need a big BreathUp after a deep dive into Simulink

Hi there!

So as the others have mentioned, not so much time, and a lot to do!

So first, we have all worked a lot on our PCB TP, and that will be useful for our project as they are a lot of components that we will use (SDcard, IMU, microUSB, power regulator, …). So when I was saying that I should start to work on the PCB this week, we are really on the way!

Next, I’m happy to introduce our hackster page. You will find there a resume of the project.

Eventually, and that was my second task for the week, I’ve worked a lot on Simulink (MatLab module) and how we can export the algorithms in C and then use them in our project. Sadly, I’ve not finished yet, but as Benjamin said, I’ve already some result, and they are not good :

  • First, I’ve managed to export simple algorithms in C, and I’ve discovered that this creates a stand-alone code: exports all modules in .c and .h files, creates a project .c and .h and drive it by a main.o file…
  • Therefore, we will need to create a new main.c that will bypass their main.c and project.c. Because obviously there is no documented API that we can use. But that also means that each time we change our algorithms in Simulink, we might need to change our files. We will also have some troubles with the parameters as they are hard-coded in all the modules files, so that will be tough to control them.
  • Finally, I’ve started to change the tool-chain to cross compile the project for a cortex M4. I’ve not finished yet (the test project was needing to link function to open files, creates them… and I don’t have them…), but for sure if that doesn’t work, we are good to rewrite the algorithms manually… Maybe that would save us from some Simulink headache…

 

Obviously for the end of the week, I need to finalize the reflexion on Simulink, and to continue on our PCB.

Good night,

Xavier Chapron