RoseOnRails – Almost done with the LEDs

Hi everyone !

Short sum up of my tiring week.

On Monday morning, I finished the drill in our rails. Then, I start soldering for real until 00am. I continue on Thursday from 9am until 10pm.

On Wenesday and Thursday, I came back to the software part. I’ve made the UART worked on STM32F103RE and nRF51822. But without using the softdevice it seems that according to Benjamin and Felix posts there are some difficulties to make it works on nRF51822. I also look through the BlueLib in order to understand how it works and I’ve tried to update my knowledge with Valeh work on it.

Since Thursday night, we’ve seen that we’ve a lot problems some were coming from our soldering but others were due to the LEDs caracteristics which differed a bit. We’ve make a simple circuit with a transistor and a pull up resistance in order to raise the voltage of our data in the LEDs strips. We’ve know all our LEDs strip which are working properly. But, we’ve still to connect some of them and to add the alimentation.

From now we’re going to prepare monday’s presentation.

RoseOnRails – Hit the road Jack !

Hi everyone !

On Saturday, I worked on the nRF51822 and STM32F103RE and tried to make them communicate through. First, I’ve tried to make them communicate through UART internally. I’ve also looked through the reference manual of the nRF51822 and the SDK provided by Nordic. Since, I got a dongle BLE this week-end, I’ve also been able to test the BlueZ functions I’d spotted during my week in Warsaw. Next week, I’ll continue to work with BlueLib.

But on Sunday, the real work really started ! I recommend you to read Valeh and Noémie posts. But, the whole day from 10am till 11pm30 we’ve soldered our LEDs and drilled our rails. We’ll continue this work today.

RoseOnRails – Dis ease PCB

Hi everyone!

This week, I worked on the LED_PCB with Noémie. If we’ve any advice to share it would be these : when you’re placing your components I think you could first fix a ground plane, then position your components big components as your microchips, then put your decoupling capacitors the nearest possible from the GND and VCC pins they’re paired with. You should have at least one decoupling capacitors per pairs of pin GND and VCC. Then place your quartzs also the nearest possible from his pins on the microchip and surrounding by his decoupling capacitors. Concerning the JTAG you should turn the pin you’re going to connect on to the outside of your PCB. The voltage regulator could be a bit distant from your chip and surrounded by his decoupling capacitos. Concerning the nRF51822 you should read carefully the datasheet and Nordic website in order to follow their example to place correctly the balun and the antenna. Especially for the antenna which needs to be isolated and routed specifically.

I also come back on my work on the BLE. For the moment, I’ll focuse on the communication with the LED_PCB. First, I’ll establish the UART communication between the STMF103RE and the nRF51822.

Yesterday afternoon with Noémie, we’ve prepared the worksite to rebuild our rails with LEDs under it on Sunday. Pictures will come in Noémie’s next post. I guess everybody of the group will be working on it because we all seems to enjoy welding and building !

RoseOnRails – Return from Warsaw

Hi everyone !

Tiring and cold week in Warsaw, I hope this cold doesn’t make me too sick.

This morning I explore the datasheet of the four Hall captors we’ve at our disposal thanks to Alexis in Telecom. They have differents characteristics :

First, three kinds of them are General Purpose Chopper Stabilized Switches  (A112X) and one kind of General Purpose Stabilized Latches (A122X). The major differences between these kinds are shortly explained here :

Hall-effect switches are most commonly used in sensing absolute position, because they require a south pole of sufficient strength to turn the output on and then removal of that field to turn the output off. ”

Hall-effect latches are most commonly used in sensing multi-pole ring magnets for motor commutation, because they require a south pole of sufficient strength to turn the output on and a north pole of sufficient strength to turn the output off. ”

Others differences intrinsic to each classification are with me composant we’ve the hysteris function of the captor and if the sensor is mounted (LH package) or not (UA package).

The parts number we’ve have are :

Part Number             Operate Point(G)             Release Point (G)         Hysterisis(G)

A1120(LH)               <50 (typ 35)                   >5 (typ 25)                    Typical 10

A1121(UA)                 <120                                >40                                  >10 Typical 25

