Add UC Battery 4xAA Module to Fez Cobra II?

Hello All

I have Fez Cobra II board and would like to attach UC Battery 4xAA Module to it so I can run from AA batteries.
But there is no ‘D’ socket on Fez Cobra II board.
Anyone can please tell how to attach UC Battery 4xAA Module to Fez Cobra II board?
Can I use different letter socket or maybe use the expansion headers and a breakout module (like in attached picture)?

Links:

Fez Cobra II: ww.ghielectronics.com/catalog/product/399
UC Battery 4xAA Module: ww.ghielectronics.com/catalog/product/394
breakout module: ww.ghielectronics.com/catalog/product/405

Please somebody can help tell me the answer?

Thankyou

P.S.
Also,
After more looking at specifications for socket ‘D’ at
ht/tp://gadgeteer.codeplex.com/wikipage?title=Socket%20Type%20D
and for Fez Cobra II expansion header labels at
ht/tp://www.ghielectronics.com/downloads/schematic/FEZ_Cobra_II_SCH.pdf
I am even more confused how to use expansion headers and understand their labels.

So if possible to use Battery Module attached to expansion headers, then can someone please tell me which pins to connect to it?

Thanks

Welcome to the forum Jason

You have a few options.

Without a D socket, you cannot use the UC Battery module https://www.ghielectronics.com/catalog/product/394 as a deployment device - but you wouldn’t really need to anyhow since your Cobra2 has it’s own USB connection. But you CAN use it purely for providing power, and that could be as simple as plugging it into one of the Gadgeteer sockets - this will feed 3.3v and 5v into the appropriate pins on the mainboard and power it. You have to be aware that the schematic implies pin 3 has a voltage on it (intended to be read with an analog input to estimate battery health) so you might need to forgo that feature. I’d always suggest you tape up the USB port so there’s no chance of forgetting that it’s not to be used :slight_smile:

You could wire up via an extender if you wanted to get the full features - all you need is pin 3 to go to an Analog In socket on the large edge connector, and the 3v3 and 5v lines as well as GND to the appropriate points.

And if you really just wanted to “get mobile”, you could use a pair of Lithium based batteries connected to a 2.1mm power connector that you then plug into the power jack on the Cobra2. If I was going to do something like this, I would do it this way, and use a pair of rechargeable 18650 batteries and a plug and be done with it.

hope that helps ! Let me know if you want more info !!

2 Likes

Thank you Brett for fast reply

Sorry if I am a bit slow, but hopefully you can help me to understand a bit more.

For beginning my project I would like to just use AA batteries so it can be cheap, simple and portable to start with, then maybe if it turns out good a will add lithium battery later to improve it (thanks for this idea).

When you say,
"[em]But you CAN use it purely for providing power, and that could be as simple as plugging it into one of the Gadgeteer sockets - this will feed 3.3v and 5v into the appropriate pins on the mainboard and power it.[/em]"
Do you mean I can just plug the UC Battery module into any letter-type socket and it will provide power for the whole board? Then for this it will not matter if other pins (D+, D-, GPIO) do not match as long as 3.3v and 5v pins are connected together?

This would then provide ‘just power’ and no additional monitoring or control features from GPIO pins, correct?

Then, if I want to have monitoring and control features I can use extender (or breakout module as well?) to connect poins to expansion headers.
ht/tps://www.ghielectronics.com/catalog/product/273
ht/tps://www.ghielectronics.com/catalog/product/405

In this case I only need to connect GPIO! (pin 3) from battery module to any analog input pin on the expansion header, and I do not need to worry about D- and D+ pins for battery module?
Quick question, but is GPIO! (! means can use interrupts) going to lose any functionality if connecting to just plain analog input pin on expansion header?

I plan to use TFT LCD (probably with touchscreen) so this means I have two Gadgeteer plugs freely available on the board, one U/X plug and one S/X plug.
X-type plugs have one GPIO! pin and two GPIO pins so would it be any good or better to connect battery module plug with GPIO! (pin 3) straight into X-plug with GPIO! ( on pin 3 also)?

But then maybe this would cause problems becuase then GPIO pins 6 & 7 from battery module go on to UN pins 6 & 7 for X-plug.

