Strip ~1/2" of the insulation off the float switch's brown and black wires. Twist the strands of each wire tightly and then use a soldering iron to tin each wire. We will not be using the remaining blue wire.
With the float switch wires tinned, break off two male header pins and solder a header onto each switch wire so that you can easily connect the switch to the Notecarrier's headers.
Plug the header from one of the float switch's wires (it doesn't matter which one) into the GND header on the Notecarrier.
Plug the remaining float switch wire into AUX1 on the Notecarrier. With this configuration, when the switch is closed, AUX1 will be connected go ground.
With the hardware assembled and firmware updated, it's time to configure the Notecard. First, connect the Notecarrier to your development machine with the USB A to micro USB cable. Using the in-browser terminal on dev.blues.io, connect to the Notecard and enter this command:
This command configures the Notecard's AUX pins, which you can read more about in our documentation here. The usage parameter accepts an array of 4 values, one for each AUX pin. The first element corresponds to AUX1, the next to AUX2, and so on. Here, we are configuring AUX1 to act as an input with a pull-up. Thus, when the switch is open, AUX1 will be driven high. When the switch is closed, it'll be driven low. The sync parameter will cause the Notecard to sync a note to Notehub whenever the input on AUX1 changes (either low to high or high to low). The file parameter instructs the Notecard to sync these updates to a Notefile called switch.qo.
When using the black and brown wires of the float switch, the switch closes when it floats up to a certain level (really, when the float passes a certain angle relative to a fixed point, see this helpful video from the switch manufacturer). We can simulate this by simply flipping the float switch 180 degrees. When you do this, you should hear a steel ball inside the float switch slide into a new position. The switch is now closed, and you should see a switch.qo note come into your project's Events tab on Notehub like this:
This note indicates that AUX1, the first element of the state array, has been driven low, since the switch has closed and connected AUX1 to ground. If we flip the float switch again, we should see a note like this:
In a real sump, the float switch will change orientation and close/open with rising and falling water level. When the water rises to a certain level (the exact level is dependent on how much slack you've given the float), you'll get the first kind of note, indicating low voltage on AUX1. When the water falls back to a certain level, you'll get the second kind of note, indicating high voltage on AUX1. You can then act on this signal as appropriate for your use case.
In the real world, you'd want your alert system to be resilient to power outages, so you'll want to hook up a LiPo battery with a JST cable to the JST port labeled LIPO on the Notecarrier.
If you want to wire up more float switches to the same Notecard, you can easily do so by using the additional AUX pins. This could be useful in a particularly deep sump/vessel and/or when you want more granularity in terms of knowing the current fluid level.