Categories

RoseOnLeds

Hello world!

Leds, Leds, Leds, Leds everywhere…! Well, yes, as Noémie said in her last post, we have been working on the ledstrip lately, trying three different methods to light them on: first, we decided to use SPI&DMA. So Noémie worked on it and read millions of pages of doc (cf. her post “Oh my Doc” 😉 !). Then we thought we could more simply control it with one GPIO and a TIMER. But before, we started with the very simple (but not precise enough) method of bit-banging. Then, we attacked the TIMER method (GPT driver and GPIO control in the callback method). The thing is that the duration of the high signal is as short as 0.4us (the total period is 1.25us, so three times 0.4us, making it three bits to send for a ‘1’ or a ‘0’). This required us to use a 168MHz timer and a callback method every 67 cycles, buuuuut…. the callback fucntion Noémie and I wrote was waaaaaay too big. So today Sam helped me to shorten it a bit a whole lot (by the clever idea of preparing one huge buffer containing all ones and zeores to send, so that the callback method would simply read one bit in the buffer every 67 cycles and send it).

You’ll probably not beleive it… but yes! The whole code was in fact useless! Because even with the optimization, the callback took about 42 processor instructions (so 66 with the 2*12 instructions for entering then exiting the interrupt routine). In short, it’s almost impossbile to use this method if we want to control all of the leds on our ribbon.

So: back to SPI! Hopefully Noémie had already done the beginning of the code (thank you ;)!) So, we changed some bugs and made sure the config was correct (APB1 bus->42MHz->prescaler 16->final freq=2,625MHz which is almost equal to 1/(0.4us) = 2.5MHz). Of course, it was far from working at the beginning. We analyzed the signal with the logic analyser and found some incoherences (there were too many zeroes). As I was desperately trying to understand what was wrong, Sam offered his help 🙂 We reviewed the code and figured out that the code for the generation of the buffer was somehow bugged (writing it just before lunch this noon was obviously not such a good idea!!) In short, after correcting these little mistakes, we tested the code on the led and…. guess what:

led2I’m really so happy. So is Noémie 🙂 Now, we’re sure we can use three SPIs (available on our STM32F407) to control three ledstrips with almost no CPU power required (therefore we think of using it for other purposes, for instance helping the nrf with handling the data it receives by BLE, or even doing other funny things we could do with the leds…).

I have written too much, sorry. Now the priority is to finish the PCBs and to catch up with our lateness in BLE!

See you!

It’s a kind of magic

This race that lasts a thousand years
Will soon be done.

Hello World!

Yesterday and today, I kept on working with my nRF51822. On Wednesday, I had managed to do some advertising. Now I wanted to add a custom service.

First, I found a very useful and detailed PDF in the nRF51822 documentation, explaining how to build a simple LedButton service. Another device can write a characteristic to switch on or off the led, and the board notifies the other device when the button is pressed. Quite simple it looks! However this basic service requires a lot of code to work. So today I finished a first complete version, which has the good property to be compilable!!

But the hardest part was to actually test the program. I needed another BLE device to display the list of the services, and to read or write some characteristics. Unfortunately, I couldn’t make the Bluetooth dongle work on Linux (I tried everything Yann explained later in his post, but without success). I also tried to use a BLE scanner app on Lauriane’s Nexus 4, but the behaviour was a little unpredictable (it’s a kind of magic…): for example, I had to restart the phone in order to refresh the service list… Then I tried my program with a Nexus 5 (thanks Thomas!). Unfortunately, the behavior was also kind of magic: this time, I managed to get a notification from the board, but it happens once out of ten tries. So tomorrow I will try with another device, perhaps a Windows computer with the Nordic debug software installed on it (yeah I’m hopeless…).

May the force be with you!

RoseOnRails – a lot of things!

Hi all.

These last days have been difficult! I think this week we have worked on our project more than we have ever done since the beginning of ROSE! Yesterday night was one of the most exciting ones in my life (I’m not exaggertaing :p!) We managed to test our LED stripes, drill a piece of our railraod and put the stripe underneath… the result is a three times more beautiful railroad!! I’m so happy the stripes fit perfectly in the space below the railroad, although we’re still wondering how to manage the curves on the circuit….

