Hey guys,
Iam working on a touch sensor with the capacitiveSensor library. As soon as i power the arduino with some batteries nothing works anymore. I know it is a grounding problem. But how do i ground the arduino?
Hey guys,
Iam working on a touch sensor with the capacitiveSensor library. As soon as i power the arduino with some batteries nothing works anymore. I know it is a grounding problem. But how do i ground the arduino?
Schematic?
Can you be more specific about it not working any more?
Capsense is using the capacitance from the connection to you, and then to ground. If you don't have it grounded, then you need to provide something like a large shield around the inside of the case or use a metal case connected to the Arduino's ground aka common. Then you need to be holding it in your hand while using it.
Well i am controlling a stereo via infrared. I figured it out. I ground it to the power supply of the stereo.
But i got a different problem now. Besides Capsense i want to use a lcd screen. As soon as i initialize the lcd screen, everything seems to be slowed down a lot. Even though i am doing nothing besides initializing? I am using the LiquidCrystal and the spi library.
Any ideas
thanks
Code?
#include <SPI.h>
#include <LiquidCrystal.h>
#include <IRremote.h>
#include <CapacitiveSensor.h>
int LED_PIN=3; //IR PIN
int Threshold_PIN=1; //AnalogInputPin für den Poti zum Einstellen des Thresholds
int Button_PIN=0; // AnalogInputPin für den Button zur Navigation des LCDs
int Threshold=150;
int state=1; //Variable für die Menüführung mittels eines Buttons
//Initialisierung der Touchsensor mit zugehörigen DIOs
CapacitiveSensor cs_2_4= CapacitiveSensor(4,2);
CapacitiveSensor cs_6_5= CapacitiveSensor(5,6);
CapacitiveSensor cs_8_10= CapacitiveSensor(8,10);
CapacitiveSensor cs_12_7= CapacitiveSensor(12,7);
IRsend irsend; //Initialisierung IRsender
LiquidCrystal lcd(9);//LCD initialisieren
void setup() {
Serial.begin(9600);
}
void loop() {
//Touchsensoren werden gelesen
long on_button = cs_2_4.capacitiveSensor(100);
long pause_play_button = cs_6_5.capacitiveSensor(100);
long volume_decrease = cs_8_10.capacitiveSensor(100);
long volume_increase = cs_12_7.capacitiveSensor(100);
//Ist der Button betätigt so wird ein IR Signal an die Box gesendet
if (on_button> Threshold){
irsend.sendNEC(0x2F538C7, 32);
Serial.println("on");
Serial.print(on_button);
}
if (pause_play_button>Threshold){
irsend.sendNEC(0x2F548B7, 32);
Serial.println("pause");
Serial.print(pause_play_button);
}
if (volume_decrease>Threshold){
irsend.sendNEC(0x2F540BF, 32);
Serial.println("leiser");
Serial.print(volume_decrease);
}
if (volume_increase>Threshold){
irsend.sendNEC(0x2F59867,32);
Serial.println("lauter");
Serial.print(volume_increase);
}
}
For setting the threshold i want to use the lcd, which displays the value of a potentiometer. But before i even get started with that, everything slows down a lot. Even if i dont write anything onto the lcd, besides initializing it. Could this be the SPI library or the liquidcrystal library? I need to use the SPI Library because i use a register for the lcd, due to the limited number of digital Outputs on the uno.
Thanks