Categories

Makahiya – I2C, a burning solution

Hi everybody,

First of all, Happy New Year. I hope that 2017 will be a wonderful year for you (or at least a not too bad one).

Since the beginning of the week, I’ve worked on… I2C ! Following the advices of Samuel and Alexis, I finally added the pull-up resistors and spied the communication with an oscilloscope. But this doesn’t help me to find the problem. And finally, I put the pins on OPENDRAIN mode, and it solved my problem. Such a stupid reason!!! It was due to an assumption I made during my first tests on the I2C: I thought that this parameter (opendrain) only deactivated the internal pull-ups. And in fact, it’s two completely different things… So yesterday evening, I managed to read and write registers of the capacitive sensor.

So this morning, I started to search for the proper values to set and implemented the initialization code. In parallel, I helped Tanguy on the Bluetooth module (because he also had communication problems). My initialization code was not perfect on the first try and I encountered strange behaviors, with the capacitive sensor sometimes suddenly not responding anymore. So I plugged and unplugged it many times. And once, I made a mistake on the connections. As I was solving problems, I didn’t see this one immediately. But after some time, I felt a strange smell, like smoke: the capacitive sensor was very hot. So I unplugged it, made some tests with Perceval’s help, and I’m quite sure that the sensor is dead… Less than 24 hours after the first communication, I lose my sensor… Bad news.

During the end of the week, I will work on the server, and I hope to have a working version before we receive the PCB (probably next Tuesday or Wednesday). For the capacitive sensor, I don’t know if it’s better to wait for the PCBs and continue the tests directly on the PCB or to buy a new evaluation board to finish the tests. This will be discussed tomorrow or Friday.

Makahiya – IFTTT & I2C

Hi everybody,

Just few words to write down what I’ve done since last Sunday. First, I had a look on the ways to interact with our flower. At the beginning, we envisaged to connect it with IFTTT. So I had a deeper look on how to do it and discovered that we have to pay 199$ to do it. For no more than 2 weeks and without any guarantees on the use because it’s possible that we won’t have time to do the connection, I think that for now, we can put this solution aside. So I propose 2 interfaces: a web page and an Android app. These 2 interfaces are quite simple to implement. And if finally, we have time, it won’t be too late to connect our plants with IFTTT.

Then, I worked a little on I2C communication with the capacitive sensors. Some tests allowed me to rule out the device address as the origin of the communication problem. Indeed, the sensor doesn’t respond to any message sent by my own code whereas it properly responds to messages sent by the demo program. And for now, I can’t see any differences… Pull-up resistors also doesn’t seem to be the origin because the bus behaves properly. Obviously, there is at least one difference between the demo board and my own arrangement, still hidden unfortunately. So more work is required.

During the end of the week, I will work a little on the I2C communication.

Next post will be next year, so enjoy the end of 2016 🙂

Makahiya – websockets & I2C

Merry Christmas to everybody,

I hope that each of you can enjoy a wonderful day with his/her family or his/her friends, and that Christmas father has been kind with you.

Just a few words on what I’ve done since last Wednesday. I spent some times working on connecting my Wi-Fi module with the websockets that run on our server. I managed to have first results: connection is established and I can send messages. As I don’t have access to the server and Tanguy doesn’t have Internet access, I can’t have any information on what is received by the server, thus debugging is quite difficult. So next steps will wait a bit.

I also had a look to the I2C driver, in order to talk to the capacitive sensor. I’m able to start a exchange but I don’t receive any ACK from the slave. As I don’t have pull-up resistors, it can be the origin of the problems (the internal pull-ups are said to be too weak). I will add pull-up resistors next week, once returned to Paris, and make new tests with them.

The 2 targets are thus in pause, and I don’t have more to say for now.

My goal hasn’t changed: having both Wi-Fi and capacitive sensors working by the end of the holidays.

Merry Christmas

Makahiya – Wi-Fi and music (again)

Hi everybody,

Yesterday and today, I worked on the Wi-Fi connection and more precisely on downloading a music from the server. As said in my last post, I had some problems of rate. And they are more complex to solve than expected. I was becoming crazy yesterday afternoon, because despite all my efforts and all the improvements I could do, there were still problems. Thus, I decided to make a break and not to touch this part again before at least one week.

