Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:practical:hardware:sut:esp32:emb10_1 [2024/02/28 22:12] pczekalskien:iot-open:practical:hardware:sut:esp32:emb10_1 [2024/04/09 12:58] (current) – [Result validation] pczekalski
Line 31: Line 31:
 <note warning>Do not keep the servo rotating when leaving the lab. Implement your code as non-repeating. A servo that remains rotating for a long time may easily wear out its gears, overheat and even burn!</note> <note warning>Do not keep the servo rotating when leaving the lab. Implement your code as non-repeating. A servo that remains rotating for a long time may easily wear out its gears, overheat and even burn!</note>
 === Step 1 === === Step 1 ===
-Include servo control library, specific for ESP32 and declare GPIO:+Include servo control library, specific for ESP32 and declare GPIO, minimum and maximum duty cycle values:
 <code c> <code c>
 #include <Servo.h> #include <Servo.h>
 #define SRV_PIN 37 #define SRV_PIN 37
 </code> </code>
-==== Step ====+MG 90 servos that we use in our lab are specific. As mentioned above, to achieve a full 180-degree rotation range, their minimum and maximum duty cycle timings go far beyond standards. Here, we declare minimum and maximum values for the duty cycle (in microseconds) and a PWM control channel (2): 
 +<code c> 
 +#define PWMSRV_Ch     2 
 +#define srv_min_us  550 
 +#define srv_max_us 2400 
 +</code>
  
 +=== Step 2 ===
 +Define a servo controller object:
 +<code c>
 +static Servo srv;
 +</code>
  
-==== Step 3 ====+=== Step 3 === 
 +Initialise parameters (duty cycle, channel, GPIO): 
 +<code c> 
 +srv.attach(SRV_PIN, PWMSRV_Ch,srv_min_us, srv_max_us); 
 +</code> 
 +50Hz frequency is standard, so we do not need to configure it.
  
 +=== Step 4 ===
 +Rotating a servo is as easy as writing the desired angle to the controller class, e.g.:
 +<code c>
 +srv.write(SRV_PIN,180);
 +delay(2000);
 +</code>
  
  
-...+===== FAQ =====
  
-=== Step n === +**How do I know minimum and maximum values for the timings for servo operation?**: Those parameters are provided along with servo technical documentation, so you should refer to them. Our configuration reflects the servos we use (MG90/SG90), and as you can see, it goes far beyond the standard servo rotation control that is a minimum of 1000us and a maximum of 2000us. Using standard configuration, your servo won't rotate at full 180 degrees but at a shorter rotation range.
-//Describe activities done in Step n.//+
  
 ==== Result validation ==== ==== Result validation ====
-//Provide some result validation methods for self-assessment.// +Observe the red arrow to rotate accordinglyRemember to give the servo some time to operate.
- +
-===== FAQ ===== +
-This section is to be extended as new questions appear\\ +
-When using the printed version of this manual, please refer to the latest online version of this document to obtain the valid and up-to-date list of the FAQ. +
-//Provide some FAQs in the following form:\\ +
-**Question?**: Answer. +
-//+
  
 +<WRAP noprint>
 ===== Project information ===== ===== Project information =====
 {{:en:iot-open:logo_iot_200_px.png?200|}}\\ {{:en:iot-open:logo_iot_200_px.png?200|}}\\
Line 74: Line 88:
 {{:en:iot-open:ccbync.png?100|}} {{:en:iot-open:ccbync.png?100|}}
 </figure> </figure>
- +</WRAP>
- +
en/iot-open/practical/hardware/sut/esp32/emb10_1.1709158330.txt.gz · Last modified: 2024/02/28 22:12 by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0