[LASMO] Making progress in PCB, basic I/O functions

Hi! Last week has been mostly about PCB design. We’re still waiting for our galvanometers and lasers to arrive… Hopefully we’ll have them soon. In the meantime we can’t make much progress about the PCB itself but we corrected some problems.

About the input of the galvanometers, I made a mistake in the voltage adaptation circuit: when the scanner is at its maximum angle, it should be either at -5V/5V or 5V/-5V (positive input/negative input). So we had to adapt the system so that when the ADC outputs 0V, it outputs -5V/5V; when 3.1V (max) 5V/-5V; when 1.55V, 0/0. That means we have to change the resistors values: R1 = 1kΩ, R2 = 2.21kΩ. As Mr Polti pointed out, we also have an issue with the component used: the ADA4941-1 has an output voltage swing of +/-2.9V, which isn’t enough to generate the desired signal. So we decided to make our own adaptation circuit with two ampops that will have the good characteristics (for example, the ADA4666-2 works). The circuit is as follow:

Voltage amplification circuit for scanner input

Meanwhile, I also worked a bit on coding the basic I/O functions of the main controller: I started with connecting the SD slot, testing my code on the development boards we use in practical works this year, OLIMEX STM32-E407. I haven’t been able to test it though, as the only microSD card I have is the on in my smartphone, and I failed to get it out of the phone.  

[LASMO] PCB progress

Externals Clocks

In my previous article, I talk about the STM32F7’s and the STM32F1’s clock.  However, according to the STM32CubeMX and after talked with Alexis, we will use for each controller a 8MHz external clock (for consumption questions) and rise the frequency using the PLL until 216 MHz for the STM32F7 and 72MHz for the STM32F103. According the oscillator design guide for STM32, we have 

with CL the load capacity of the clock wich is 18pF here and Cs the stray capacitance of the printed circuit board and connections wich is 10pF here. So, we have the construction for each controller : 

Also, we have a ESP32devKitC which don’t must to have an external clock because the ESP32 WROOM integrated has one.

XLR connection

We also work an the XLR connection but due to the phantom and the symetrisation we had some problem with the architerture, so we decided to use a jack connector. We talked about an architecture but we change again for RCA connectors which Pierre will talk about.   

DAC to LASER 

The drivers of the laser work with a balanced analog input ranging from 0 to 5V. Since the DAC of the MAX outputs a single-ended signal ranging from 0 to 3.3V , this is an issue we had to resolve. 

We basically had to convert an analog single-ended signal to a other one, and amplify it with a 5/3.3 ratio. We achieved this by using an ADA4500-2 amplifier with two resistances, as represented below.

This circuit is composed of a non-inverting amplifier (taking the out of the MAX5105 as entry), which, with the resistances of 1kΩ and 1.96 kΩ, multiplies the signal by 1+1/1.96 = 1.51 = 5/3.3 (approximately). Then an inverting amplifier with a gain of 1, create aa signal which is going to the input of the laser

After talking with Sam, we decided to delete the DAC_OUT signals from the MAX5101  to the F103 microcontroller because their are not essential. So, we configure the HREF of the MAX5101 at 5V, and not at 3.3 V. So, we don’t need this architecture for the lasers’ inputs.

Project architecture

We also decided about the architecture of our project and about the workflow. I put the configurations files of the STM32F4 controller that we use in TP in order to begin to code with the board that we have. Let’s begin !

[LASMO] SD card and galvanometers in the PCB design

Because finishing the design of the PCB is now the priority task, I’ve been working on several parts of it: namely, linking the SD card connector and the galvanometer drivers.

MicroSD connector

The microSD card connector we found in ExpeditionPCB is manufactured by JAE (Japan Aviation Electronics). The pins correspond to those of the microSD standard and are linked to one of the SPI interfaces available on the STM32F7. MicroSD cards can work on supply voltage from 2.7 to 3.3V, so we just use the same 3.3V supply as the F7.

Our SD card connector’s connections…
… and the pins it’s connected to on the F7 

Galvanometer drivers

The drivers of the galvanometer work with a balanced analog input ranging from 0 to 5V. Since the DAC of the F7 outputs a single-ended signal ranging from 0 to 3.1V (according to the datasheet), this is an issue we had to resolve.

