Difference between revisions of "Hub Sensor"

From 'Engineers of Innovation Wiki'
Jump to navigation Jump to search
(Created page with "The hub sensor is an AS5047 magnetic encoder mounted behind the Lehner BLDC motor inside the rudder. The hub sensor communicated the position of the rotor to provide a reference position to the motordriver during startup. == Architecture == thumb|Scope screen of the RS422 in blue and SPI from the VESC. Showing the timing of the various data transfers The hubsesnor is build around two PCBs, one that connects to the VESC and the othe...")
 
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
== Architecture ==
== Architecture ==
[[File:250525135749 Scope Screen.png|thumb|Scope screen of the RS422 in blue and SPI from the VESC. Showing the timing of the various data transfers]]
[[File:250525135749 Scope Screen.png|thumb|Scope screen of the RS422 in blue and SPI from the VESC. Showing the timing of the various data transfers]]
The hubsesnor is build around two PCBs, one that connects to the VESC and the other that sits behind the motor. These boards are build around the atxmega16e5 and communicate with each other though RS422. The bottom board reads out the AS5047 and NTC and sens this data to the top over serial at 1.5 Megabaud. This link is quite fast to be able to send this data at the sample rate of the VESC at around 12kHz. The data and power to the hub sensor are separated with functional isolation to make sure the top electronics are protected from water Ingres and shorts.  
The hubsesnor is build around two PCBs, one that connects to the VESC and the other that sits behind the motor. These boards are build around the atxmega16e5 and communicate with each other though RS422. The bottom board reads out the AS5047 and NTC and sens this data to the top over serial at 2 Megabaud. This link is quite fast to be able to send this data at the sample rate of the VESC at around 12kHz. The data and power to the hub sensor are separated with functional isolation to make sure the top electronics are protected from water Ingres and shorts.  


== Startup and Timing Behavior ==
== Startup and Timing Behavior ==
Line 10: Line 10:
== VESC tool ==
== VESC tool ==
[[File:Vesc.png|thumb|VESC tool showing a counter value that has been generated on the hub PCB for testing. small steps in the data can be seen for unknown reason]]
[[File:Vesc.png|thumb|VESC tool showing a counter value that has been generated on the hub PCB for testing. small steps in the data can be seen for unknown reason]]
The encoder was tested using VESC tool and a counter value generated at the bottom hub PCB. The data transmission is quite reliable without a motor attached, a spike o0f 360 degrees can be seen every 10 minutes as of git hash "51da04c". DMA on the RX UART could ease the timing requirements on the top board and perhaps reduce this.
[[File:Vesc tool.png|thumb|Showing the hub sensor with magnet data. Note the noise on the right side when the magnet is removed]]
The encoder was tested using VESC tool and a counter value generated at the bottom hub PCB. The data transmission is quite reliable without a motor attached, a spike of 360 degrees can be seen about every 10 minutes as of git hash "b45a45a" .DMA on the RX UART could ease the timing requirements on the top board and perhaps reduce this.
 
== Future Tests and Features ==
Some additional features or tests that could be implemented or done in the future:
 
* Actually test on the VESC 300/75
** Currently only tested on the UBOX 75 v2
*Test with high currents though the motor cables next to the data
* Implement error detection when for instance no magnet is found
** Perhaps set the parity bit wrong on the top to let the VESC know there is only garbage
* Check the temperature sensor accuracy
** We send the ADC values at the bottom as is to the top DAC. The idea is that we set the same voltage as measured at the bottom with the same resistor divider that's used on the VESC. We havent checked if this actually measures the temperature correctly

Latest revision as of 13:16, 25 May 2025

The hub sensor is an AS5047 magnetic encoder mounted behind the Lehner BLDC motor inside the rudder. The hub sensor communicated the position of the rotor to provide a reference position to the motordriver during startup.

Architecture

Scope screen of the RS422 in blue and SPI from the VESC. Showing the timing of the various data transfers

The hubsesnor is build around two PCBs, one that connects to the VESC and the other that sits behind the motor. These boards are build around the atxmega16e5 and communicate with each other though RS422. The bottom board reads out the AS5047 and NTC and sens this data to the top over serial at 2 Megabaud. This link is quite fast to be able to send this data at the sample rate of the VESC at around 12kHz. The data and power to the hub sensor are separated with functional isolation to make sure the top electronics are protected from water Ingres and shorts.

Startup and Timing Behavior

The top and hub MCUs share the same flash image so they are easy to update and their protocol is always in sync. During boot the flash of the hub MCU is cleared and it waits for a copy of the top MCU's flash. If this is successful the top green LED will blink every second in three quick bursts. During running this LED should be blinking continuously. If there is no data from the bottom board for 8ms the top board will reboot the hub and send another flash config, blinking of the red LED will occur during.

VESC tool

VESC tool showing a counter value that has been generated on the hub PCB for testing. small steps in the data can be seen for unknown reason
Showing the hub sensor with magnet data. Note the noise on the right side when the magnet is removed

The encoder was tested using VESC tool and a counter value generated at the bottom hub PCB. The data transmission is quite reliable without a motor attached, a spike of 360 degrees can be seen about every 10 minutes as of git hash "b45a45a" .DMA on the RX UART could ease the timing requirements on the top board and perhaps reduce this.

Future Tests and Features

Some additional features or tests that could be implemented or done in the future:

  • Actually test on the VESC 300/75
    • Currently only tested on the UBOX 75 v2
  • Test with high currents though the motor cables next to the data
  • Implement error detection when for instance no magnet is found
    • Perhaps set the parity bit wrong on the top to let the VESC know there is only garbage
  • Check the temperature sensor accuracy
    • We send the ADC values at the bottom as is to the top DAC. The idea is that we set the same voltage as measured at the bottom with the same resistor divider that's used on the VESC. We havent checked if this actually measures the temperature correctly