A1122(UA)               <205                                >105                                 >10 Typical 25

A1220(UA)               5 to 40                             -40 to -5                          Typical 45


G unit stands for 1 Gauss = 10^-5 Tesla.

With Gleison we’re going to test which is more convenient for us according to the magnetic field we received from the magnet under the rail.

Another urgent matter was on our agenda. Find another way than SPI in order to control our LED strips. We conclude following Sam advice we could control our LED strip by only using timers and GPIOs.

We’ve make one calculation :

Number of LEDs * time to refresh one LED + duration of the reset signal
900 *(1.25*24)+50 = 28.2 ms

The persistence of the vision is commonly evaluated to 1/25 second = 40 ms. So we should be able to refresh our fast enough using one thread on STM32.

Why are we using only one thread because if we were using multi-thread there would be some interruptions and the accuracy of the timing to control the LEDs wouldn’t be precise enough.

The STM32 we’re going to use is STM32F405RGT6 because he was already in the library on Expedition PCB and meets our needs (enough GPIOs, at least one timer, UART available to communicate with the nrf51822 on the same PCB). We also assume it would be better if we use PWM to have a processor frequency of at least 100MHz, in order to use for example a PWM clock frequency of 100MHz and a round number of ticks of 125. The difference of price with the last one (STM32F207VET6) which could have met our criteria was inferior to 2 euros.

I also start the schema of our LEDs PCB. Today we’re going to evaluate precisely how many GPIOs we’re going to use in order to place the corresponding number of pads on our LEDs’ PCB.


RoseOnRails – BlueZ

During this week I’m in Warsaw lot of activities were mandatory after the courses and during the week-end. I didn’t have a lot of time to work on our project.

But, I’ve tried to do a few things. First, I’ve flashed the program ble_app_proximity (provided as example in nRF51822 SDK). I was in charge of doing part of the software architecture of our project. But, others problematic related to the use of BLE occurred.

First we had to be sure that we don’t need any other microprocessor, in case the SoftDevice couldn’t support the use of an OS. It seems that the question has already been answered by Valeh. For my part I’ve looked how to use a stack BLE on Linux for our station central. I looked all around internet on Wednesday and it appears that BlueZ is probably the only one I found which is suitable but it is poorly documented and most of the code isn’t commented. BlueZ documentation

BlueZ isn’t specific for BLE so we’re going to use the library made by Paluche I’ll look through it very soon, it seems that we will have to implement the multi-slaves mode.

I’ve found some useful commands on stack overflow which could be used by others

$ hciconfig
Output :
hci0: Type: BR/EDR Bus: USB
BD Address: 00:01:02:aa:bb:cc ACL MTU: 1021:8 SCO MTU: 64:1
RX bytes:1000 acl:0 sco:0 events:47 errors:0
TX bytes:1072 acl:0 sco:0 commands:47 errors:0

//put the device in an up state
$ sudo hciconfig hci0 up
//configure the advertising data
$ sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10
// activate the advertising on the dongle
$ sudo hciconfig hci0 leadv O
//the above command makes the advertised service connectable. If you don’t want to allow connections, change it to :
$ sudo hciconfig hci0 leadv 3
// disable advertising
$ sudo hciconfig hci0 noleadv

