Ardunio Leonardo Capacitive Touch

Hi,

I have a capacitive touch script running successfully on my Leonardo turning on an LED.

  • My question is, does the Leonardo only send input signals out through the USB port?

I’d like to connect my Leonardo to the GPIO of a Raspberry Pi but not through the USB.

I’m thinking the signal that powers ON the LED, could tap into the RPi GPIO?

This is the script im wanting to trigger: https://www.hackster.io/ThothLoki/play-video-with-python-and-gpio-a30c7a

The arduino will output on whichever pins you tell it to. The Leo has a hardware serial (Serial1) that you can use for serial communication, or you can digitalWrite to any pin in response to touch, etc.

Is the pi's gpoi 3.3v tolerant? If not, you'll need to level shift it - a pair of resistors used as a voltage divider should do it.

Remember to connect the grounds.

I think the best way (in terms of wiring and software) would be to take input directly from Leonardo’s USB serial port and run the appropriate Python code as if a pi’s GPIO pin is toggled. Post your Leonardo code here. I can help you modify it to output to USB serial port.

DrAzzy:
The arduino will output on whichever pins you tell it to. The Leo has a hardware serial (Serial1) that you can use for serial communication, or you can digitalWrite to any pin in response to touch, etc.

Is the pi's gpoi 3.3v tolerant? If not, you'll need to level shift it - a pair of resistors used as a voltage divider should do it.

Remember to connect the grounds.

Looking at this diagram, it appears there are two pins that have 3v3 https://www.element14.com/community/servlet/JiveServlet/showImage/102-78315-11-229602/GPIO-pinout-and-rpi.jpg

Does the Leonardo output 5v from the digitalwrite pins? I have the script working on an old Leonardo. I will have to look at it again to see what pins its triggering and LED light to turn on.

liudr:
I think the best way (in terms of wiring and software) would be to take input directly from Leonardo's USB serial port and run the appropriate Python code as if a pi's GPIO pin is toggled. Post your Leonardo code here. I can help you modify it to output to USB serial port.

Previously, i used this code to trigger an LED to turn on when the metal is touched and off when it is not touched. I think tweaked the code to register a keyboard press for another project.

In the instance of the raspberry pi code i've attached in the first post. It looks like I only need to send a ground signal to the RPi gpio (no keyboard necessary)

  1. I think this arduino code would work if I wire from the LED output pins directly to the gpio or the RPI http://www.instructables.com/files/orig/FP8/D5R7/H2MYDFQU/FP8D5R7H2MYDFQU.ino

  2. A usb trigger of the pin would be awesome and much cleaner!

Thank you for your assistance.