https://wiki.satnogs.org/api.php?action=feedcontributions&user=Jenniferhe2529&feedformat=atomSatNOGS Wiki - User contributions [en]2024-03-28T20:56:28ZUser contributionsMediaWiki 1.32.0https://wiki.satnogs.org/index.php?title=SatNOGS_Rotator_Controller&diff=2785SatNOGS Rotator Controller2019-11-28T07:49:33Z<p>Jenniferhe2529: /* Build sequence */</p>
<hr />
<div>{{Template:Development<br />
|Name= SatNOGS Rotator Controller<br />
|image= Rotator controller v2.jpg<br />
|type= Rotator Controller for SatNOGS rotator.<br />
|cost= 60-80€<br />
|status= Working<br />
|latest-release-name= -<br />
|latest-release= v2.2<br />
|source-repo= [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-controller satnogs-rotator-controller - GitLab]<br />
[https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-controller-encoder satnogs-rotator-controller-encoder - GitLab]<br />
|documentation= https://wiki.satnogs.org/index.php?title=SatNOGS_Rotator_Controller SatNOGS wiki<br />
}}<br />
<br />
==Intro==<br />
SatNOGS Rotator Controller refers to the set of electronics designed to operate a SatNOGS Rotator. There have been multiple iterations of the rotator controller design, but the modularity of the approach enables operations between different versions of the controller and the rotator.<br />
Since the start of 2016, the rotator controller design is able to facilitate a DC-motors or stepper-motors rotator design. We intend to keep this modularity for the electronics and firmware design to facilitate the variety of build by our community.<br />
<br />
==Rotator Controller v2==<br />
<gallery><br />
Pcb_schema_v2_revC.png<br />
Pcb_board_v2_revC.png<br />
</gallery><br />
<br />
The PCB are tested in this [https://network.satnogs.org/stations/9/ ground station]. <br />
<br />
===Features===<br />
<br />
*It is designed to fit the entire electronics needed to control rotator in Euroboard 80x50 mm.<br />
*Main micro-controller is [https://store.arduino.cc/arduino-pro-mini Arduino pro-mini], [https://github.com/sparkfun/Arduino_Pro_Mini_328 SparkFun's Arduino Pro Mini 328] dev-board with ATmega328p.<br />
*The modular design includes plug-in either [https://www.pololu.com/product/2133 DRV8825]/[https://www.pololu.com/product/1182 A4988] or [https://www.pololu.com/product/1213/resources DC motor drivers] (MC33926).<br />
*The power supply in embed in the same board in contrast with previous version.<br />
*Filtered power supply of micro controller.<br />
*An I2C multiplexer is used to connect I2C encoders AS5601 (same ID) to get position feedback for each axis.<br />
*A temperature sensor TC-74 monitoring the temperature inside the controller box in order to protect them from over-heating.<br />
*There are some spare dev-pins in order to connect other peripherals like IMU or an LCD display.<br />
*Pins with integrated RC-Low Pass filter for end-stops connection.<br />
*Default communication interface is RS-485 but it can also be used as a UART.<br />
*Using different paths for digital and power (motors) GND.<br />
*Electrolytic capacitor and TVS-diode in PSU input<br />
*Flashed either by using UART or ISP header<br />
<br />
===Build sequence===<br />
<br />
*Make sure you have a [[SatNOGS Rotator v3|mechanical assembly]] of the rotator constructed and ready<br />
*Buy the PCB. [https://oshpark.com OshPark],[https://www.seeedstudio.com/fusion_pcb.html Seeed Fusion][https://www.pcbway.com PCBWay.com], [http://dirtypcbs.com DirtyPCBs.com], [https://www.elecrow.com/ Elecrow], [https://www.makerfabs.com Makerfabs] have been used in the past with good results.<br />
**You can order the v2.2 of the board directly using [https://oshpark.com/shared_projects/w0s8d4OJ this OSHPark link] or [https://dirtypcbs.com/store/designer/details/6933/5904/satnogs-v3-motor-controller-zip this DirtyPCBs link].<br />
**You can order the v1.0 of the rotary encoder board using [https://oshpark.com/shared_projects/I3b8SCci this OSHPark link]<br />
**You can order PCB as well as [https://www.seeedstudio.com/prototype-pcb-assembly.html PCB Assembly service] from Seeed Studio<br />
*Get all the necessary components according to BOM from latest tag (or the version that you want to build), [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-controller/tags Gitlab Tags]<br />
*Assemble the PCB, by soldering the components<br />
*Burn the firmware<br />
*Using the wiring diagram, connect the controller to the Rotator<br />
*You are ready! Proceed with testing<br />
<br />
<br />
====Assembly Guide====<br />
<br />
[[File:H1000_aluminium_enclosure.png|thumb|center|800x420px|alt=|Rotator Controller - Drill holes]]<br />
[[File:Rotator_controller_sheet1.png|thumb|center|800x420px|alt=|Rotator Controller sheet 1/2]]<br />
[[File:Rotator_controller_sheet2.png|thumb|center|800x420px|alt=|Rotator Controller sheet 2/2]]<br />
<br />
====Microcontroller====<br />
<gallery mode="packed" heights="250px"><br />
Uc.png|Microcontroller<br />
Uc_orientation.png|Microcontroller Orientation<br />
I2c_pullup.png|I2C pull-up resistors<br />
</gallery><br />
<!-- changed at feb.25th 2018<br />
{|<br />
[[File:Uc.png|thumb|320x240px|Microcontroller]]<br />
|<br />
[[File:Uc_orientation.png|thumb|320x240px|Microcontroller Orientation]]<br />
|<br />
[[File:I2c_pullup.png|thumb|320x240px|I2C pull-up resistors|left]]<br />
|}<br />
<br clear="all"/>--><br />
<br />
The main micro-controller of the board is arduino pro-mini 5V@16MHz, ATmega328P.<br />
The +5V of the controller are produced from arduino pro-mini.<br />
Some clones do not use correct parts in LDO, like the original one, with<br />
result, when it powers up with +12V, burned.<br />
<br />
Some examples, <br />
<br />
*[https://community.libre.space/t/v2-controller-board-magic-smoke/1878 SatNOGS Community]<br />
*[http://westsideelectronics.com/blew-up-a-cheap-arduino-pro-mini-clone/ West Side Electronics]<br />
<br />
One Solution is not use clones, use [https://www.sparkfun.com/products/11113# Sparkfun's arduiuno pro-mini 5V@16MHz, ATmega328P]. <br />
The second solution is to add a LDO, like [https://gr.mouser.com/datasheet/2/268/mic5205-778789.pdf MIC5205] (maybe in a new revision of v2).<br />
<br />
The power consumption in +5V is:<br />
<br />
{| class="wikitable"<br />
|-<br />
!-<br />
!QTY.<br />
!VCC(V)<br />
!IDD(mA)<br />
!Total(mA)<br />
|-<br />
|AS5601<br />
|2<br />
|5<br />
|6.5<br />
|13<br />
|-<br />
|PCA9540B<br />
|1<br />
|5<br />
|0.1<br />
|0.1<br />
|-<br />
|SN65HVD485E<br />
|1<br />
|5<br />
|2<br />
|2<br />
|-<br />
|TC74<br />
|1<br />
|5<br />
|0.35<br />
|0.35<br />
|-<br />
|arduino pro mini<br />
|1<br />
|5<br />
|20<br />
|20<br />
|-<br />
|MC33926<br />
|2<br />
|5<br />
|0.2<br />
|0.4<br />
|-<br />
|DRV8825<br />
|2<br />
|5<br />
|0.1<br />
|0.2<br />
|}<br />
<br />
The LDO MIC5205 guaranteed 150mA output, for Stepper motors ~35-40mA, for DC motors ~35-40mA.<br />
<br />
====Motor Drivers====<br />
=====Stepper motor driver=====<br />
[[File:Stepper_2.png|thumb|320x240px|Stepper motor driver]]<br />
[[File:Stepper_1.png|thumb|320x240px|Jumpers]]<br />
[[File:Stepper_orientation.jpg|thumb|320x240px|Orientation]]<br />
<br />
For the stepper motor driver 2 options have been tested, [https://www.pololu.com/product/2133 DRV8825] and [https://www.pololu.com/product/1182 A4988].<br />
For both options it is necessary to solder:<br />
<br />
*2 electrolytic capacitors C3, C4 100uF<br />
*4 single 0.1" male connectors for U3, U4<br />
*2 fixed terminal blocks P7, P8, Amphenol-VI0421550000G<br />
*6 jumpers to adjust the micro-step, '''default option is Full Step'''<br />
<br />
Note: [https://hackaday.com/2016/08/29/how-accurate-is-microstepping-really/ Guide for microstepping selection]<br />
{| {{table}}<br />
| align="center" style="background:#f0f0f0;" |'''JP3/JP6'''<br />
| align="center" style="background:#f0f0f0;" |'''JP2/JP5'''<br />
| align="center" style="background:#f0f0f0;" |'''JP1/JP4'''<br />
| align="center" style="background:#f0f0f0;" |'''Microstep Resolution'''<br />
|-<br />
| align="center" style="background:#f0f000;" |'''Low'''|| align="center" style="background:#f0f000;" |'''Low'''|| align="center" style="background:#f0f000;" |'''Low'''|| align="center" style="background:#f0f000;" |'''Full step'''<br />
|-<br />
| align="center" |'''High'''|| align="center" |'''Low'''|| align="center" |'''Low'''|| align="center" |'''Half step'''<br />
|-<br />
| align="center" |'''Low'''|| align="center" |'''High'''|| align="center" |'''Low'''|| align="center" |'''1/4 step'''<br />
|-<br />
| align="center" |'''High'''|| align="center" |'''High'''|| align="center" |'''Low'''|| align="center" |'''1/8 step'''<br />
|-<br />
| align="center" |'''Low'''|| align="center" |'''Low'''|| align="center" |'''High'''|| align="center" |'''1/16 step'''<br />
|-<br />
| align="center" |'''High'''|| align="center" |'''Low'''|| align="center" |'''High'''|| align="center" |'''1/32 step'''<br />
|-<br />
| align="center" |'''Low'''|| align="center" |'''High'''|| align="center" |'''High'''|| align="center" |'''1/32 step'''<br />
|-<br />
| align="center" |'''High'''|| align="center" |'''High'''|| align="center" |'''High'''|| align="center" |'''1/32 step'''<br />
|-<br />
|}<br />
<br />
*Do'''NOT''' solder 2 resistors 100k, R4, R7 in default configuration (full step)<br />
*If you have A4988 for stepper motor drive and you want to use micro stepping, when the MS1 is HIGH<br />
<br />
it is necessary to solder R4, R7 according to [https://www.pololu.com/product/1201 A4983 Stepper Motor Driver Carrier, Step (and microstep) size].<br />
<br />
In case of DRV8825, all pins MS1, MS2, MS3 have internal pull-up resistor.<br />
<br />
Also it is necessary to update the definitions in [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware/blob/master/stepper_motor_controller/stepper_motor_controller.ino firmware], according to microstepping selection.<br />
Example:<br />
<br />
*Step Angle: 1.8 deg<br />
*Microstep: 1/8 step<br />
*Steps per Revolution: (360/1.8)*8 = 1600<br />
<br />
That means:<br />
<br />
#define MICROSTEP 8 ///< Set Microstep<br />
#define MAX_SPEED 6400 ///< In steps/s, consider the microstep<br />
#define MAX_ACCELERATION 1600 ///< In steps/s^2, consider the microstep<br />
#define SPR 1600L ///< Step Per Revolution, consider the microstep<br />
<br />
It is necessary to change the maximum speed and acceleration according to new SPR.<br />
<br />
An example:<br />
<br />
The speed = 300steps/s and acceleration = 100steps/s^2 with<br />
<br />
*1.8 deg/step stepper motor<br />
*full step<br />
*gear ratio 54<br />
<br />
means speed = 10deg/s and acceleration = 3.3deg/s^2 according to this [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware/blob/master/stepper_motor_controller/stepper_motor_controller.ino#L224 function]. <br />
<br />
Be careful:<br />
<br />
*[http://reprap.org/wiki/Pololu_stepper_driver_board adjust the current (current limiting) for stepper motors]<br />
*add a heat-sink.<br />
*plug the stepper motor drivers<br />
<br />
The stepper motor that is used, is [https://www.omc-stepperonline.com/hybrid-stepper-motor/nema-17-bipolar-59ncm-84ozin-2a-42x48mm-4wires-w-1m-cable-and-connector-17hs19-2004s1.html Nema 17 Bipolar 59Ncm], <br />
<br />
*Size: &#9649;42 x 48 mm<br />
*Weight: 390 g<br />
*Shaft diameter: 5 mm<br />
*Step Angle: 1.8 deg<br />
*Nominal speed @ 12V: 720deg/s<br />
*Rated Current/phase: 2.0A<br />
*Stall torque @ 12V: 0.59Nm<br />
<br />
=====DC motor driver=====<br />
[[File:Dc_motor_driver.png|thumb|320x240px|DC motor driver]]<br />
<br />
It is necessary to solder: <br />
<br />
*Solder U6 with 0.1" female connectors as shown in picture<br />
*Solder 2 pads in yellow circle by using ~1mm diameter wire<br />
*Solder 2 2-pin 3.5mm terminal blocks for 2 DC motors<br />
<br />
The DC motor controller is [https://www.pololu.com/product/1213 Dual MC33926 Motor Driver Carrier]<br />
<br />
*Motor driver: MC33926<br />
*Motor channels: 2<br />
*Minimum operating voltage: 5V<br />
*Maximum operating voltage: 28V<br />
*Operating voltage: 12V<br />
*Continuous output current per channel: 2.5A<br />
*Current sense: 0.525 V/A<br />
*Maximum PWM frequency: 20 kHz<br />
*Operating PWM frequency: 3921.5Hz (~4kHz)<br />
*Minimum logic voltage: 2.5V<br />
*Operating logic voltage: 5V<br />
*Maximum logic voltage: 5.5V<br />
<br />
The DC motor that we use is [https://www.pololu.com/product/1104 50:1 Metal Gearmotor 37Dx54L mm], <br />
<br />
*Size: 37D x 54L mm<br />
*Weight: 195 g<br />
*Shaft diameter: 6 mm<br />
*Free-run speed @ 12V: 200 rpm<br />
*Free-run current @ 12V: 300 mA<br />
*Stall current @ 12V: 5000 mA<br />
*Stall torque @ 12V: 1.2Nm<br />
<br />
<br clear="all" /><br />
<br />
====Communication====<br />
Note: For both options the firmware is the same.<br />
=====''UART''=====<br />
[[File:Jumper.png|thumb|320x240px|UART Jumpers]]<br />
[[File:Rs 485.png|thumb|320x240px|Pin Header]]<br />
<br />
To use UART:<br />
<br />
*solder JP7 and JP8<br />
*solder pin header 0.1" female connector<br />
*not solder C1, U2, R18, R19 R9, R8, R1, D3<br />
*A is TX and B is RX<br />
<br />
=====''RS-485''=====<br />
[[File:RS485_solder.png|thumb|320x240px|RS485]]<br />
[[File:Missing_rs485_r19.png|thumb|320x240px|RS485]]<br />
<br />
To use RS485:<br />
<br />
*solder pin header 0.1" female connector<br />
*solder C1, U2, R18, R19 R9, R8, R1, D3<br />
*not solder JP7 and JP8<br />
<br />
If you use PCB without R19 footprint, you can add it in arduino pro-mini UART header.<br />
<br />
<br clear="all" /><br />
<br />
====Power Supply====<br />
[[File:Psu.png|thumb|320x240px|Power Supply]]<br />
<br />
Recommended power supply for rotator controller is: 48V @ 1A DC.<br />
A good choice is the [https://gr.mouser.com/ProductDetail/709-LRS50-48 MEAN WELL LRS-50-48]<br />
<br />
The switching power supply could get as input voltage, 19-60V DC.<br><br />
In different input voltages, must be change the components like D4 and F1.<br><br />
Default PCB components works at 48VDC.<br />
<br />
<br />
<br clear="all" /><br />
<br />
====Endstops====<br />
[[File:Endstop_part.png|thumb|320x240px|Endstop Specification]]<br />
[[File:Endstop.jpg|thumb|320x240px|Endstop]]<br />
<br />
In reference design, mechanical endstops (the [https://www.aliexpress.com/item/10PCS-MICROSWITCH-LIMIT-SWITCH-3pin-N-O-N-C-MICRO-SWITCH-free-shipping/32692144896.html?spm=2114.search0104.8.13.2f3c2457pmCyFH&transAbTest=ae803_5&priceBeautifyAB=0 P/N SS0505] of endstop is specified in [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator satnogs rotator BOM]) , are used.<br />
<br />
The controller has the capability to accommodate optical or magnetic endstop which connected to<br />
P2 header with silkscreen, SW1, SW2, +5V and GND.<br />
<br />
Mechanical endstops are connected to<br />
<br />
*SW1 and GND for azimuth axis<br />
*SW2 and GND for elevation axis<br />
<br />
<br />
<br clear="all" /><br />
<br />
====Encoders====<br />
Source files: [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-controller-encoder satnogs-rotator-controller-encoder - GitLab]<br />
Firmware: [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware/blob/master/libraries/as5601.h satnogs-rotator-firmware - GitLab]<br />
<br />
For stepper motor setup is optional (AS5601 encoder).<br />
<br />
For DC motor setup is necessary.<br />
<br />
<br />
[[File:Encoder_sheet1.png|thumb|center|800x420px|alt=|Rotary Encoder sheet 1/2]]<br />
[[File:Encoder_sheet2.png|thumb|center|800x420px|alt=|Rotary Encoder sheet 2/2]]<br />
<br />
<br />
<br clear="all" /><br />
<br />
===Firmware and Pin Assignments===<br />
<br />
=====Firmware=====<br />
<br />
[https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware For stepper motors] <br><br />
[https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware For DC motors, thanks to] [https://github.com/ph4as ph4as]<br />
<br />
=====Pins Configuration=====<br />
This configuration is from the latest release in [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-controller/tags Rotator Controller repository] <br />
<br />
*M1IN1 10, Step or PWM1<br />
*M1IN2 9, Direction or PWM2<br />
*M1SF 7, Status flag<br />
*M1FB A1, Load measurment<br />
<br />
*M2IN1 11, Step or PWM1<br />
*M2IN2 3, Direction or PWM2<br />
*M2SF 6, Status flag<br />
*M2FB A0, Load measurment<br />
<br />
*MOTOR_EN 8, Enable/Disable motors<br />
<br />
*SW1 5, Endstop for axis 1<br />
*SW2 4, Endstop for axis 2<br />
<br />
*RS485_DIR 2, RS485 Half Duplex direction pin<br />
<br />
*SDA_PIN 3, Data I2C pin<br />
*SCL_PIN 4, Clock I2C pin<br />
<br />
*PIN12 12, Digital output pin<br />
*PIN13 13, Digital output pin<br />
*A2 A2, Analog input pin<br />
*A3 A3, Analog input pin<br />
<br />
<br clear="all" /><br />
<br />
===Pre-Flight Check===<br />
<br />
[[File:Pcb_testing_points.png|thumb|center|800x420px|alt=|Testing Points]]<br />
<br />
*Power your PCB with 48VDC, without plug-in arduino pro-mini and motor drivers, measure with multimeter the voltage in point 1. Expected voltage +12V (reference to GND).<br />
*Plug arduino pro-mini and measure with multimeter the voltage in point 2. Expected voltage +5V (reference to GND).<br />
*Plug motor drivers (for steppermotors ensure the current is adjusted properly)<br />
*Connect all peripheral devices like motors, sensors, endstops<br />
<br />
If the two first steps fail, something is wrong (maybe there is a short circuit) in PCB. Check the connections with a multimeter.<br />
<br />
Then the board is ready to run the firmware, [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware/blob/master/README.md satnogs-rotator-firmware].<br />
<br />
<br clear="all" /><br />
<br />
===Troubleshooting hints===<br />
<br />
As soon as the board is powered up or reset, it will auto-home, on first build you can trigger a reset multiple time or move the homing ring to get it "home".<br />
<br />
[https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware/blob/master/README.md Connecting directly to the Arduino pro-mini] you will need to use 19200 bauds and "newline" line ending.<br />
<br />
Here is some commands (took from [https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-firmware#easycomm-implemantation]) you can issue in the terminal emulator of your choice to test things:<br />
<br />
*'''VE''', it will returns something like "SatNOGS-v2.0"<br />
*'''RESET''', move to home position<br />
*'''AZxx''', '''ELxx''', move to specified position (number)<br />
<br />
Nothing moves ? Look at the status and error register :<br />
<br />
*'''GS''', status register : 1 idle, 2 moving, 4 pointing, 8 error<br />
*'''GE''', error register : 1 no error, 2 sensor, 4 homing, 8 motor, 12 over temperature, 16 watch dog timer interrupt<br />
<br />
By example, at first start, you might be in '''GS8''' and '''GE4''' until you get a good homing position for the rotator to start working.<br />
<br />
If you using an unreleased version of the board (the board that has fuse holder), in [https://community.libre.space/t/stepper-motor-issue/2438/2 community post] you can find pin configuration file.<br />
<br />
<br clear="all" /><br />
<br />
==Rotator Controller v1==<br />
<br />
<br clear="all" /></div>Jenniferhe2529