Connecting different letter plugs is a bit confusing for me but would maybe this idea would work,

  1. attach extender or breakout module to Battery Module
  2. attach G-Plug Module to X-plug type on Cobra board
    ht/tps://www.ghielectronics.com/catalog/product/430
  3. use wires (and solder) to connect matching pins for +3.3v, +5v, GPIO!, GPIO, GPIO, and GND between Battery Module and Cobra Board
  4. Leave pins D- and D+ disconnected because they are not important?
  5. Then use in C# program code the same as normal (like if it was plugged into D plug)?

Since all you’re interested in is powering the device, the three “output connections” that the UC module gives you are GND, 5V and 3V3. All you need to do is connect those three pins, and you’re done.

You can easily do that (with other pins connected, but not used) by plugging the UC module into a non-D socket. The three required pins will be connected to the circuits on the mainboard, and you’re all good. You will need to be aware that you can no longer use the 3 pins that are pin3, pin4, and pin5 on the socket you plug them into - so choose carefully.

You can avoid “wasting” the pins and the socket, by connecting the UC module to a breakout module and wiring the GND, 5v, and 3v3 pins from the breakout to the appropriate locations on the edge connector of the Cobra2. You can also connect the pin3 to an AnalogIn pin on the edge connector and use that to get an indication of the voltage.

The simplest way - in my view - is to grab yourself some 2.1mm barrel plugs, and wire up something yourself.
Sourcingmap Plastic Cable Guard Male DC Power Plug Connector (Pack of 6) for sale online | eBay is one form of plug you could use, I have a heap of these that I use http://www.ebay.com.au/itm/20PCS-2-1mm-x-5-5mm-DC-Power-Plug-M-F-to-Screw-Terminal-CCTV-Camera-Connector-/351244791205?pt=AU_Electronics_Radio_Equipment&hash=item51c7d22da5

At the same time grab a AA holder and connect it up. Something like this http://www.ebay.com.au/itm/02070-Receiver-Battery-Case-Holder-Box-JR-Plug-4-x-AA-Nitro-RC-HSP-Spare-Part-/111412744082?pt=AU_Toys_Hobbies_Radio_Controlled_Vehicles&hash=item19f0b78f92 and chop the plug ? My concern is that only 4x regular batteries is probably too low a voltage and you might want to use a 5x or 6x holder instead. http://www.ebay.com.au/itm/4pcs-5-X-AA-5XAA-7-5V-BATTERY-HOLDER-PP3-CASE-W-Leads-i-/141113018356?pt=AU_Electronics_Batteries_Chargers&hash=item20dafdc7f4

I think this approach is much more flexible for the long term. You could replace the 4/5/6 x AA with a 2xAA and use “14500” rechargeable batteries like http://www.ebay.com.au/itm/1X-GTL-ICR-14500-Li-ion-3-7V-1600mAh-Rechargeable-Battery-for-Flashlight-HP-/161451906721?pt=AU_Electronics_Batteries_Chargers&hash=item25974896a1 or replace it with a 2x 16580 holder http://www.ebay.com.au/itm/Plastic-Battery-Storage-Case-Box-Holder-for-2-x-18650-Black-with-6-Wire-Leads-/400418497420?pt=AU_Electronics_Batteries_Chargers&hash=item5d3acd638c and http://www.ebay.com.au/itm/2x-18650-3800mAh-UltraFire-3-7V-Blue-Li-ion-Rechargeable-Battery-for-Flashlight-/351236975965?pt=AU_Electronics_Batteries_Chargers&hash=item51c75aed5d or really any battery you want - and leave the Cobra’s native regulator to handle regulating the voltage down to what you need.

(edited to clear this up a bit, I hope)
OK, so here’s a picture of a pushed together version of the dual 18650 battery option, first into the DP power module randomly plugged into socket 4. This will emulate your UC module’s connection straight into the socket, just with the standard cable, instead of plugging it into a D socket. The second picture is with the power source direct into the Cobra2 power socket. In both the processor was running although the battery voltage without load was 6v6, a little low; the first shot shows the WiFi connected it didn’t run for long :slight_smile: but I didn’t have two charged batteries, just one charged and one flat, but enough to prove it all works - but again, keep the voltage over 7v total if you can !

1 Like

Forgot to mention about D+ D-. There’s no need to worry about them because they are the USB data pins, and they are not exposed on the Cobra2 anywhere, they’re already connected to the onboard USB socket. Same goes for pin6, pin7, pin8, and pin9 as they are not connected (check the schematic of the UC module to confirm that). The only non-power related pin is pin3, which the schematic shows as a voltage reference (divided by the two resistors).

1 Like

Thank you again Brett, you help much to improve my understanding.

