HTCC-AB01 pinout in datasheet

hello all.
have bought 4 boards HTCC-AB01 from aliexpress - checking if I can use it instead Moteino in my project.

and I noticed that in datasheet tab on https://heltec.org/project/htcc-ab01/
there is some info that I cant understand…
look - there is diagramm with pinouts and two tables with pin descriptions - Header J2 and J3.

And on module diagram I can see only 11 pins on each side, but on tables stated 18 pin for each header… I dont understand this.
diagram show us thta there is 8 GPIO - from 0 to 7.
can I use every of this 8 pins for my needs, or some pins used by board (Lora module, etc)?
because for my project I need:

laser:
2 digital pins for RX and TX for SoftSerial
1 digital pin for powering laser (via powerswitch/mosfet)

thermo:
1 digital pin for 1-Wire data
1 digital pin for powering 1-Wire

photoresistor:
1 digital pin for powering
1 analog ping for reading data from photoresistor

checking battery status:
1 analog pin for reading data from voltage divider.
but I’ve read that on this CubeCell board thereis builded capability to read info from battery…
idk if I can use it if I power board from LiPo battery via Vin pin (5v)

so at least I need - 6 digital pins and 2 analog pins

So my question - is this possible to use this board HTCC-AB01 for my purposes?
thank you

I’m not sure you’re looking at the right table. There are only 11 pins on each side the Cubecell Dev-Board, and two more in the middle of the board. There are actually more than 8 GPIO pins, but some are used for on-board functions and so are not really available for general use.

You can use the I2C pins, SCL and SDA, for anything you’d normally use a GPIO pin for, if you don’t need the I2C bus.

I’m not sure what you mean by ‘powering’ but if you mean ‘supplying power’ then I think you could provide power to all [3.3V] devices from the Vext pin, which you can switch on and off. If you mean ‘activate’ then, yes, you’ll need separate pins.

You should be able to use the pins marked GPIO0, GPIO1, GPIO2, GPIO3, GPIO5, SCL and SDA for general digital functions (I’m sure someone will correct me if I’ve missed something there).

The CubeCell only has a single ADC (only one analog pin) so, provided you use the internal control (GPIO7) to switch between reading the battery and reading the ADC pin, you could manage with just the one (EDITED: You might want to read this post and this FAQ before trying to use the ADC for both battery voltage measurement and external input). My recollection, though, is that the battery that is read this way is the battery that is plugged into the onboard JST 1.25 connector, not one that might be connected to any of the ‘power’ pins. You may also need a voltage divider on the ADC input, as it is limited to 2.4V.

If you need more than one analog pin, you probably need the CubeCell Dev-Board Plus, which has three.

1 Like

thank you very much.
a lot of very useful advices.
if you dont mind - another questions:

  1. about tables with headers info - Im looking at the tables on pages 6 and 7 in datasheet on this address:
    https://heltec.org/project/htcc-ab01/

  2. You should be able to use the pins marked GPIO0, GPIO1, GPIO2, GPIO3, GPIO5, SCL and SDA

great news, thank you! so I suppose that I can’t use GPIO4 because it used by RGB led?

  1. but if you mean ‘supplying power’ then I think you could provide power to all [3.3V] devices from the Vext pin, which you can switch on and off.

in the first case I need provide power to my DS18B20 termosensor.
on my current device (arduino) I just connected it, for example, to GPIO5 and use the code:

    digitalWrite(GPIO5, HIGH);

and sensor start to work.
in second case I use another GPIO to enable-disable mosfet, which controls external power (from LiPo) to laser module. but it also works via similar code with digitalWrite…

so - can I use CubeCell GPIO’s like this or it would be better to use Vext and somehow switch it on and off?

  1. how to enter board into sleep mode? it is very important for my project… currently I have about ~10uA power consumption, but hope that with this board it would be less.

thank you in advance.

OK, I see that now. That’s an error on Heltec’s part. Those tables are for the WiFi LoRa 32 V2 board—a bit of poor cutting & pasting in document preparation I’d say. If someone from Heltec reads this, maybe they could see to getting the document corrected.

With respect to GPIO4, effectively, yes. I think (but I’m not sure) you could still use that pin, but the LED would flash or whatever while you were using it. This, at least, is what I’ve observed on other boards.

Well, I must confess that I’d never considered using a GPIO pin to power something like the DS18B20—I have always used Vext for this purpose. In the case of your MOSFET switch, yes, I think that needs to be done with a regular GPIO pin, although, if you can power a device through a GPIO pin, I don’t really see why you couldn’t control a MOSFET through a (switchable) power (Vext) pin. You will generally be turning Vext off before you go to sleep, so it would probably achieve the same end.

There are examples of how to control power supply to the Vext pin in the IDE example sketches.

