Hey everyone, very new to all of this and already stuck right out of the gate… just trying to add a simple sensor and get it working on the dashboard, but no luck. I’m using an arduino mega with 5100 ethernet shield and I’ve tried adding a ds18b20 and a photo resistor, but neither seem to send any data to the widgets… I’ve read and watched every doc and video I can find and it looks like it should be so simple!
I’ve never used the 5100 ethernet shield before, but it appears to be connecting ok as it displays
in my serial monitor and appears to be online from the dashboard, just not getting any data. I verified my token is correct…
For the photoresistor my signal goes to A0… I don’t see anywhere in the code i pasted into the IDE where it references the pin… assuming that’s on cayenne’s end somewhere and executed via the Cayenne.run() statement? or am i supposed to put in additional code to the code generated by Cayenne?
Update: so i figured out that if I add the photoresistor as a generic analog widget it will display the values from the photoresistor… I don’t understand why when i tried to add it the first time by selecting it from the list of sensors it doesn’t work, but as a generic analog device, it does…?
Maybe i don’t understand how the virtual pins are supposed to work… in the TMP36 example they include the cayenne temp library, define the virtual pin and set the variables for the analog pin and sensor… in the code i got from the program and was told to paste into my sketch, none of these details were present and I wasn’t sure if I was supposed to add any additional code… pretty sure i read somewhere that I wasn’t…?
If i try to add the photoresistor as a virtual connectivity type, is there any correlation to the V# and the pin# that the sensor is on? is V1 = A1 or D1? how does it know which pin to link the widget to?
There are a lot of bugs that need fixing once the dev team has time. However there tends to be work arounds.
Virtual functions are not tied to specific analogs. Here’s an example. Just create a virtual analog output on the dashboard for channel 7 and away you go.
//Output analog read on Virtual Channel 7
VIRTUAL_OUT(V7)
{
float photoresistor;
//photo resistor on A0
photoresistor = analogRead(0);
//do some scaling if you like
photoresistor = photoresistor * 5/1024;
Cayenne.virtualWrite(V7,photoresistor);
}
Thanks Craig! I am super stoked about using Cayenne, it looks like exactly what I’m looking for! I just wasn’t seeing how the code was correlating anything, but I think I see from your example and some additional videos that I’m going to need to put in some of the references manually, which is fine… actually maybe easier for my brain to connect the dots that way
One other kind of unrelated question… can you see any reason (or foresee any limitation) to being able to hook my 5100 ethernet shield up to a travel router acting as a bridge or access point to access my wireless network and use Cayenne?
also, i’m just rewatching the video where he added a DHT11 sensor as a custom widget and in the video he has humidity as a data type in his drop down list, but I don’t see that as a data type option in my drop down list… am I missing something?
Could you please step me through that?
When I open generic sensors (analog or digital input) there are no options for data types, just values for device, connectivity, pin and widget.
Doesn’t seem to be there under generic sensors anymore. I swear it was.
I see you can add it via Custom Widgets ->Value Display then set Data to Humidity. The I/O selection is ghosted out and this bug has been communicated. You can however add it through the mobile app.