JunOllyLi / espidf5_edgetx

EdgeTX build with ESP-IDF v5
Apache License 2.0
30 stars 9 forks source link

Is it possible to connect joystick to analog pin ( to measure resistance of pot) #4

Open PravarHegde opened 6 months ago

JunOllyLi commented 6 months ago

Another 4 analog pins from the ESP32S3? That probably would be difficult. But you could totally use external ADCs such as ADS1015 over I2C. I am actually trying to build a PCB for this thing, here (https://github.com/JunOllyLi/TX_PCB) is the initial draft, not tested yet. But you can see how I used ADS1015 to read the POTs (not the sticks though) And of course you will need to write the SW for it. I have no intention to use the old analog sticks on FS6 😄

PravarHegde commented 6 months ago

Yes, I am also interested in making PCBs. I am interested in 3D printing a joystick. Currently, I am using a 10k potentiometer to read gimbal movement. Is there any affordable Hall effect sensor available ?(that should compatibleto this project)

PravarHegde commented 6 months ago

I am also interested in 3D printing a case based on your PCB design 😀

JunOllyLi commented 6 months ago

Yes, I am also interested in making PCBs. I am interested in 3D printing a joystick. Currently, I am using a 10k potentiometer to read gimbal movement. Is there any affordable Hall effect sensor available ?(that should compatibleto this project)

My code is built around the FlySky Hall Gimbal, which costs around $100. 😄

JunOllyLi commented 6 months ago

I am also interested in 3D printing a case based on your PCB design 😀

Why didn't you mechanical guys come earlier. 😿 My PCB was built exactly the same size and shape and with the same holes so it fits into the FlySky FS6 case.

PravarHegde commented 6 months ago

Okay 😀

PravarHegde commented 6 months ago

ADS1115 (16bit) adc is compatible? I2c have any latency?? Simultaneously display and adc work with i2c?? Or do you have any other solution for gimbal joystick??

JunOllyLi commented 6 months ago

ADS1115 (16bit) adc is compatible? I2c have any latency?? Simultaneously display and adc work with i2c?? Or do you have any other solution for gimbal joystick??

Regarding compatibility I think the answer is yes, but you do need to read the spec to confirm. It should be good enough for measuring human movement to control something that already had so many mechanical stuff in between, like the servo. From this point of view, I personally think 16-bit is an overkill, human fingers would never be that precisely moved so that the 1/4096 of the stick range or 1/65536 of the stick range makes any difference. 😄

And theoretical numbers of I2C definitely can meet the needs. In real world, when you have multiple devices sharing the same I2C, SW does affect the result. But again, whether reading it every 1ms or 50ms would not really matter to human finger movement.

As of display and adc work, ESP32 has more than one core. I tried to separate the UI task and the mixing logic into different cores. So I do not think that would be a problem.

PravarHegde commented 6 months ago

Thank you for information

PravarHegde commented 6 months ago

I do order for adc. I would like to know how 4 hall sensor communication through uart? Does it have separate mcu in your hardware?

JunOllyLi commented 6 months ago

I do order for adc. I would like to know how 4 hall sensor communication through uart? Does it have separate mcu in your hardware?

Yes, there is some builtin controller in the hall gimbal to encode all 4 channels into one data stream over UART

PravarHegde commented 6 months ago

Okay

PravarHegde commented 6 months ago

LCD Type: TFT LCD Interface: SPI LCD Controller: ILI9486 Touch Screen Type: Resistive Touch Screen Controller: XPT2046 Colors: RGB, 65K colors Resolution: 480x320 (Pixel) Aspect Ratio: 8:5 I/O Voltage: 3.3V/5V

is this module work fine with edge tx?

3 5-inch-TFT-screen-for-Arduino-UNO_2_1024x1024@2x (1) DSC_2647_1024x1024@2x (1)

JunOllyLi commented 6 months ago

LCD Type: TFT LCD Interface: SPI LCD Controller: ILI9486 Touch Screen Type: Resistive Touch Screen Controller: XPT2046 Colors: RGB, 65K colors Resolution: 480x320 (Pixel) Aspect Ratio: 8:5 I/O Voltage: 3.3V/5V

is this module work fine with edge tx?

3 5-inch-TFT-screen-for-Arduino-UNO_2_1024x1024@2x (1) DSC_2647_1024x1024@2x (1)

I should work. But I personally would choose the 8bit MCU bus over SPI (your LCD module does have the 8bit bus), unless you want to save some pins for other use.

PravarHegde commented 6 months ago

I have to use MCU for the Edgetx, an MCU for joystick, and an MCU for ELRS. Do you have any methods to reduce the number of MCUs?

PravarHegde commented 6 months ago

In my locality, the Arduino Nano and ADS1115 are price are almost the same. Which one should I choose for this joystick? I plan to design a 3D-printed joystick with a Hall sensor. Do you have any suggestions?

JunOllyLi commented 6 months ago

In my locality, the Arduino Nano and ADS1115 are priced almost the same. Which one should I choose for this joystick? I plan to design a 3D-printed joystick with a Hall sensor. Do you have any suggestions?

Sorry I have not used Arduino Nano. It should work. But I think I would make decision based on the following:

  1. How good is the ADC of the Arduino Nano comparing to ADS1115. ADC needs some more concern about not just the spec, also about how the circuit is designed and wired, since there is analog part and the noise on the wires cannot be ignored.
  2. do you want to write your own FW for the Nano or not.
  3. Size difference. I know it is Nano but still looks a lot bigger than the ADS1115 module you could get, or even bigger difference if you create your own PCB
JunOllyLi commented 6 months ago

I have an MCU for the Edgetx, an MCU for joystick, and an MCU for ELRS. Do you have any methods to reduce the number of MCUs?

Are you going to do ELRS by yourself instead of an existing module? If is a module, then the number of MCU does not really matter since others would have already written FW for it.

On the other hand, I think the ESP32 for the edgetx still have extra computing power can be used, so really depend on your design. For example, like the question you asked me in the other thread, technically both would work if you use ADS to read the joystick and the main ESP32 to process the data directly, or having an Arduino to process the data before passing to ESP32.

PravarHegde commented 6 months ago

Thank you for your immediate response

PravarHegde commented 5 months ago

In my locality, the Arduino Nano and ADS1115 are priced almost the same. Which one should I choose for this joystick? I plan to design a 3D-printed joystick with a Hall sensor. Do you have any suggestions?

Sorry I have not used Arduino Nano. It should work. But I think I would make decision based on the following:

  1. How good is the ADC of the Arduino Nano comparing to ADS1115. ADC needs some more concern about not just the spec, also about how the circuit is designed and wired, since there is analog part and the noise on the wires cannot be ignored.
  2. do you want to write your own FW for the Nano or not.
  3. Size difference. I know it is Nano but still looks a lot bigger than the ADS1115 module you could get, or even bigger difference if you create your own PCB

The Arduino Nano has a 10-bit ADC. In my previous project, I used the ATmega328P SMD instead of the Nano board. Although it is smaller in size, the ADS1115 has a better ADC than the Arduino.

PravarHegde commented 5 months ago

example

Yes, I want to build a DIY ELRS TX using the RA02 or RFM95W module.

PravarHegde commented 5 months ago

I have modified my 3D printer with a plotter attachment (CD writer/permanent marker) to draw PCBs on copper clad. Then I go through etching. I am limited to a minimum track width of 2.8mm (arduino328 smd leg size), but I can test new PCB prototypes in less time.😃

JunOllyLi commented 5 months ago

In my locality, the Arduino Nano and ADS1115 are priced almost the same. Which one should I choose for this joystick? I plan to design a 3D-printed joystick with a Hall sensor. Do you have any suggestions?

Sorry I have not used Arduino Nano. It should work. But I think I would make decision based on the following:

  1. How good is the ADC of the Arduino Nano comparing to ADS1115. ADC needs some more concern about not just the spec, also about how the circuit is designed and wired, since there is analog part and the noise on the wires cannot be ignored.
  2. do you want to write your own FW for the Nano or not.
  3. Size difference. I know it is Nano but still looks a lot bigger than the ADS1115 module you could get, or even bigger difference if you create your own PCB

The Arduino Nano has a 10-bit ADC. In my previous project, I used the ATmega328P SMD instead of the Nano board. Although it is smaller in size, the ADS1115 has a better ADC than the Arduino.

As I mentioned earlier, 10bit/12bit/16bit probably would not make any difference regarding measuring finger movements. I am more concern about the analog circuit design, the noise on the analog signals may make a lot bigger problem than the data bits

JunOllyLi commented 5 months ago

I have modified my 3D printer with a plotter attachment (CD writer/permanent marker) to draw PCBs on copper clad. Then I go through etching. I am limited to a minimum track width of 2.8mm (arduino328 smd leg size), but I can test new PCB prototypes in less time.😃

Cool! But how are you going to connect the vias between each layers?

PravarHegde commented 5 months ago

I have modified my 3D printer with a plotter attachment (CD writer/permanent marker) to draw PCBs on copper clad. Then I go through etching. I am limited to a minimum track width of 2.8mm (arduino328 smd leg size), but I can test new PCB prototypes in less time.😃

Cool! But how are you going to connect the vias between each layers?

That part is a limitation for me

JunOllyLi commented 5 months ago

I have modified my 3D printer with a plotter attachment (CD writer/permanent marker) to draw PCBs on copper clad. Then I go through etching. I am limited to a minimum track width of 2.8mm (arduino328 smd leg size), but I can test new PCB prototypes in less time.😃

Cool! But how are you going to connect the vias between each layers?

Good question. That part is a limitation for me

  • Most of the time, I try to design circuits as simply as possible, preferably on a single-sided board.
  • Soldering Teflon wire to join double sided pcb or jumper to 1 sided pcb
  • Using through-hole vias (requires punching one side with a hammer)

But the PCB I designed is 4 layer board, the via need to connect to middle layer as well...

PravarHegde commented 5 months ago

I have modified my 3D printer with a plotter attachment (CD writer/permanent marker) to draw PCBs on copper clad. Then I go through etching. I am limited to a minimum track width of 2.8mm (arduino328 smd leg size), but I can test new PCB prototypes in less time.😃

Cool! But how are you going to connect the vias between each layers?

Good question. That part is a limitation for me

  • Most of the time, I try to design circuits as simply as possible, preferably on a single-sided board.
  • Soldering Teflon wire to join double sided pcb or jumper to 1 sided pcb
  • Using through-hole vias (requires punching one side with a hammer)

But the PCB I designed is 4 layer board, the via need to connect to middle layer as well...

If I am ready to design once again. Is it possible to reduce the layers?

Otherwise I have to order in online website

PravarHegde commented 5 months ago

currently I am using easyeda instead of kicad

JunOllyLi commented 5 months ago

I have modified my 3D printer with a plotter attachment (CD writer/permanent marker) to draw PCBs on copper clad. Then I go through etching. I am limited to a minimum track width of 2.8mm (arduino328 smd leg size), but I can test new PCB prototypes in less time.😃

Cool! But how are you going to connect the vias between each layers?

Good question. That part is a limitation for me

  • Most of the time, I try to design circuits as simply as possible, preferably on a single-sided board.
  • Soldering Teflon wire to join double sided pcb or jumper to 1 sided pcb
  • Using through-hole vias (requires punching one side with a hammer)

But the PCB I designed is 4 layer board, the via need to connect to middle layer as well...

If I am ready to design once again. Is it possible to reduce the layers?

Otherwise I have to order in online website

Well, sure you can. The worse case is that you make the board a little bit bigger than mine. I chose the size to fit into the FS6 case and you do not have that problem. And other than the USB signals, most of the signal is not very high frequency to deal with.

PravarHegde commented 5 months ago

I want to try AS5600 hall sensor for joystick gimbal. It has analog and pwm output , is it possible to connect through pwm? Or i2c

JunOllyLi commented 4 months ago

I want to try AS5600 hall sensor for joystick gimbal. It has analog and pwm output , is it possible to connect through pwm? Or i2c

Well, I don't know the details of this sensor, but as long as the SW matches it, either pwm or i2c can work. ESP32 is very flexible about pin assignment, you can basically use the same pin for almost any peripheral controller. I stick to FlySky hall gimbal because it a drop in replacement for the FlySky TX case I have.