Deep sleep is a little more tricky but, once again, examples are provided in the IDE example sketches for the CubeCell. This is sometimes not entirely straightforward though, so you might do well to check for other posts on this subject on this forum. For what it’s worth, there are also examples of how I do this on my project website.

1 Like

Probably anyone reading this, has already purchased these and fell into the trap of lack of documentation regarding Battery voltage measuring on the Version 1 HTCC-AB01. My guess is that’s why there is a version V2. The old version does not wake from sleep and can’t measure the battery voltage. Two main important functions. I have just made the mistake as i found them cheap and purchased 5 of them. They are useless for low power applications .And will end up throwing them away. When before i only use the V2 version.

Just for the record, I do have a couple of V1 boards operating as battery powered atmospheric monitors (BME280). In addition to reporting atmospheric parameters, they read and report the battery voltage, as one might expect, go to sleep for 60 seconds, then wake and repeat the cycle. These have been running for several years now without requiring anything more than a periodic battery charge. The relevant details are provided on the Project Background page (Arduino > Hardware > Background) of the project website noted in my previous post above.

My code is written for VScode for the HTCC-AB01 v2. that reads the battery voltage and wakes and sleeps and working WDT. However this code does not work on the V1.
I had a look at your link and my sleep handling is the same as yours.
However i can’t see in your code how you are reading the battery voltage

platformio.ini as follows:

[env:cubecell_board] ; HTCC-AB01 V1
board = cubecell_board ; SHOULD BE ‘cubecell_board’ But the battery voltage measurement is wrong with this setting
board_build.mcu = asr6501 ; Different MCU for V1 (BATTERY VOLTAGE MEASURMENT PROBLEMS)
board_build.f_cpu = 48000000L

;[env:cubecell_board_v2] ; HTCC-AB01 V2
;board = cubecell_board_v2 ; cubecell_board_v2
;board_build.mcu = asr6502x ; asr6502x Different MCU for V2 (BATTERY VOLTAGE WILL SHOW 0 IF WRONG MCU)
;board_build.f_cpu = 48000000L

Unfortunately, I’m not at all familiar with PlatformIO and barely conversant with regard to VSCode. Using the Arduino IDE and the libraries loaded therein, reading the battery voltage on the CubeCell platform involves nothing more than a call the relevant built-in function:

      uint16_t batteryVoltage = getBatteryVoltage();

I believe that I’ve used this function on both V1 and V2 boards, as well as the CubeCell Plus board, and that any version specific details are handled internally and automatically, as discussed on the Software > Battery Management page on the aforementioned project website.

Found a few differences between the V1 and V2 while coding with Visual Studio.
V1 wakes from sleep when it receives a packet and sleeps again after set time but V2 does not wake. Not sure on the amp draw on the V1 in sleep mode because the radio is running. Would be interested on how to switch this off or enable this in the V2. With V1 in visual studio the voltage is read as zero when using board = cubecell_board ; . But if I use the board = cubecell_board_v2 in the platform.ini file it reads correctly. I will have a look at the amp draw in the coming days to see how much the difference is between both versions. As always listening actually suits my application better. As i only want the sensor to send a reading only when requested by the base module.

… The old version does not wake from sleep and can’t measure the battery voltage. Two main important functions

Well, like @UniquePete, I also have several temperature sensor nodes in use, based on AB01 v1. They upload temperature data every 15minutes and battery voltage once per day, since 2022. Sleeping current is 7uA, can probably be reduced a bit more by changing temp. sensor wiring.
Done with VSC + PIO.

I recently put that stuff on GitHub.

To save you some digging through that, here’s the code doing battery voltage measurement:

/**
 * @brief Measure battery voltage and scale down to 7-bit
 * For ADC in single-ended, unsigned mode:
 *  Vplus     value
 *  0         0
 *  Vref      0x800 (2048)
 *  2 x Vref  0xfff (4095)
 * 
 * Vref = 1.2 V -> max. ADC input = 2.4 V -> Vbat max. = 4.8 V
 * Resolution: 4800 / 4095 = 1,17 mV/increment
 * (Measured: ADC value 3551 / Vbat 4.13V = 1,16 mV/increment)
 * 
 * Expected max. Vbat ≈ 4.3 V, or 34 mV/increment using 7-bit
 * (representable voltage range: 0 - 4.318 V)
 *
 * @return voltage as 7-bit value
 */
int8_t BatteryVoltage(void) {
  pinMode(VBAT_ADC_CTL, OUTPUT);
  digitalWrite(VBAT_ADC_CTL, LOW);

  // ADC value to 7-bit scaling: 3684 (≈ ADC value @ 4.318 V) / 127 = 29
  int8_t v = (2 * analogRead(ADC) + 29) / 58; // rounding & scaling
  digitalWrite(VBAT_ADC_CTL, HIGH);
  pinMode(VBAT_ADC_CTL, INPUT);

  return v;
}