On my part, I have started to think about our Software Architecture. I have therefore read about BlueZ, hcitool, gatttool and so on, to find out how to program the application that will be run on the Central Station. Then after discussing with Alexis on Tuesday, I temporarily switched to a more important question, namely how to manage the nrf51822 chips on the train and on the railroad switches (from a software viewpoint), above all the question whether or not we need an OS on our chip? Given that the SoftDevice BLE stack generates interrruptions on its own, it most probabaly wouldn’t be compatible with an OS running on the chip. If we absolutely need an OS then we should consider adding another microcontroller at the output of the nrf…. So I started to see what software mecanisms we need to implement on the train, and in fact apart from the PWM (for the motor and the lights on the train) there is nothing more (of course apart from the BLE app that will be managed by the SoftDevce). Good news : there aren’t PWM channels on the nrf!! Soooooo, last night Sam put me on the right track talking about the PPI, and the Task&Event mecanism. Therefore, I read a whole lot about all this, as well as GPIOTE modules and how to use them to “simulate” a PWM, by using a Timer peripheral in Compare mode and a GPIOTE controlling the GPIO that we want to PWM-control. I also found (once again after being put on the right track by Sam 😉 !) an example implemantation of a three channel PWM on the nrf on this very helpful website and dived into the code to understand what it does. Today, I will try to use it on our Evaluation Kit just to better understand how it works and then determine precisely whether or not we can be sure to be able to manage the train and the railraod switches in bare metal.

I wanted to talk about the motor as well because there has been a rather big change in our conception of the system -> we will no longer be using a “hand-made” H-bridge but rather a standalone H-bridge. After disussung with Alexis, we found out that with the previous model we had suggested, chances were high that there might be a shirtcircuit! So last night, Gleison and I found a model of an H-bridge (previsously suggested by Alexis to another group)… but it’s a bit more complicated than what we thought, to use it.. I didn’t have the time to have a closer look at it last night since I was busy datasheet-reading for the nrf, but hopefully today I will try and study that part a bit more.. we also need to determine what RC filter and what Zener diod we will be putting before the ADC input.

Today, it’s the Iranian new year I will go further in discovering how to use the nrf in bare metal mode for our application.. and if time there is (I have a porject to do for my ATHENS week in parallel :\ !!) to determine how to control the H-bridge and the components for our RC filter and Zener diod.

We’ll keep you posted 🙂 !

 

Advertising space

No one learned from your mistakes
We let our profit s go to waste
All that’s left in any case
Is Advertising space.

Hello World!

Since this week end, I have continued to work on the nRF51822. On Sunday, I tried to write my first program from scratch. My goal was to get a blinking led. But I added a little challenge: I had to use timers, so that I could start to dive into the nRF51822 documentation, and especially the API of the SoftDevice. Fortunately, the doc is well written, and it was quite easy to light a led, and then to use timers in order to make it blink.

On Monday, I took a little break. I didn’t advance on the nRF51822, but I helped some of the other students to flash their boards. I also tested with Lauriane her Android app, and good news: it was able to recognize my nRF51822 advertising (however it was the example program).

Yesterday, I decided my goal of the day would be to write from scratch a program able to advertise (no services for the moment). It was a little harder than the led, but I was able to find some inspiration in the advertising program, especially for the BLE parameters I had to setup and the order of initialization of all the modules. In the end, I had a working program and I tested it with Lauriane’s Android app: it showed a device name “Drop” (screenshot is coming)!! Now my next goal is to add a service (for example, showing the state of a button or of a led). I will start working on it today or tomorrow.

May the force be with you!

PLUME – BLE : First steps

Hello,

Yesterday, we did our first test with our self-made coil and it was enlightening. Many thanks to Alexis and Félix for their cooperation 🙂

We were also given our BLE kit. I worked on it this afternoon. I’ve mostly set my tool-chain and got an example (which was given with the BLE sdk) to work. Here is a quick video for you 🙂

Some useful links :

https://github.com/hlnd/nrf51-pure-gcc-setup

http://www.segger.com/jlink-software.html

‘Till next time.

Benjamin

RoseOnRails – LEDs … It’s on !

Hi everyone,

This week I am in charge of answering all the questions we have about the LEDs we are going to put underneath the railway. Today, I answered some of them:

– How will we control the LEDs ?
After having discussed with Alexis, we found two solutions:
1. We can put independent LEDs underneath the railway and control them thank to PCBs ; each PCB would them be wired to one of the railway switches PCBs. This solution involves a lot of wires !
2. We can use ribbon of LEDs. Though the LEDs would we on a same line, each of them could be controlled independently thank to a ribbon controller. Each ribbon would then be linked to a railway switch PCB.
I personally prefer this solution, because it involves less wires than the first one …  Moreover, I have looked it up on the internet and have found numerous models of ribbons with different number of LEDs per meter, and different caracteristics. We will choose the LEDs ribbon according to how many LEDs we want, the length of the ribbons, the colours and the way they are controlled.

– How many LEDs ?
It would depend on the ribbons we can find, but approximately one for 5 centimeters.
I will measure the total length of the railway tomorrow.