We basically had to convert an analog single-ended signal to a balanced one, and amplify it with a 5/3.1 ratio. We achieved this by using an ADA4941-1 amplifier with two resistances, as represented below.

Signal adaptation circuit between the DAC’s single-ended output (GALVA_X signal) and the driver’s balanced input (GALVA_DRIVERX_IN – and +). The two resistors inside the ADA are of the same value.

This circuit is composed of a non-inverting amplifier (taking IN and FB as entry), which, with the resistances of 10kΩ and 6.2kΩ, multiplies the signal by 1+3.1/5 = 1.62 = 5/3.1 (approximately). Then a inverting amplifier with a gain of 1, create a signal symmetric to the OUTP signal with respect to the REF signal value. We set REF at 5V so that the signal can have a 5V range around the offset value of 5V. That’s also why we linked the REF signal to the GND port of the driver, so that the driver can see the signal as a balanced signal.

[LASMO] External clocks, and XLR architectures

For the two processors STM32F7 and the STM32F1, we need to use externals clocks. Indeed, for the STM32f7, the processor can use a 16MHz internal clocks, but in order to have the best performance STM32F7 can provide, we will add an external clock of 26 MHz. We will do the same for the STM32F1, but with an external clock of 16 MHz.

Also, we will use two XLR connections in order to have a sound signal wich the animation will be synchronize with. After find out about XLR connection and signals, I understood that a connector XLR has 3 pins, carry at 24 V, and receive two symetrics signals but out-of-phase. So, we have to desymetrize the sygnal. To this end, we will use an instrumentation amplifier: 

with

[LASMO] First try at FreeRTOS

I didn’t have much time last week to work on the project due to the Athens week. I had a wonderful time in Prague but I wasn’t able to work on the project.

On these last days I’ve been focusing on trying to make FreeRTOS work on a STM32F4xx development card, i. e. making the official demo for this board work. Sadly, the official demo is actually designed to be compiled with the IAR compiler, and we’d rather use GCC for our project instead  of a trial version of some non-free compiler. I’ve found a demo using GCC and a makefile on the Internet, but for some reason, once compiled using GDB will work even if the GDB server isn’t launched, which makes me think the Makefile already opens one (which is not good because it is not launched on our board). I’ll try for the next time to have a  more deeply understanding of how a FreeRTOS program works, and I’ll try to fix that issue.

[LASMO] Started PCB design

This week, I start to draw the design of the PCB.
I start to add the main components of the PCB, and decide the exact references we need :

  • For the STM32F7, all references available on the ST website are suitable, so I choose the one that was already in the Xpedition PCB library, the STM32F767vit6
  • For the ESP32, Luc choose the ESP32-WROOM-32: it has an embedded Wi-Fi antenna, an RMII interface for the ethernet, and an SPI interface to communicate with the STM32F7
  • For the security microcontroller, I choose the STM32F103RE. This MCU has to integrate 5 ADCs, one GPIO and an SPI interface. So, a very small STM32 MCU is enough.
  • For the triple 8bits-DACs, I change the MAX512 to a MAX5105 because the MAX512 don’t integrate three equal DACs. Moreover, the MAX5105 has an asynchronous MUTE input, which is convenient for the stop of the LASERs by the security MCU

Then, I work on the Ethernet connection. I add a LAN8742A and an RJ45 connector to make the physical layer. I never made design PCB, so I spent a lot of time to find and understand the different components to add to the design.

After finishing the Ethernet design, I work on the MAX5105 connections. This part was easy to make, but I’m not sure about the direct connection (cf figure 1) between the DACs’ outputs and the inputs of LASER drivers. I don’t have the LASER documentation yet, so it’s confusing for me to know how correctly connect these two parts.

(figure 1) MAX5105 connections

This is the newest version of our main components implementation :

[LASMO] Specifications

We have redefined the differents specifications of our project. To resume, LASMO is a displayer of a laser show. It will be able to display 2D ans 3D ILDA animations. All ILDA formats are supported. LASMO can display until 30 Kpps/s (at +/- 20° otpical) with a resolution of 4096 * 4096.  We use a RGB LASER in order to display until 16 millions colors.