I like your idea for using battery pack with jack plug and later it will be easy for me to switch to lithium batteries.

My main hesitation for using the jack is if battery voltage can be monitored through the jack.
I wonder if it is possible to read/monitor battery voltage if using the jack plug (like UC battery module can do with pin 3)?
I think monitoring battery voltage will be good idea to warn when they are nearly flat so no unexpected power failures.

A lesser hesitation is that I am thinking about using the black case (forgot name for it) which fits the Cobra II board and in the empty space to put a battery holder (eg UC Battery Module or any one from links you give, or maybe even for lithium batteries) then when the case would be closed the Power Jack, USB, and SD card slots stick out the side and on back I can put a flap cover (like on calculators) so it is easy to change batteries while all wires and connections are hidden inside the box. But then if I use cable to connect battery-to-malejackhead-to-jackpowerplug then the wires would have to stick out of box to reach them.
This is not a big deal, just me thinking ahead for tidy design so always possible to try different design instead.
Otherwise I can try doing like in your first picture and get an extra USB Client DP Module to connect to spare letter plug which I can hide inside case (hopefully there is enough room inside case) and then connection would be battery-to-malejackhead-to-jackpowerplugmodule-to-letterPlugonCobraBoard.

Also, you mention that 4xAA batteries might not be enough for voltage.
Is this because of difference between voltage regulator for UC Battery Module and USB Client DP Module or because cobra board just needs higher voltage?

Could I just replace the 4xAA battery holder on the UC Battery module with a larger one (eg 6xAA) and still use the module okay?

I remember reading somewhere that we should try to keep supply voltages close to 5v for battery power supplies (recommended aim for 6v at lowest to allow leeway for when voltage drops during battery discharge) because for higher battery supply voltages we waste more power when voltage regulator has to convert down to 5v (eg 6v to 5v = small waste power, 9v to 5v = larger waste power).
I think 7v should not waste much more power than 6v (but maybe little bit wasted power can add up and reduce battery life), but would like to hear your opinion for best voltage regulator and best voltage for Cobra board.

One more question, for voltage regulators is their much difference between the one for UC battery module and the one for USB Client DP Module (one with power jack)?
Do they both have about the same efficiency?

Supposing that if the jack couldn’t monitor battery voltage and both modules have same efficiencies, would it be possible to just wire the lithium batteries to the UC module and then use its pin 3 to monitor them?

P.S. I appreciate the pictures you show of connecting lithium batteries with modules in different ways. They make it easier to understand and shows what I want to do with batteries for powering the Cobra II board. Now I must try to decide between UC Battery Module and USB Client DP (Power Jack) Module for which is best overall.

P.S.S It is good to know there is no importance to worry about using D+ and D- for powering Cobra board or monitoring voltage/data.

Thanks and sorry if my explanations are confusing.

Battery voltage cannot be monitored solely through the jack - you will need to have additional circuitry to do that. Given that the netmf hardware is only 3v3 tolerant on it’s Analog In pins, as a crude measurement you would need a pair of resistors forming a voltage divider (like the UC module uses) such that the voltage at the mid-point of the divider can never exceed 3.3v; this would then be connected to an Analog In pin and you can read the voltage there and extrapolate what the actual voltage would be.

My comment about 4xAA voltage was purely related to when that was fed into the Cobra2’s power socket as the specs say it requires 7v or greater. 4xAA nominal voltage is 6v, so you are already under spec for that. The Cobra2’s power supply is implemented basically the same as the DP module, so with the DP module and 4xAA you’d be under spec with that as well. And if you think that a battery may deplete to say 1.1v and still be “usable”, you are well under-spec. Contrast that with the maximum voltage they can handle and you can see that adding more batteries is not a problem, having less can be problematic.

The lower voltage is not an issue for the UC module, as it features a buck-boost regulator which can increase the input voltage to the desired output voltage - from that perspective it is better than the DP module for battery power.

There is a newer option in GHI’s catalog, the EDP module, which is lower cost than DP or UC modules. It uses low cost, low dropout linear regulators (which are of a lower efficiency). It’s specs say minimum 6v.

There are also other options https://www.ghielectronics.com/community/creations/entry/30 for example. This is a community creation and is able to charge lipo batteries, as well as providing actual battery capacity information (much more functional than the voltage divider used on UC module)

So you have many options. Sorry, I haven’t helped eliminate any of them :slight_smile: and worse I’ve added new ones :think:

Your profile says you’re an electronics enthusiast. How enthusiastic are you about some DIY work ? :slight_smile: In all seriousness, the key things you need are stable 5v and 3v3 outputs from your desired/flexible input, and a voltage divider as a minimum way to measure battery capacity, all routed to a Gadgeteer socket or 0.1" header (you choose). The options you have are sometimes overkill for what you need, and you may still need to have some custom circuitry; maybe you should just make this yourself ?

If I was doing this I would probably go the path of using a pair of LM1117 regulators (as the EDP module has) to take the ~6v minimum down to the 5v and 3v3 required outputs, and put a voltage divider in to give an indication of battery capacity, and have a set of screw-down terminals for incoming battery connection and some 0.1" header points for GND, 5v, 3v3, and AnalogIn that I could then jumper over to the Cobra2 edge connector. Not the most efficient option but sufficient for my needs. And I’d probably go with a 2x 18650 module as the starting point for power. I love those things (you may have guessed :slight_smile: )

1 Like

Hi Brett

Thank you for answering my questions and showing me different options.

The community module https://www.ghielectronics.com/community/creations/entry/30 does look useful, and I am enthusiastic enough to have a try at making my own battery module (will be good learning experience).

I think to start with I will just use a jack plug and solder with a battery holder, so that I can simply get my first project idea working to start with.
Then afterwards when it is working I will come back and use your suggestion to make a custom battery module for lithium batteries (because they will be good long term option for running finished project).

Thank you again for all your help.

P.S. I just noticed this article ht/tps://www.ghielectronics.com/docs/101/powering-the-board says to only have one power source (red board) connected at a time and that if the mainboard is red (Cobra II) then this counts as power source.
I think this just means that if I use UC Battery Module connected to any letter plug (like previous suggestion) then if I insert batteries to it then I must not connect anything to Jack Power Input or USB Power Input Sockets on Cobra board while batteries are inserted. But then if I remove batteries then it will be okay to connect power to them.
Is this correct understanding?
For curiosity, what problems would happen if I connect power source to Jack Input and insert batteries for UC Battery module at same time?

yes the Cobra is deemed a “red board”. And yes your understanding is correct - you can power the Cobra2 from the USB power (for example when you are deploying a new program) but you must not at the same time power it through the UC module or DP/EDP module connected to a socket, or a custom battery/regulator setup into the 5v and 3v3 rails. What would happen if you did do that could be nothing or it could be catastrophic - in some scenarios I could expect it might lead to exploding batteries or even shorted USB ports on laptops, so doing anything other than a jack plug into the barrel needs care. That’s one of the reasons I mentioned taping up the USB socket earlier. But do be ultra careful - that’s why the jack plug is in my view the most elegant solution, it’s easy to unplug when you need to turn off or reprogram your device and its very visible.

I did however find one more interesting connection - I just happened to turn over my Cobra2 and noticed there’s another power pin you might be able to leverage; the pin labelled “VIN” on the silk screen, is connected to the net named “12v” in the schematic, and is used as an equivalent input into the switching regulator. You could connect a 2x LiIon battery to that and GND and use that, which would meet your “neat” solution option if you mounted it in a case. As a minimum you’d still want an externally accessible switch to disconnect it (the off switch for the unit).

1 Like

@ Brett - Do you think that charging the battery is possible over the Vin and GND?

To explain what i’m trying to do… I’m using the polycase boxes for the cobra and a litium battery inside the box. Since there is a nice cutout for the power adapter in the case, I was planning to use that input for charging the battery (and powering the board at the same time when running with power adapter). The battery would be connected to an on/off switch to be able to power it on and off when running on battery. I attempted to solder the 12v+ to a pin on the back of the card where the dc-in is soldered. But it did not work. It’s like I have to connect an adapter cable in the actual power input for it to power up.

Sorry, I’m not quite sure what you mean, but I think the answer is NO.

If I am understanding you, you want to be able to power the Cobra with a battery pack, and if you’re connected to a power source (barrel jack) you want to power the Cobra as well as recharge the battery. Typically, that isn’t going to work unless your battery has an intelligent charger that can figure that out, and your power supply can deliver the current needs of the cobra and the charge circuit.