– Will the LEDs be used to determine the position of the train ?
In our game, the only moment when we need to know the exact position of the train is when the train rolls over a LED ; so that it seems logical to determine the position of the trains thank to the LEDs. We will put an optical sensor underneath the train which will be able to determine when the train actually rolls over a LED.
However, we need to know which LED a locomotive rolls over. In order to do so we will modulate the light of each LED differently so that they send the accurate information to the central station and the good LED is shut down. (We now need to make sure the ribbon we will find will enable us to modulate the light of the LEDs).

– In which colors ?
If we use LEDs ribbons, we can easily use LEDs which can change colour.

Today, I answered a lot of questions regarding the LEDs ; but the answers have brought a lot more questions!
All those questions should be answered by Sunday.

By the way, I also managed to light the LEDs in my STM32 thank to the buttons! I think I have finally understood the events in ChibiOS!

 

Hello Droid!

Hello World!

logo_equipeIt’s a great pleasure to introduce you our brand new mascot: R2-D2! Why R2-D2? Because:

  • It is a droid, and our API will be available on Android platform;
  • In R2-D2, there are a ‘R’ like Roses and a ‘D’ like Drops;
  • In Episode IV, R2-D2 delivers to Princess Leia a message containing the blueprints of the Death Star.

Also, R2-D2 is the coolest robot of the universe and beyond.

I will try to finish the project logo before the end of the week. I also have to fix a few mistakes in the Git slides.

In the meanwhile, I spent yesterday on my STM32 lab. Now the leds are fading (PWM magic!). Next step will involve conditional variables and events (I hope to finish it before tonight). We also planned the work for this week. We are all assigned to do some research on the components we will use. And we also have to finish the BLE architecture.

May the force be with you!

LEDzep – Monday’s presentation, STM32 and LEDs

Hi,

This morning we presented our PSSCs, and were rather happy to see that only one of them was over optimistic (the localisation of the balloons), so we will have to pick our brains more on it, because if we choose to keep it it will imply a huge amount of work on this and dire consequences if we fail, so we will have to find if this is really required for our application. Indeed, Alexis presented a solution in which the balloons only stay next to each other (and maybe a mothership), in this case we would simply give orders to the swarm, explaining where it would go.
In any case we will have to dig deeper in our view of the project.

In the afternoon I worked on the ChibiOS/RT lab works, spend some time reading my old notes on the subject and rediscovered ChibiOS/RT’s documentation.

I also tried to light a balloon with a ROSEace LED (very bright, but also very directive), this le(a)d me to think that we will face a lot of troubles if we intend to use them by day, I later tried to use less directive LEDs but it was a huge fail as I tried to put a lot of them inside the balloon and was thus unable to inflate it (wires going out of the balloon tended not to be hermetic). I later ordered a few Kingstone LEDs in order to find the proper light intensity that we need (intensity is written in the datasheet, but i have no idea of what mcd really mean in terms of light), and chose to buy a good range (from 17mcd to 700mcd) in order to properly chose the ones we will use.

LEDzep and work

Since my last post, I’ve been quite busy preparing Friday presentation about 802.15.4/Zigbee with Adèle, studying, getting the damn green LED of the Olimex STM32P407 board to turn on, and various Rose related occupations.

The week end will be entirely occupied with Monday first LEDzep presentation, which I expect to be amazing.

I took some time to make some equipment research (camera, LED, motors etc), and some sketches, maybe a bit imaginative with the scale, but the purpose was only to give an overall visual description of the project.

Structure sans le ballon Structure avec ballon

 

 

Cool stuff of the day : I just received five white 90cm latex balloons I ordered a few days ago in order to do some tests.  Each weights around 35g and inflates quite easily. Here it is, only inflated at two thirds of their maximum diameter, because my lungs were tired. It is closed using only a simple clothes peg. The bananas are for scale comparison

Latex balloon !

May the Git be with you

Hello World!

Today was an intense day! This morning, we heard some great presentations, and some of them have already helped me (ARM debugging). And this afternoon, Benjamin and I gave a presentation which turned out to be a 80 minutes course about Git. Definitely, the Force was strong with us today! I really enjoyed to give this presentation, not only because it involved a lot of Jedi and other Star Wars references, but mainly because I felt my fellow classmates extremely interested in the topic (and they were right, Git will be our greatest friend for the next two months!!). So thanks everyone for all your questions, it was a real pleasure to help you!

After that, I started the lab on the STM32 board. The first task was to configure the JTAG pins on the ARM processor. It may sound easy, but it was actually a real headache. Fortunately, by working all together and with a few hints from Sam, I managed to get a working configuration. Next time, I will light up a LED!

This week end, we have a lot to do for our project. Fortunately, the use cases are quite clear in our minds, as well as the global architecture. So we need to define our precise objectives, make the schedule, and prepare the slides for Monday presentation. No time to rest!

May the force be with you!

P.S. : the slides from the Git presentation are coming! Just need to fix a few things and we publish them.