But Samuel answered to a question I’d asked on the mailing list, suggesting me to measure the time spent on the blocking functions. As it was quite easy to do, I decided to do it this morning, just to see. And, due to some magical effect, the download of the music worked quite well. So I regained courage and made some cleaning on my code. The sound is not perfect, but now the music is received until the end in most cases, and the error management system doest its work pretty well.

I won’t continue to improve it now as it’s enough for the moment. So this afternoon, I had a look to the websockets implemented by Tanguy on the server, to see how it works. During the second part of this week, I will either work on implementing the connection to the websockets on the board and the reception of commands or start to implement the driver to control the capacitive touch sensors, I don’t know yet. My objective is that these 2 things are finished by the end of the holidays. It’s quite ambitious because I won’t have so many time to work, but that’s my target.

Makahiya – Wi-Fi and music

Guten tag von Munich,

On Thursday and Friday, I spent almost all my time working on the Wi-Fi module, trying to understand why I wasn’t able to play music received from the network (and even not able to properly download it completely). On Friday evening, Samuel entirely reviewed the related code with me and helped me correct several mistakes, mainly in the code of the audio part. And it was the right thing to do because now, it works much better: I can receive music (at least the beginning) and play it.

The sound is still not perfect so I have to understand where this problem comes from, but I’m quite confident I will find a way to solve it in the next few days (when I’ll be back to Paris). In fact, I didn’t check the code related to the audio part because I assumed it to be correct as it worked when I transmitted the music on the serial line. But it wasn’t…

So the morality is: if you have something that doesn’t work as it should, review all the code related to it, even the parts that you trust, because you can find there mistakes that previous tests didn’t found.

During the next few days, I’ll try to solve the 2 remaining problems: I can’t download the whole music (downloading abruptly stops at a certain point, that doesn’t seem always the same) and the sound is quite bad (probably due to a lack of data at certain moments, if the download or the exchange between the Wi-Fi module and the micro-processor is too slow).

Makahiya – Wi-Fi

Hi everybody,

During this first part of the week, I worked on the Wi-Fi module. Unfortunately, I didn’t managed to reach my goal, which was to play music streamed from the server on the development board.
However, I did some things. Command return codes are now properly handled by the program and it’s much easier to communicate with the Wi-Fi module through the development board. For the music, I’m able to receive the data (some data in fact, I have to check if there are differences between data received and the actual content of the audio file). The first problem (which I think will be solved automatically when I would find a solution to make the music player work) is that when I just tried to download the music, I receive a continuous stream of data, without end (at least not in 5 minutes of downloading, for a music that last about 4 minutes…). Second problem is that when I start to decode the input stream (from mp3 to pcm), it stops downloading the rest of the file, whereas these actions are performed in 2 separate threads.

The second part of this week will thus be dedicated (for me) to look for the origin of these problems. And we should also add some automatic tests (at least check that the code compiles) for the Continuous Integration. This will be done after the Wi-Fi/music problem is solved, so probably during the holidays.

Makahiya – Wi-Fi module

Hi everybody,

As said in my previous post, I’ve worked on the Wi-Fi module. And it works very well. Using the module itself was much easier than expected. I just have to send commands to it on a serial connection to make it works. And it’s very easy to show a nice user interface to select the proper Wi-Fi network to connect to because it’s already provided by the OS embedded in the module.
I had more problems to configure the UART bus on the development board, even though it seems a very simple task. Most of the problems were quite stupid. For instance, on the Olimex E407 board, the pin number 8 on the Port D connector doesn’t correspond to GPIOD8 !! Because pins 1 and  2 are Vcc and GND. Once you discover it, you realize that you’ve spent the last hour working for nothing, really.
But now, everything works fine: I’m able to connect to my Wi-Fi network, to read web pages and to use the API of our server to update the database.

Now, I’ll continue to work with the Wi-Fi module and try to make it connect to the websockets Tanguy has created on our server.

Makahiya – PCB & server

Hi everybody,

