Advertisement

Saturday, December 20, 2014

Power Monitoring with the Moteino -- Attempt #2

This weekend at the Milwaukee Makerspace, I continued trying to get my Moteinos to communicate to each other.  I want to get a node to send its power level to the host.  I performed a number of tests and eventually accomplished the goal.

Basic TxRx Test
First, I numbered the Moteinos 1, 2, and 3.  Each Moteino was setup at a frequency of 915mhz.  The high power setting for the RFM69HW was set on all Moteinos.  For the first test, I opened the serial terminal window in the Arduino IDE on each Moteino so I could see the messages it was sending.  For the other tests, the terminal was only on the Receiver.

The test involved uploading the TxRxBlinky sketch on each Moteino -- one as the Receiver, and one as the Sender.  I hooked a button up to the Sender.  Once both Moteinos were powered up, I pushed the button on the Sender.  This caused the LED on the Receiver to change state -- on to off or off to on.  The Receiver also sends some text to the serial monitor.

SENDERRECEIVERRESULTS
M3M2Passed
M3M1Passed
M1M2Passed
M1M3Passed
M2M1Passed
M2M3Passed

All tests passed.  All Moteinos can both send and receive.  Also, they all operate with either the USB as a power source or the Lithium 6v battery as the power source.

Gateway / Node Test
For the next test, I used the Gateway / Node sketches from LowPowerLab.  The Gateway sketch was loaded on the Receiver Moteino and the Node sketch was loaded on the Sender Moteino.  All Moteinos were set at 915mhz frequency.  The high power setting was set on all Moteinos.

Before testing a pair of Moteinos, I loaded the Node sketch on one Moteino and watched what happened with the serial monitor.  The Moteino outputted exactly what it was supposed to.

Next, I uploaded the Gateway sketch to a Moteino and started testing.

TestGatewayNodeResults
1M1M2Passed
2M3M2Passed
3M3M1Passed
4M2M1Passed
5M1M3Passed
6M2M3Passed

All tests passed.

Custom Node Test
Now that I know all of Moteinos can talk to each other, I tested a custom node program.  It is set to transmit at 915mhz.  The high power setting for the RFM69HW is set.

The custom program is a modified version of the Node sketch from LowPowerLab.  The sketch reads the voltage from the Moteino and transmits it to the host.  (More information about the code to read the voltage is in this post.)

I had the same problem with the sketch that I had last week.  If the Node program tries to read the voltage using the readVCC function, then tries to use the radio.sendWithRetry function, the Moteino appears to reboot--it is re-running the setup function.  If I comment out the line that calls readVCC, the rest of the code processes normally.  However, the send line prints the message indicating it failed.  

After a lot of testing, I realized that the failure message I am getting is always there -- even with the code that comes with the Moteino.  I ran my Node program and the Host displayed the voltage from the Node.  The code works even though the failure message prints.  I don't know if there is something wrong with the code or if I don't understand how the read.send function is supposed to work.

I don't know why the Moteino was rebooting.  I did fix that problem by starting over with the original Node program and adding my code bit by bit.  The problem did not re-occur.  Maybe I had some invisible characters in the code.

Finally, I tested the voltage that is read by the node.  I connected a variable power supply to the power input on the Node.  This let me vary the input voltage.  I started at 6 volts and slowly turned the voltage down.  Sending any voltage over 3.2 registers as 3349 millivolts.  Once the voltage was turned down to 3.2 volts, the device read 3205 or 3196 millivolts.  When the input got down to 3.1 volts, the node stopped transmitting.  So, I will be able to use this code to monitor my battery's voltage.

One of the next steps is to understand how the node and host communicate.

  • Can the node sleep until the host calls it?  
  • If the node sends data to the host, will it get lost?  Is there a way to know for sure?
  • How do we make the device truly low-power?
  • What does the Ack do?
Another step is to connect the host to a Raspberry Pi and have the Pi read the serial inputs.

RPI serial console: http://elinux.org/RPi_Serial_Connection

+Moteino
#Moteino

Sunday, December 14, 2014

Possible Smoked Moteino

As I mentioned in my last post, I inadvertently plugged power into the GND pin on one of my brand new Moteinos.  There was a small puff of smoke and I quickly unplugged the power.  However, I had a bad feeling that I just ruined my $20 device.

I tested the Moteino to see if anything still worked.  First, I plugged in the FTDI adapter and used a USB cable to connect the Moteino to my PC.  The Arduino IDE software saw the board.  I uploaded the "Fade" example sketch to the Moteino.  It worked.

Next, I loaded the TxRxBlinky example sketch for the Moteino.  I was able to use the Moteino as a Sender device.  I assume that means that the transceiver is also working.

