Wiring a Push Button as External Device to GPIO Header for EHS6T | Telit Cinterion IoT Developer Community
March 8, 2019 - 5:17am, 1952 views
Hi,
I am currently looking at attaching an external momentary push button switch on a breadboard to the GPIO header pins on the EHS6T, for a simple button state logic demonstration to some classroom students.
For the hardware setup, do I simply use GND, 5V and the signal pin of choice e.g GPIO 11?
Also, do you recommend using the GPIO library to handle the level shifting ?
Thanks,
Nick.
Hello,
To use terminal's GPIO lines you need to connect external power supply to VCCref (1.8-5.5V) to power the level shifters. You can also use +5Vout line for this. You also need to configure the GPIO directions - it can be done via i2c or ASC0 (baudrate 1200kbps) as described int the hardware interface description document. Please also note that some GPIO lines are shared with other interfaces. If you want to use these lines you have to ensure the proper configuration (please see AT^SCFG command for more details).
Finally you can control GPIO lines over AT interface or from Java MIDlet with Java APIs. You will find some examples in the Knowledge Base.
You can for example connect 5V via 100kOhm resistor to a GPIO line and connect a push button to short circuit GPIO line to ground when pushed.
You should be careful in case of just connecting 5V to GPIO line - it could be damaged if the GPIO pin is not configured as input.
Best regards,
Bartłomiej
Hi Bartlomiej,
I have since wired up the buttons to a breadboard and the GPIO header, they work via AT Commands i.e I can open the lines, poll them to check button presses work in real time and select their directions. So that's great, thanks.
However I cant seem to get the example GPIO library Midlet created by Paul Mock ( https://iot-developer.thalesgroup.com/tutorial/conceptboard-java-gpio-lib ) working.
I changed the GPIO input pin to GPIO7 (which is an available GPIO line) in the code and selected "TERMINAL" for my EHS6T terminal. When I go to test it via Ninjava I do get the errors "CME Error: Unknown" and CME Error: "Not found".
Have I misconfigured my GPIO lines using AT commands prior to running the Java code? And if we use the Java code example, should we even configure the GPIO lines with AT commands?
Thanks,
Nick.
Just an afternote,
I have just found some more examples and see that there are code examples that demonstrate how you can prepare the port listeners and set direction of the buttons via Java code - seems to be just what I was looking for! :).
I will persist. Thanks once again for your help with my original post above.
Best Regards,
Nick.
Hello,
I have looked at this tutorial and I can see there the configuration of level shifters with i2c. You should use the constant TERMINAL and you do it (CONCEPT is for ConceptBoard which have a different hardware). I can't see in that library the configuration of shared lines with AT^SCFG command. And in case of GPIO7 which you use it is shared with PWM interface. You can find this information in the hardware interface description for the module (not terminal) as this is the outcome of the module hardware design. So you need to ensure that "GPIO/****/PWM" is set to "gpio" and reboot the device.
The demo projects that you can find in Knowledge Base may not be perfect and may not work on all modules. While using Java MIDlets you should also use the Gemalto SDK version dedicated to your module firmware version - sometimes there may be incompatibility issues while the wrong version is used.
I you are still having problem with this GPIO lib please paste the application log.
Best regards,
Bartłomiej
Hi Bartlomiej,
It is fixed and working now in Java. The problem was I had accidentally added a JMUnit test module in Netbeans. It was causing my Midlet build to fail.
Now that I have made a fresh copy of HelloWorld midlet and modified it to add back in the GPIO Midlet example it works perfectly and buttons get listened and recognised.
Many thanks,
Nick.