Since last Sunday, I worked on the PCB and on the server. First, on the PCB, I did a complete check of both the schematic and the routing, to find the remaining errors. Alexis also did it on his side, and we both found errors. After having corrected them, I gave my approval to send the PCB to the factory, and so did Tanguy. We should have received them in 8 working days. But as we don’t really need them during Christmas holidays, a longer delay is possible (which is good as it reduces the cost). So our PCBs have still not been sent. But we received 2 evaluation boards for the Wi-Fi module. Thanks to them, we’ll have the opportunity to develop the driver to control the Wi-Fi connection with ChibiOS. Alexis will also solder an evaluation board for the Bluetooth module, so that we can also work on it during the holidays.
After having finished my work on the PCB, I spent several hours on the server. I faced many problems with git subrepo, and thanks to Perceval help, I manage to get rid of it. So now, it’s much easier to work with Heroku. I’ve added authentication to our server and I tried to add links between the tables in our database. But I faced several problems, some due to the facts that I didn’t wrote all the code (Tanguy is also working on the server) and that I assumed things that happened to be different (for instance, we use a Postgre database on Heroku but a SQLite one for Continuous Integration because Tanguy has the impression that it’s not possible to install a Postgre database in the test environment).

As working on almost the same thing at the same time seems to be a rather bad solution, I will probably start to work on the Wi-Fi module and let Tanguy continue his work on the server. So by the end of the week, I will learn how ZentriOS works and start to write the driver that will control the Wi-Fi module.

Makahiya – sound, server and PCB

Hi everybody,

I didn’t do a lot of things on the project since last Wednesday.
Nonetheless, I managed to make the sotware audio codec work!!! Now, I’m able to stream whatever mp3 file on the serial link, decode it on the micro-processor, send it to the codec and hear it in my earphones. I don’t really know what were the errors in my previous code, but now it works and it’s the most important. We have our first completely finished driver, and that’s a good thing as it doesn’t remain a lot of time before the final deadline.

I also had a look to the server. I managed to deploy the database on heroku (a PostgreSQL database was required), but it has a very strange behaviour: if you read it several times, you don’t always have the same result, and the result also depends on the device you use to access the website. So it’ll be necessary to have a look to it. I also read some documentation about Pyramid to really know how it works (I hate doing something without knowing what I do). Finally, I spent some time looking for a way to add security to our server (authentication and authorization). I found one library that allow the users to log in with their Google account, but it doesn’t work with Python 3.x (only Python 2.x). So I’ll continue to look for a better solution.

And our PCB will be sent to the factory tomorrow evening. We must receive them 6 working days later, which is a good news as it will allow us to work on it during the Christmas holidays.

During next week, I will focus my efforts on the server, in order to have it finished when we receive the PCB.

Makahiya – final PCB review, sound and server

Hi everybody,

As said in my last post, I finished the routing of the PCB. Alexis made some reviews, and I did the corresponding corrections. It should be ok now, and the PCB will be sent to the printing factory soon.

I also (it occupied most of my time on Monday and Tuesday in fact) worked on the audio codec (again). You’re possibly fed up with it, and I understand you. I’d never thought it would be so difficult to make it work. But everyday, I go one step further, so I can’t abandon it (and I really want it to work, so I won’t abandon). Now, I’m able to play any music stored in flash when it’s presented as a single block to the software codec. And I can play one music (the one I’ve used for my tests until now) even when it’s read by chunks (and on Tuesday morning, I could send it through the serial link and play it, but on Tuesday afternoon, it didn’t work anymore, don’t know why). But it fails when I try with other musics… I will continue to work on it.

Finally, today, I deployed our (basic) server on Heroku. I spent some times trying to understand how to use git subrepo. And it’s still not completely clear in my minds, even if it seems to work. The database doesn’t work for now on heroku (due to an error caused by waitress), a deeper analysis will be required to fix this problem. And I also wrote a template html file to display the content of the database (the leds values).

During the end of the week, I’ll try to work on the audio codec to solve the last problems. And I will work on the server also (to make pauses between 2 work sessions on the audio). If both work well on Sunday evening, I’ll be very happy.