Finally, I used a multimeter to check the voltages.  The Lithium battery I had hooked up was sending 6.27 volts to the Moteino VIN pin.  The 3.3 pin on the Moteino was putting out 3.31 volts.  This means that the regulator in the Moteino is also working.

I think everything is working.  I'm going to try using this Moteino as the main receiver on my Home Environmental Sensor Array.

+Moteino
+Microcontroller
+Arduino
#Moteino, #Microcontroller, #Arduino

Saturday, December 13, 2014

Testing Moteinos

This blog post is covering my last two weeks of activity on the Moteinos for my Home Environmental Sensor Array.  Topics include

  1. Power supply experiments
  2. Attaching a power supply to a Moteino node
  3. Testing multiple Moteinos

Power Supply Experiments
I spent a good deal of time trying different ways to power the Moteino.  I was hoping that I could use a 3v Lithium battery as a power source.  That way, I could have an easily replaceable and cheap power source.  However, the coin cell battery I used did not appear to provide enough power to run the Moteino.

Next, I tried a 3.6v Lithium battery that I found in the battery box at the Makerspace.  It put out about 3.6 volts on its own.  After connecting it to the Moteino, I used a multimeter to see how many volts were going into the Moteino.  It registered at about 1.4 volts.  Not sure what is happening but this battery does not provide enough power for the Moteino either.

Finally, I tried using a 6v lantern battery as a power input.  That worked better.  When I tested the voltage with a multimeter, it registered 6.23 volts.  After I connected the battery to the Moteino, I tested the voltage by putting the test leads on the GND and VIN pins on the Moteino.  It registered 6.17 volts.  Since the Moteino has a built-in power regulator that limits the voltage to 3.3 volts, this is more than enough power.

In order to power nodes, the Moteino needs a power source that delivers between 5-9 volts.  The two options are a 6v Lithium battery or a 9v NiCd battery.  I would prefer the smaller battery because it will waste less energy when the Moteino converts the voltage to 3.3 volts.

Attaching a Power Supply to a Moteino Node
Now that I know how much power I need to supply, the next task is to figure out how to attach power to a Moteino that will operate as a stand-alone node.

I bought a 6v Lithium battery as an external power source.  It is just a bit bigger than a 9v battery.  Also, the power ports are recessed.  This makes it difficult to attach wiring to the battery.

My first idea for a reliable power storage solution for the 6v battery was to re-use an existing 9v battery container.  I found an old clock radio on the hack rack at the Milwaukee Makerspace.  The radio had a space for a 9v battery built-in to one part of the plastic case.  I cut out the 9v battery compartment from the case.

I settled on the idea of using screw heads to connect to the recessed battery terminals.  First, I cut a small piece of balsa wood to fit into the bottom of the compartment.  The wood is just a bit smaller than the compartment.  The wood is just big enough to not move around.  Also, when the battery is inserted into the compartment, it will keep the wood from moving.

Next, I put two screws through the wood and cut off the extra length of each screw with the metal bandsaw.  Finally, I attached wires to each screw.  In hindsight, I should have put the aluminum strips on the top of the wood.  That would have helped the conductivity of the wires to the screws.

Putting the battery into the compartment so it has good contact with the screws is a bit tricky since I can't really see what is going on.  However, once the battery is in properly, it delivers 6v.  I can connect the wire leads either to a prototype board or to input pins on a circuit board.  Although this does work, it is not an ideal solution.  Ideally, I would like a solution that works as easily as traditional battery connectors.  Either I could rig up a cap like 9v batteries have or I need a more cozy container that is a better fit for the lithium battery and makes a good connection every time a battery is inserted.  Maybe I could 3D print a container.

Also, I was testing the battery with one of my Moteinos and I inadvertently attached the positive wire to the GND pin on the Moteino.  The Moteino started smoking.  I immediately pulled out the wire but I don't know what damage was done.  When I connect the Moteino to my computer with the FTDI cable, it powers up.  The Arduino IDE client sees the device.  I uploaded a sketch to the Moteino that made an LED blink.  I still need to test the RF device.  If that works, the Moteino may not have been damaged at all.  That would be a blessing.

Testing Multiple Moteinos
I purchased two more Moteinos -- one for my first node, and one for backup or the second node.  The

Moteino site has a section on programming the Moteino.  One of the Arduino sketches allows you to test a receiver / sender pair of Moteinos.  When you press a button connected to the sender Moteino, it sends a signal to the receiver that toggles an LED -- if it is off, it turns on, and vice-versa.

I was able to successfully test this with two of the Moteinos.  Now, I know a bit more about using the Moteinos.  Next, I need to figure out how to connect the receiver Moteino to my Raspberry Pi.  Another next step is to write a sketch to read something on the node and send it to the receiver Moteino.