Can you describe what you have connected to what ? I assume you have the battery GND connected to the GND on the Cobra (via pin header I assume?) and you have the battery + connected to VIN (I assume?) via a switch. Say for example you power the device with a 7.2v battery (typical 2cell LiPo battery voltage), but then connect a 12v supply to the barrel jack - you’re then “charging” the battery with 12v directly, well above it’s recommended charge voltage. I personally would not want to do anything like this with LiPos, far too “excitable” to be doing this (of course with different Lithium chemistries there’s different levels of issue). I’d suggest like I did before, a barrel jack and an ugly wire coming out of your case and into the barrel jack when you want to power by lipo, and you disconnect it and plug the charger into that when you want to charge. There are possibly ways you could get a 3-way switch (off, on, charge) and a second power input socket working, but you still need to supply the charge voltage / current not just a general voltage unless you also have battery charge/management internally.

Managing power scenarios like this requires a good understanding of the specifics, so maybe it would be OK for you but with the level of info I have I am not comfortable suggesting a workable solution.

@ Brett - Thank’s for answering, I did not see it until now! The battery is 12V and right now I have a cable hanging out of the box that I connect to the cobra, and If i want to charge the battery I plug it into a charger. I have one switch that controls power to the “cable” and that needs to be on while charging. The battery is also connected to an output where I connect a sensor that needs 12V. I would like to connect that sensor to some pin on the card that can supply 12V.

circuit diagram ! :slight_smile: It would really help if you would show what you have connected where.

There’s no reason you can’t get this all to work, but you need to know that 12v charging is supplying more like 14.4v and if that’s also powering a sensor then the sensor has to be OK with that (as well as the sub-12v level when battery voltage gets way down). It’s not necessarily going to be “simple”, but it will need some thought put into it…

Were you thinking something like this? Right now I move the power plug from the cobra, and plug the charger in to the battery. It would be more elegant to connect the battery and sensor straight to the cobra card, and not have to have a cable hanging out.

@ Brett - Posted an image to explain how they are connected.

ok, so based on that, nothing is powered from the battery unless the switch is closed, correct? And the same for charging, it’s not charging unless the switch is closed, and when the battery is charging the device is also powered. So it’s a total battery isolator. And you confirm the device as a whole works fine when the battery is charging (~14.4v)?

In this scenario, there’s no real reason you can’t make it work with only “internal” connections, BUT you need to make sure you are only using power supplies that conform to the battery charging maximums and the sensor input maximum, not the potential 30v input that the Cobra is rated to handle. Big sticker “Connect only 12v battery charger” to make sure :slight_smile: The VIN pin just becomes a directly connected pin to both the sensor and the battery + (through the switch; I’d leave the sensor on VIN direct) so that when you are powering directly from the battery you must have the switch on to power the sensor and the cobra, when you have the switch off you can connect the charger power source to the barrel jack and it will all run, or you then turn the switch on and it will charge as well as run. I’d also add a fuse between battery and switch as a safety measure.

Remember, none of this is going to manage your battery voltage, you run the risks of over- or under-voltage. You’ll also draw some current to the cobra when charging, so your intelligent charger may not detect the decreased current draw when the battery gets full. Because you’re re-purposing the VIN line as a charge line, you aren’t going to be able to work around that; if that’s a concern the best you could do is use a separate charge socket that eliminated the battery from the power circuit when charging could be used. For my model gliders, I use a bulkhead connector for this, and use it as “always on” unless there’s a plug inserted; I have a “dummy” plug that I use to turn it off and the normal charge plug goes into charge mode, but you may want something different to that.

@ Brett - Correct, the battery is disconnected once the switch is of. The sensor can handle the over-voltage. I’m not sure about the input on the Cobra that recieves the (PNP) signal from the sensor. I will need measure the sensor to test that.
So then the battery would pass the switch, and then to VIN. The sensor directly to VIN. If the over-voltage would cause the inputs to fail, I think that the idea with a separate charge-jack might be the best. Thank you Brett!!

Sorry, let me be clear.

The input on the cobra is a digital signal (or an analog signal, either way). The sensor has to output a signal that the cobra can read - it is doing that already. If that sensor can output more than 3v3 signal, you should do something to protect it (or 5v if the pin and feature you’re using is 5v tolerant). If the output signal varies with input signal, then you need to protect against the upper limit that both charging and running from battery would give.

A separate charge jack on it’s own will not change the situation - and I may have been misleading/unclear (again) in what I said. While ever you are drawing current to power a circuit and charge a battery, a current sensing charger could mis-interpret that. You should look at what your charger’s behavior is to be crystal clear what is going to happen. The topology I suggested would allow you to isolate the battery from the Cobra/sensor when under charge, hence eliminating that effect