Sample commands :
hcitool lescan
hcitool lecc
gatttool -b <Mac Address> –primary
gatttool -b <MAC Address> –characteristics
gatttool -b <MAC Address> –char-read
gatttool -b <MAC Address> –char-desc
gatttool -b <MAC Address> –interactive
gatttool -b <MAC Address> –listen
Sample functions :
gatt_service_add(adapter, GATT_PRIM_SVC_UUID, 0xFFFF,
/* Char 1 */
GATT_OPT_CHR_VALUE_CB, ATTRIB_READ, read_func_callback,

/* Char 2 Define here */

/* Char 3 Define here */




Hi everyone !

Today was a hard day with the communication challenge and yesterday also because I spent the whole afternoon in order to configure my connection TCP/IP and to generate telecom paristech’s website in my shell.

Starting from tomorrow my group and I are back on our rails.

See you

RoseOnRails and STM32

Hi everyone!

Monday, Noémie and I worked on our LEDs and on the magnetic we could us to detect the position. Some things to remember from this day. We order 30m of  LED strip which represent 900 LEDs ! We’ll receive these strips by 7 days. Concerning the Hall effect, we’ve learnt there are two kinds of sensor : one which detect a tension proportional to the amount of current we put through our coil and the other is kind of binary which detect when a threshold is reached. We’re going to use this last type in our train to identify above which coils is our train by modulating the current we’ll transmit binary identifiers.

Concerning my lab work I’d almost finished the serial port over usb on Monday and confirmed it was working properly by doing some tests with the shell implemented through the serial port. I’ve also had the possibility to turn on and off the buzzer through the shell.

Currently, I’m trying to implement the possibility to make a TCP to a web server on my board. I’m also looking through some documentation in order to take part in the conception of my group’s PCBs.

RoseOnRails – LED’s go

Hi everyone !

After giving a rather precise definition of our project, we’re going to start concrete very soon. Because we’re going to order our first meter of LED strip for the beginning of the next week, in order to make some test which will include : the incorporation of the strip under the rail, the control of each LEDs of the strip and even try to modulate the light in order to evaluate if we can detect the train position thank to the LEDs. Even if for this last point, others constraints have to be taken into account such as the reflection of the light on the rails or on the train’s wheels .

Noemie is going to detailed in her post the kind of LEDs (WS2812) we’re going to use she has found some explanations on it, which enables to confirm that the model of Strip LEDs I’d found on AliExpress website is almost equivalent to the model on Adafruit website.

I’ve also made some research about the detection by Hall effect, this website explains that we can measure with a Hall effect sensor a tension proportional to the electric current we put through our coils. I’ve found Hall effect sensor we could put under our train. But I still have to find the kind of (little) coils we’re going to use to generate a modulated magnetic field.

The use of the potentiometer is now implemented on my lab work. I started to implement the serial port over USB but I need to find some tests in order to be sure it’s working properly.

I’ve also tried to install the tool-chain in order to use the BLE evaluation kit we’ve received on Friday. I follow the procedure of the manual user guide but I’ve some troubles with Keil and JLink. I recommend the other to look into the link Benjamin has posted yesterday first.

RoseOnRails – Answering some doubts

Hi everyone!

This week my group and I had some questions to answer in order to best define our project.

First, let’s see a schema of our project :

Schéma de notre projet

As we can see we proposed that our Central Station be composed of a Raspberry Pi with a Dongle BLE. This way we can offer a built in product at the end of our project. Even if in the first part we will work from an usual computer.

Regarding the BLE communication

According to the document Creating Bluetooth Low Energy Applications using nRF51822 provided with the evaluation kit of Nordic, we assumed that our PCBs will first advertise in order to enable the Central to connect to them. (cf “For a Central to be able to connect to a Peripheral, the Peripheral must be advertising.”)

Then, they will be in connected mode even if the PCB is able to decide to ignore some connection intervals in order to reduce the consumption of energy. ( cf “However, if current consumption is important and a Peripheral has no data to send, it can choose to ignore a certain number of intervals.”)

On Friday, Noemie and I have made some research in order to fine a LED strip which fits to our needs. We’ve found this one which enable us to control each LED easily. We still have to make some precise calculation in order to know if we can modulate the light fast enough to enable the train to detect his position. A first rough calculation made us think it’ll be too short.

So on Alexis’ advice we are going to look for an other kind of detection. Theses ones would be composed of coils which are going to emit a modulate magnetic field and the train will have a Hall sensor.

We’ve a to find an equivalent of this a bit cheaper on Alibaba website because we measured that we have almost 28 meters of rails to cover.

I’ve also enjoyed the Friday labwork with my first exercise on PCB and I hope we’ll soon manage to make our PCB.


RoseOnRails – Gantt Diagram

Today, we’ve finished the second version of our PSSC. We’ve made a Gantt Diagramm, which includes four groups : the central station and the users, the train, the LEDs and the shuntings. Don’t hesitate to zoom on the picture.

Diagramme de Gant PSSC