Energy Monitor Shield Current Sensor

The energy monitor shield has three current sensor inputs (A0 thru A2) which have a voltage divider to provide a reference offset voltage for the analog inputs on the Netduino. The reference offset voltage with a 5V supply was 2.5V which meant on a 3.3V device the range of the sensors (1V for 30 Amps) would be compromised.

In a previous post I modified the shield by replacing a resistor but there appears to be an easier modification. While looking at the schematic and the shield I realised that cutting off the 5V pin and connecting the 3.3V pin and 5V pin together would make all the analog inputs use the 3.3V rail.

Energy Shield with modifications for 3.3V operation

Energy Shield with modifications for 3.3V operation

It would be good if the designers of the shield would consider putting a switch or jumpers on the device to allow 3V3 or 5V operation.

public class Program
{
public static void Main()
{
AnalogInput buttons = new AnalogInput(Cpu.AnalogChannel.ANALOG_0);

while (true)
{
Debug.Print(buttons.Read().ToString(“F2”));

Thread.Sleep(250);
}
}
}

Energy Monitor Shield Buttons

The two buttons on the energy monitor shield are connected to the analog input A3 via a voltage divider. The shield appears to be designed for 5V devices as the input for the voltage divider is connected to VCC which is 5V. Netduinos and some Arduinos are 3.3V devices and this approach won’t work on these devices.

public static void Main()
{
AnalogInput buttons = new AnalogInput(Cpu.AnalogChannel.ANALOG_3);


while (true)
{
Debug.Print(buttons.Read().ToString("F2"));
Thread.Sleep(250);
}
}

The return value of the AnalogOutput with no button pressed was 1.0, SW1 pressed 1.0 and with SW2 pressed 0.93.

To work around this issue I modified the shield so the input voltage to the voltage divider is 3.3V. With my modified shield the return value of the AnalogOutput with no button pressed was 0.87, SW1 pressed 0.83 and with SW2 pressed 0.67. [Edit-see next post with easier modification]

To change the input voltage of the voltage divider I removed R8(circled) and replaced it with a 1K resistor connected to 3.3V.

Energy Shield with Button modifications

Energy Shield with Button modifications

 

 

Energy Monitor Shield nRF24L01+

The nRF24L01 functionality looked like a good place to start so I had a look at the documentation. The interface for connecting the nRF24L01+ module was specified as

D11 – MOSI
D12 – MISO
D13 – SCK
D8 – RF_CE
D7 – RF_CSN
D2 – RF_IRQ

I have used the Nordic nRF240L1+ .Net Micro Framework Driver on a couple of other projects but initially struggled to get it working with this configuration. After looking at the pin outs of the nRF24L01+ and the Energy Monitor Shield schematic I think the CSN & CE are reversed.(as at March 2014).

This code works and was adapted from the sample application provided with the driver on codeplex

public class nRF240l1Module
{
private const byte channel = 10;
private readonly OutputPort _led = new OutputPort(Pins.ONBOARD_LED, false);
private readonly NRF24L01Plus _module;
private Timer _timer;
private byte _token;

private readonly byte[] _myAddress = Encoding.UTF8.GetBytes(“NetP1”);
//private readonly byte[] _myAddress = Encoding.UTF8.GetBytes(“NetP2”);
private readonly byte[] _otherBoard = Encoding.UTF8.GetBytes(“NetP2”);
//private readonly byte[] _otherBoard = Encoding.UTF8.GetBytes(“NetP1”);

public nRF240l1Module()
{
_module = new NRF24L01Plus();
}

public void Run()
{
_module.OnDataReceived += OnReceive;
_module.OnTransmitFailed += OnSendFailure;
_module.OnTransmitSuccess += OnSendSuccess;

_module.Initialize(SPI.SPI_module.SPI1, Pins.GPIO_PIN_D8, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D2);
_module.Configure(_myAddress, channel, NRFDataRate.DR250kbps);
_module.Enable();

_timer = new Timer(SendMessage, null, new TimeSpan(0, 0, 0, 1), new TimeSpan(0, 0, 0, 1));
}

private void OnSendSuccess()
{
_led.Write(false);
}

private void OnSendFailure()
{
Debug.Print(“Send failed!”);
}

private void OnReceive(byte[] data)
{
Debug.Print(“Token <- ” + data[0]);
}

private void SendMessage(object state)
{
_led.Write(true);
_module.SendTo(_otherBoard, new[] { _token });
Debug.Print(“Token -> ” + _token);
_token++;
}

}

Energy Shield with nRF24L01Plus

Energy Shield with nRF24L01Plus

Energy Monitor Shield arrived

One of the projects I’m planning for code club is a power consumption monitor. After some research and checking of circuit diagrams the Energy Monitor Shield designed by devicter looked like it would work with a Netduino. The analog voltage inputs for the AC current sensors plus the SPI bus configuration for the Nokia 5110 display and nRF24L01+ appear to be compatible.

Image

Initial impressions are good, only problem is the backlight is a little bit bright (so I removed the jumper).