Moreover, 3D animations are projected so that it looks 3D form from a certain point of view. This way, ILDA animations can be streamed either from internal memory (SD card) of from a PC via Wi-Fi or Ethernet.
Also, LASMO implement Art-NET protocoL in order to be controled by a standart light show controler thanks to Ethernet. So, it will be possible to synchronize on beat from stereo XLR input.

Furthermore, thanks to a picture, LASMO will be able to correct a deformed animation on a surface depending on the picture’s point of view and project a new one corrected always depending on this point of view.

[LASMO] Git workflow and beginning with FreeRTOS

In 2 days, we defined the architecture of our project and most notably, we establish that we’ll be using 3 microcontrollers: a main controller from the STM32F7 family, a smaller one from the STM32F3xx family, whose main purpose will be to switch off the laser when it doesn’t move to comply with security norms, and an ESP32 for the network.

It seemed then logical to try and begin learning to use FreeRTOS, as we were used to work with ChibiOS in practical courses. That’s why I copied a demo for STM32F4xx cards, which we happen to have used during the practical works. In the next week I’ll try to learn how the kernel works in order to set up a SPI interface and maybe, if I have the time, a code to access an SD card, using the STM32F4xx. The code will be eventually reused on our final STM32F7 if functional.

We chose to use the “GitHub workflow” because it’s simpler. The “Merge Request” feature of GitLab will help us apply this flow well.

[LASMO] Main components architecture

The LASER and the scanner were chosen : a LASER RGB of 1W and a scanner with a speed of 30 Kpps. They came from laboutiquelaser.fr, a French website. We are waiting for the technician’s answer for the availability of the LASER and a real documentation of each component. 

The choice of these two components allow us to define the main architecture of the project :

Main components’ architecture

The main controller is a STM32F7 family. On this micro-controller we will :

  • Use two DAC of 12 bits to control the scanner
  • Use two ADC of 12 bits to get a stereo input line ( in order to synchronize the animation with a sound beat )
  • Communicate with a SD card 
  • Communicate with ESP32, STM32F3 and MAX512 with SPI protocol

The network controller is an ESP32. It will allow us to communicate with LASMO over Ethernet or Wi-Fi. It will integrate a HTTP server to provide us a web app in order to control LASMO.

The MAX512 is a triple 8 bits DAC. It will be able to control the LASER with 3 analog inputs (RGB). This information have to be confirmed, we don’t have yet the documentation of the LASER. In case the input is not analog, the MAX512 component will be removed.

The STM32F3 is a micro-controller whose solely role is to comply with security norms : indeed, the LASER can’t be turn on more than 25 ms on the same position. The security controller monitors the return position signal of the galvanometers and force the laser inputs signals to zero if the galvanometers don’t move enough.

[LASMO] Storage devices

LASMO will need to get data from the storage devices where the animations will be stored. For that reason, we need to add to our PCB a USB connector and a SD connector, as well as identify the electrical needs of the devices once connected and active. So I looked for what kind of SD cards and USB drives were fitted for LASMO. (streaming of  ILDA files). Thanks to Pierre, we know that we’ll need a debit of approximately 500 kbps.

SD card

SD cards are divided in 3 categories according to their storage capacity, and are granted a speed class among 11 possibles. 

https://www.sdcard.org/developers/overview/speed_class/

According to this table, all the speed classes on the market are fitted for the application.

As for power supply, it is kind of standardized. Indeed, accessing SD cards with an SPI bus requires a voltage of 3.3V. After looking at the cards available for example on Mouser, the typical supply current is between 30 mA and 100 mA. 

USB drive

Thanks to the presentation on USB we had a moment ago, we know that USB 2.0 and USB 3.0 deliver theoritical debits up to 480 Mbps and 5Gbps respectively. That is largely enough for what we need.

We had arguments over which type of connector will be the best (between USB-A and USB-C) . We finally decided to go with the most common (for the moment) USB-A.

As for the power supply, if the voltage is almost always 5V, the current does change with the version of the protocol: maximum 500 mA for USB 2.0 and  maximum 900 mA for USB3.0.