Hello All,
i’ve trying to get LORAWAN library LMIC/ARDUINO port (https://github.com/matthijskooijman/arduino-lmic) to work with the bluepill. I’ve installed STM32DUINO from guithub ( https://github.com/stm32duino/Arduino_Core_STM32 ) as per instructions. LORA module that i have is based on semtech sx127x (various chips in family SX1272/76/78 depending on frequency support but essentially work the same)
I’ve installed the library from arduino boards manager (from pull down menu, v1.5+arduino-2) which compiles for the bluepill (generic stm32f103 from ebay) other versions do not compile and various errors like stdout etc..
now, coming to my problem, i think there is some problem with interrupts. If i run the abp/otaa examples, although they compile properly, i do not anything in the serial monitor other than an S and it just does nothing. if i press the reset another S is printed.
On investigating a little further, in the file hal.cpp (https://github.com/matthijskooijman/ard … l.cpp#L184 ) i commented out noInterrupts(); in line 184. Now i see the following:
Starting message
packet queued
and then it just hangs from there..There is # define line to increase debug level to 2 in src/lmic/conifg.h follwing lines get printed in that case:
CODE: SELECT ALL
Starting
RXMODE_RSSI
148945: engineUpdate, opmode=0x8
149130: Scheduled job 0x20000aa8, cb 0x800298b ASAP
Packet queued
156224: Running job 0x20000aa8, cb 0x800298b, deadline 0
156541
:
EV_JOINING
176874: engineUpdate, opmode=0xc
177059: Uplink join pending
177214: Airtime available at 502627 (previously determined)
177546: Uplink delayed until 502627
177746: Scheduled job 0x20000aa8, cb 0x8002991 at 502502
502502: Running job 0x20000aa8, cb 0x8002991, deadline 502502
502846: engineUpdate, opmode=0xc
503030: Uplink join pending
503186: Airtime available at 502627 (previously determined)
503518: Ready for uplink
503711: Updating info for TX at 503030, airtime will be 3856. Setting available time for band 0 to 4359030
504475: TXMODE, freq=433175000, len=23, SF=7, BW=125, CR=4/5, IH=0
then under “Software” (link on the left side) you get a link to:
Finally you will need the Arduino LMIC library adapted for the STM32:
I’ve managed to send packets which are received by TTN application gateway but the sensor node doesn’t get any acknowledgement downstream…so after sending it once, the node just sits idle…to get it to work, i had to comment out noInterrupts(); in hal.cpp ( https://github.com/matthijskooijman/ard … l.cpp#L184 ) and then there is one assert fail in line 660 in radio.c while reading some status register of the lora node..then i wen on the comment out that line also : https://github.com/matthijskooijman/ard … dio.c#L660 ASSERT( (readReg(RegOpMode) & OPMODE_MASK) == OPMODE_SLEEP );
[iotnode – Fri Apr 13, 2018 10:35 pm] –
But i think this problem is not restricted to the official core alone…
It is not enough to “think”. As long as you use only the STM core, this issue belongs here.
Frederik (@fpiSTM) can support you, dependent on his time.
If you try and have problems with the libmaple (Roger’s Arduino_STM32) core, then that would be a different story.
As it is tested with Roger’s Core using a BP, I think you should use it instead of STM core. BP are better supported with Roger’s core.
Anyway, it should be possible to do it working with STM core but honestly, I miss time to investigate this. I’ve more and more core feature to review and merge without talk about stm32duino libraries I need to review.
Anyway, if you want continue to investigate this lib using STM core, I will try answer you.
thanks everyone for the help. And by the way, why two core for the bluepill. there is already a huge confusion due to multiple versions of this library and multiple versions of this core. if we look at various permutations/combinations, it is already massively huge confusion….
any links where the differences between the two are given?
https://gist.github.com/tomtor/c754355f … 5f236d990e :
first and foremost:
spi is called by SPI.begin() and consequently all other following operations of spi. now, we have to modify the lmic library (currently i use tomtor library here: https://github.com/tomtor/arduino-lmic
in hal.cpp we have to comment out lines where interrupts are disabled
https://github.com/tomtor/arduino-lmic/ … l.cpp#L212
https://github.com/tomtor/arduino-lmic/ … l.cpp#L228
then various calls are not defined, i commented those out like adc_enable/adc_disable INPUT_ANALOG libmaple/power.h libmaple/scb.h I also disabled #define SLEEP.
In the modified form,the sketch looks like this:
https://github.com/iotlearner0level/TTN … tomtor.ino
I can see data on the TTN CONSOLE but only once after reset…
Now i want to add OLED for displaying messages etc, please guide how to do that. If i replace all calls to Serial.println, it just hangs doing nothing..
@fpiSTM Your comments are greatly appreciated..
It seems that in the case of ARDUINO_ARCH_STM32F1 (Roger’s core Arduino_STM32), IRQ are not disabled.
https://github.com/tomtor/arduino-lmic/ … l.cpp#L196
#ifdef ARDUINO_ARCH_STM32F1
//
// Not clear why we need to disable interrupts when we are just polling
// the GPIO pins. Anyway, disabling interrupts prevents the output of the
// UART in hal_failed(), so we don't disable IRQs for the STM32 which appears
// to work just fine
//
#if defined (ARDUINO_ARCH_STM32F1) || defined (ARDUINO_ARCH_STM32)
[iotnode – Sun Apr 15, 2018 11:59 am] –
Also, i don’t understand why there are two cores for stm32/arduino?
History: viewtopic.php?f=42&t=97
i’ve somehow managed to get the node running with periodic updates on the stm32duino(https://github.com/stm32duino/Arduino_Core_STM32) core currently only abp gives me TX_COMPLETE there is some problem with OTAA activation right now. i’ve set up my TTN account to “decode” bmp180 Pressure, temperature and altitude..
I am experimenting with batteries, so i am interested in sending Vcc voltages..i tried to follow the example from here: viewtopic.php?t=707 but it doesn’t work out gives compiler warnings. Any suggestions?
Further, i would like the bluepill to go to sleep, how do i set it up on the “official” stm32duino core with hal or api, any examples?
sketch i am working with is currently in this form: https://github.com/iotlearner0level/TTN … v3oled.ino
thanks.
https://github.com/stm32duino/STM32LowPower
I’m currently reviewing it and the STM32 RTC library used for the LP.
[fpiSTM – Sat Apr 21, 2018 8:19 am] –
In the coming week(s) the STM32 Low power library will be available
https://github.com/stm32duino/STM32LowPowerI’m currently reviewing it and the STM32 RTC library used for the LP.
You tease, there’s nothing in that git repo yet
I was hoping for some half tested code to peruse.
[ahull – Sat Apr 21, 2018 11:31 am] –
You tease, there’s nothing in that git repo yetI was hoping for some half tested code to peruse.
There is 1 PR I’m currently review the RTC Library required by the LP one.
also, i want to read the Vcc or the Vin voltage fed to the microcontroller….is it possible? i think stm32 has some inbuilt circuitry and channel 1 adc can be reconfigured to read that…but don’t know how to do that?
E.g. google for
stm32duino adc vcc
Gets you an instant result.
Note. Most of the posts on this forum are for the LibMaple Core, not the HAL core.
But the underlying principles are the same.
If you need answers to questions about how to use the HAL to do specific things , eg.. control the ADC input, you would be better off posting to STMs own official community as hardly anyone on this forum uses the HAL
[RogerClark – Sat Apr 21, 2018 9:07 pm] –
It’s going to be quicker if you just google for the answersE.g. google for
stm32duino adc vcc
Gets you an instant result.
Note. Most of the posts on this forum are for the LibMaple Core, not the HAL core.
But the underlying principles are the same.
If you need answers to questions about how to use the HAL to do specific things , eg.. control the ADC input, you would be better off posting to STMs own official community as hardly anyone on this forum uses the HAL
of course i tried google, but that did not work out, only then i posted it to the forum…i thought thats what forums are for! besides i was under the impression, judging by the name of the fourm, that both the cores are somehow related…evidently this is not the case!!
anyway, i think it is better to wait for some more time as the hal core is under development with new features rolling out..
People do post about the STM core but that’s probably 5% of the posts, and hardly any of those posts related to the HAL.
The post that google returned will contain valid data about controlling the ADC at the register level, which you could do in STM’s core as much as in the LibMaple core.
The names LibMaple uses for the registers are based on STM’s own docs.
for the following code:
int readVInt()
{
adc_reg_map *regs = ADC1->regs;
regs->CR2 |= ADC_CR2_TSVREFE; // enable VREFINT and temp sensor
regs->SMPR1 = (ADC_SMPR1_SMP17); // sample rate for VREFINT ADC channel
int vref = 1210 * 4096 / adc_read(ADC1, 17); // ADC sample to millivolts
regs->CR2 &= ~ADC_CR2_TSVREFE; // disable VREFINT and temp sensor
return vref;
}
https://github.com/stm32duino/Arduino_C … 3×6.h#L702
https://github.com/stm32duino/Arduino_C … 3×6.h#L157
So instead of:
adc_reg_map *regs = ADC1->regs;
regs->CR2 |= ADC_CR2_TSVREFE; // enable VREFINT and temp sensor
regs->SMPR1 = (ADC_SMPR1_SMP17); // sample rate for VREFINT ADC channel
I thought the STM core used the HAL… But I supposed the CMSIS is quicker and easier for some things ?
[RogerClark – Mon Apr 23, 2018 5:18 am] –
Hi FredericI thought the STM core used the HAL… But I supposed the CMSIS is quicker and easier for some things ?
STM HAL and LL are based on CMSIS. so you can also directly use the CMSIS
(LL do that in fact)
Thanks.
[fpiSTM – Mon Apr 23, 2018 5:12 am] –
STM core uses CMSIS so the way accessing registers is different.https://github.com/stm32duino/Arduino_C … 3×6.h#L702
https://github.com/stm32duino/Arduino_C … 3×6.h#L157
So instead of:
adc_reg_map *regs = ADC1->regs;
regs->CR2 |= ADC_CR2_TSVREFE; // enable VREFINT and temp sensor
regs->SMPR1 = (ADC_SMPR1_SMP17); // sample rate for VREFINT ADC channel
Clock, prescaler, conv,…
Currently the core init ADC only when it is used thanks analogRead.
[fpiSTM – Mon Apr 23, 2018 7:17 pm] –
That’s sound logical as ADC is not initialized.![]()
Clock, prescaler, conv,…
Currently the core init ADC only when it is used thanks analogRead.
Here comes the dumb question, where do i put analogRead. if i put in setup(), pinMode(17, INPUT) followed by analogRead(17); it is still the same… please bear with me, i am just another hobbyist…don’t properly understand the internal workings and initialisation sequence..
The configuration done for the analogRead could not be used for this.
If you really want do that, you will have to configure properly the ADC1 before using it during the setup().
You could check how it is done in the Cube Fw example.
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
** This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.
*
* COPYRIGHT(c) 2018 STMicroelectronics
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f1xx_hal.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private variables ---------------------------------------------------------*/
ADC_HandleTypeDef hadc1;
/* USER CODE BEGIN PV */
/* Private variables ---------------------------------------------------------*/
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_ADC1_Init(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE END PFP */
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/**
* @brief The application entry point.
*
* @retval None
*/
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_ADC1_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInit;
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = 16;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Configure the Systick interrupt time
*/
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
/**Configure the Systick
*/
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
/* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}
/* ADC1 init function */
static void MX_ADC1_Init(void)
{
ADC_ChannelConfTypeDef sConfig;
/**Common config
*/
hadc1.Instance = ADC1;
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 1;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Configure Regular Channel
*/
sConfig.Channel = ADC_CHANNEL_VREFINT;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
}
/* USER CODE BEGIN 4 */
/* USER CODE END 4 */
/**
* @brief This function is executed in case of error occurrence.
* @param file: The file name as string.
* @param line: The line in file as a number.
* @retval None
*/
void _Error_Handler(char *file, int line)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
while(1)
{
}
/* USER CODE END Error_Handler_Debug */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
thanks again!
uint16_t adc_read(uint32_t channel)
{
ADC_HandleTypeDef AdcHandle = {};
ADC_ChannelConfTypeDef AdcChannelConf = {};
__IO uint16_t uhADCxConvertedValue = 0;
AdcHandle.Instance = ADC1;
AdcHandle.State = HAL_ADC_STATE_RESET;
AdcHandle.Init.DataAlign = ADC_DATAALIGN_RIGHT; /* Right-alignment for converted data */
AdcHandle.Init.ScanConvMode = DISABLE; /* Sequencer disabled (ADC conversion on only 1 channel: channel set on rank 1) */
AdcHandle.Init.ContinuousConvMode = DISABLE; /* Continuous mode disabled to have only 1 conversion at each conversion trig */
AdcHandle.Init.DiscontinuousConvMode = DISABLE; /* Parameter discarded because sequencer is disabled */
AdcHandle.Init.ExternalTrigConv = ADC_SOFTWARE_START; /* Software start to trig the 1st conversion manually, without external event */
AdcHandle.Init.NbrOfConversion = 1; /* Specifies the number of ranks that will be converted within the regular group sequencer. */
AdcHandle.Init.NbrOfDiscConversion = 0; /* Parameter discarded because sequencer is disabled */
if (HAL_ADC_Init(&AdcHandle) != HAL_OK) {
return 0;
}
AdcChannelConf.Channel = channel; /* Specifies the channel to configure into ADC */
AdcChannelConf.Rank = ADC_REGULAR_RANK_1; /* Specifies the rank in the regular group sequencer */
AdcChannelConf.SamplingTime = ADC_SAMPLETIME_13CYCLES_5; /* Sampling time value to be set for the selected channel */
/*##-2- Configure ADC regular channel ######################################*/
if (HAL_ADC_ConfigChannel(&AdcHandle, &AdcChannelConf) != HAL_OK)
{
/* Channel Configuration Error */
return 0;
}
/*##-2.1- Calibrate ADC then Start the conversion process ####################*/
if (HAL_ADCEx_Calibration_Start(&AdcHandle) != HAL_OK) {
/* ADC Calibration Error */
return 0;
}
/*##-3- Start the conversion process ####################*/
if (HAL_ADC_Start(&AdcHandle) != HAL_OK) {
/* Start Conversation Error */
return 0;
}
/*##-4- Wait for the end of conversion #####################################*/
/* For simplicity reasons, this example is just waiting till the end of the
conversion, but application may perform other tasks while conversion
operation is ongoing. */
if (HAL_ADC_PollForConversion(&AdcHandle, 10) != HAL_OK) {
/* End Of Conversion flag not set on time */
return 0;
}
/* Check if the continous conversion of regular channel is finished */
if ((HAL_ADC_GetState(&AdcHandle) & HAL_ADC_STATE_REG_EOC) == HAL_ADC_STATE_REG_EOC) {
/*##-5- Get the converted value of regular channel ########################*/
uhADCxConvertedValue = HAL_ADC_GetValue(&AdcHandle);
}
if (HAL_ADC_Stop(&AdcHandle) != HAL_OK) {
/* Stop Conversation Error */
return 0;
}
if(HAL_ADC_DeInit(&AdcHandle) != HAL_OK) {
return 0;
}
return uhADCxConvertedValue;
}
void setup() {
Serial.begin(115000);
analogRead(A0); // Workaround to init g_current_pin used in HAL_ADC_MspInit
}
void loop() {
float Vdd = readVdd();
Serial.print("Vdd= ");
Serial.print(Vdd);
Serial.print(" V Temp= ");
Serial.print(readTempSensor(Vdd));
Serial.println(" °C");
delay(500);
}
static float readVdd()
{
return (1.20 * 4096.0 / adc_read(ADC_CHANNEL_VREFINT)); // ADC sample to V
//return (1200 * 4096 / adc_read(ADC_CHANNEL_VREFINT)); // ADC sample to mV
}
static float readTempSensor(float Vdd)
{
return ((1.43 - (Vdd / 4096.0 * adc_read(ADC_CHANNEL_TEMPSENSOR))) / 0.0043 + 25.0);
}
Vdd= 3.20 V Temp= 43.22 °C
Vdd= 3.20 V Temp= 43.58 °C
Vdd= 3.20 V Temp= 43.22 °C
Vdd= 3.20 V Temp= 43.58 °C
Vdd= 3.20 V Temp= 43.95 °C
Vdd= 3.20 V Temp= 43.58 °C
Vdd= 3.20 V Temp= 43.95 °C
Vdd= 3.20 V Temp= 43.40 °C
[fpiSTM – Wed Apr 25, 2018 12:07 pm] –
It’s only a workaround. Clean way will be available thanks the ADC library and probably with limited usage of the HAL but using the LL if possible.
still many thanks. because i want to keep the TTN node powered by battery. instead of attaching a battery capacity meter, i can now directly see the Vcc reading in the TTN console. i’ve forwarded all the TTN payload data to google firebase using its rest API. So i don’t even need to open the TTN console altogether.
In future, i’ve plans to add something like https://www.aliexpress.com/item/Ultra-s … 23174.html to convert solar and feed it to 5V pin and also simultaneously connect various batteries like 4xNiMh, 2-parallel 18650 lipo, 2-series 18650 etc. I’ve experimented already with 4xNiCD (approx 5 hours), 4xNiMh (approx 10 hours), 1×18650 (approx 10 hours), 2-parallel 18650 (approx 15 hours), 2-series 18650 (6V-8.4V fed to 5V Vin directly) approx 20 hours along with an OLED, sx1278 lora ra01 modem, and an electrical parameter tester approx consumption is 80mA with everything.
When sleep mode becomes available, this will be really helpful in these scenarios. I’ll slowly add a dust https://www.aliexpress.com/item/GP2Y101 … 51689.html or bme280 etc…i’ve another project, to add a bicycle power meter, like this one: https://www.youtube.com/watch?v=ZZnG135o4ZQ a wind meter (a simple motor with a fan) etc….
i am also looking for a sim based lora gateway, like the esp single channel gateway, but for internet use a GSM (or a 3g) module like the aithinker A6 SIM800 etc. in that case, i will just add sufficient solar power and hide it in various places
for making lora gateways!
Right now i don’t have that much time, but i hope one day this will become a reality!
But today i am very happy, because my TTN node has become quite portable with Vcc monitoring!
I did some tests on a small solar panel to charge a LiPo cell via a charge controller and used a LDO regulator to convert its output to 3.3V.
There are various posts online, about modifying a USB charge controller to limit the charge current to match the size of the solar panel, by replacing one resistor on the charge controller .
Generally the best advice is to use a bigger solar panel than you think you need.
It’s cheaper to buy 2 or 3 cheap “1W” panels, than to mess around with optimising the power extraction from one panel
[RogerClark – Wed Apr 25, 2018 9:52 pm] –
Slightly off topic, but normally it’s not a good idea to use a buck converter from a solar panel to convert the voltage.I did some tests on a small solar panel to charge a LiPo cell via a charge controller and used a LDO regulator to convert its output to 3.3V.
There are various posts online, about modifying a USB charge controller to limit the charge current to match the size of the solar panel, by replacing one resistor on the charge controller .
Generally the best advice is to use a bigger solar panel than you think you need.
It’s cheaper to buy 2 or 3 cheap “1W” panels, than to mess around with optimising the power extraction from one panel
Thanks for suggestions. i’ve a few “fairly large” solar panels at 12V and 24V o/p. open circuit voltage is quite high than the rating. for example 24V panels have 32V if i measured it correctly. to get a low voltage device like microcontrollers to work, 2-step looks safer, however that may violate second voltage regulator’s limit. to charge the 1xlipo, tp4056 is a good option. however, not sure about the 4xNiMh (gives about 5.4V when the nimh are fully charged) for the lipo bluepill’s voltage regulator seems to work ok. infact, these work ok even upto 8.4V and even for the case when lipo are depleted below 3.5V. but my electrical parameter tester dies below 4V so can’t say much.
however for lower power solar, i’ have not tested yet. will try in a month or two when i have somewhat more time. this video series for solar for small devices is quite helpful: https://www.youtube.com/watch?v=ffLU7PS … 98qK_75g-m
thanks.
I thought you may be powering it from a small 6V PV cell (which is quite common)
Re:Using the BP’s internal regulator
I think its cheap and probably takes current even when the BP is in sleep mode.
You’re probably going to need a separate external LDO.
I forgot which ones I use but I’ve been running a nRF51822 BLE MCU on a 220mAH lipo via a LDO for several months even with no solar feed into the LiPo, and it is still running.
I doubt if that would be case if I’d been using a regulator from a BluePill
some peripheral like the ssd1306 also “hangs” at lower voltages than 3.3V. clearly there are a lot of possibilities.
right now i don’t have knowledge & time to modify the core, besides creating lots of confusion.
For nRF51822 I normally use the official SDK /API rather than Sandeep’s core as I needed to do some complex things, not supported by his core.
(time is probably GMT/UTC)
From the TTN storage integration:
Response Body
[
{
"altitude": 173,
"chipTemp": 45.51,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCPcRxw==",
"temperature": 32.7,
"time": "2018-04-26T15:08:31.886672246Z",
"voltage": 2.295
},
{
"altitude": 173,
"chipTemp": 49.07,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCJwTKw==",
"temperature": 32.7,
"time": "2018-04-26T15:09:43.815344082Z",
"voltage": 2.204
},
{
"altitude": 173,
"chipTemp": 48.57,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCK8S+Q==",
"temperature": 32.7,
"time": "2018-04-26T15:09:48.870310385Z",
"voltage": 2.223
},
{
"altitude": 173,
"chipTemp": 47.48,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCKwSjA==",
"temperature": 32.7,
"time": "2018-04-26T15:09:59.018495216Z",
"voltage": 2.22
},
{
"altitude": 173,
"chipTemp": 48.14,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCKASzg==",
"temperature": 32.7,
"time": "2018-04-26T15:10:09.111891725Z",
"voltage": 2.208
},
{
"altitude": 172,
"chipTemp": 47.36,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsCL0SgA==",
"temperature": 32.7,
"time": "2018-04-26T15:10:14.443139847Z",
"voltage": 2.237
},
{
"altitude": 172,
"chipTemp": 48.53,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsCJYS9Q==",
"temperature": 32.7,
"time": "2018-04-26T15:10:21.023027081Z",
"voltage": 2.198
},
{
"altitude": 173,
"chipTemp": 48.65,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCI0TAQ==",
"temperature": 32.7,
"time": "2018-04-26T15:10:27.35627427Z",
"voltage": 2.189
},
{
"altitude": 172,
"chipTemp": 49.24,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsCIYTPA==",
"temperature": 32.7,
"time": "2018-04-26T15:10:33.76306509Z",
"voltage": 2.182
},
{
"altitude": 173,
"chipTemp": 48.93,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCIETHQ==",
"temperature": 32.7,
"time": "2018-04-26T15:10:39.810258704Z",
"voltage": 2.177
},
{
"altitude": 173,
"chipTemp": 49.44,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtCHcTUA==",
"temperature": 32.7,
"time": "2018-04-26T15:10:45.594316777Z",
"voltage": 2.167
},
{
"altitude": 112,
"chipTemp": 50.59,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCGoTww==",
"temperature": 12.8,
"time": "2018-04-26T15:10:54.261388134Z",
"voltage": 2.154
},
{
"altitude": 112,
"chipTemp": 50.82,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCFkT2g==",
"temperature": 12.8,
"time": "2018-04-26T15:11:02.42113182Z",
"voltage": 2.137
},
{
"altitude": 112,
"chipTemp": 50.96,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCE0T6A==",
"temperature": 12.8,
"time": "2018-04-26T15:11:10.264988356Z",
"voltage": 2.125
},
{
"altitude": 112,
"chipTemp": 51.08,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCEQT9A==",
"temperature": 12.8,
"time": "2018-04-26T15:11:17.896079546Z",
"voltage": 2.116
},
{
"altitude": 112,
"chipTemp": 51.41,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCD0UFQ==",
"temperature": 12.8,
"time": "2018-04-26T15:11:25.272545344Z",
"voltage": 2.109
},
{
"altitude": 112,
"chipTemp": 50.77,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCDgT1Q==",
"temperature": 12.8,
"time": "2018-04-26T15:11:32.674394192Z",
"voltage": 2.104
},
{
"altitude": 112,
"chipTemp": 52,
"device_id": "lora-gateway-node-ra01",
"pressure": 999,
"raw": "BQAD5wBwCCIUUA==",
"temperature": 12.8,
"time": "2018-04-26T15:11:41.797026116Z",
"voltage": 2.082
},
{
"altitude": 172,
"chipTemp": 52.94,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsCA8Urg==",
"temperature": 32.7,
"time": "2018-04-26T15:11:47.370536356Z",
"voltage": 2.063
},
{
"altitude": 172,
"chipTemp": 52.39,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsCAwUdw==",
"temperature": 32.7,
"time": "2018-04-26T15:11:52.945451005Z",
"voltage": 2.06
},
{
"altitude": 172,
"chipTemp": 52.48,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsCAUUgA==",
"temperature": 32.7,
"time": "2018-04-26T15:11:58.259530726Z",
"voltage": 2.053
},
{
"altitude": 173,
"chipTemp": 52.8,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACtB/8UoA==",
"temperature": 32.7,
"time": "2018-04-26T15:12:03.329723118Z",
"voltage": 2.047
},
{
"altitude": 172,
"chipTemp": 52.65,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB/gUkQ==",
"temperature": 32.7,
"time": "2018-04-26T15:12:08.406844851Z",
"voltage": 2.04
},
{
"altitude": 172,
"chipTemp": 53.55,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB/AU6w==",
"temperature": 32.7,
"time": "2018-04-26T15:12:13.211109286Z",
"voltage": 2.032
},
{
"altitude": 172,
"chipTemp": 53.27,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB+sUzw==",
"temperature": 32.7,
"time": "2018-04-26T15:12:17.761658036Z",
"voltage": 2.027
},
{
"altitude": 172,
"chipTemp": 54.03,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB+UVGw==",
"temperature": 32.7,
"time": "2018-04-26T15:12:22.332773405Z",
"voltage": 2.021
},
{
"altitude": 172,
"chipTemp": 54.47,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB94VRw==",
"temperature": 32.7,
"time": "2018-04-26T15:12:26.623906536Z",
"voltage": 2.014
},
{
"altitude": 172,
"chipTemp": 53.86,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB9cVCg==",
"temperature": 32.7,
"time": "2018-04-26T15:12:30.66988373Z",
"voltage": 2.007
},
{
"altitude": 172,
"chipTemp": 54.36,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DMYD4ACsB9QVPA==",
"temperature": 32.7,
"time": "2018-04-26T15:12:34.728438098Z",
"voltage": 2.004
},
{
"altitude": 172,
"chipTemp": 55.15,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DLsD4ACsB8oViw==",
"temperature": 32.59,
"time": "2018-04-26T15:12:43.351249396Z",
"voltage": 1.994
},
{
"altitude": 169,
"chipTemp": 42.37,
"device_id": "lora-gateway-node-ra01",
"pressure": 993,
"raw": "DIkD4QCpDM4QjQ==",
"temperature": 32.09,
"time": "2018-04-26T15:48:49.328256588Z",
"voltage": 3.278
},
{
"altitude": 170,
"chipTemp": 46.4,
"device_id": "lora-gateway-node-ra01",
"pressure": 993,
"raw": "DIkD4QCqDMESIA==",
"temperature": 32.09,
"time": "2018-04-26T15:50:02.785980618Z",
"voltage": 3.265
},
{
"altitude": 169,
"chipTemp": 45.49,
"device_id": "lora-gateway-node-ra01",
"pressure": 993,
"raw": "DIkD4QCpDNMRxQ==",
"temperature": 32.09,
"time": "2018-04-26T15:51:17.9793614Z",
"voltage": 3.283
},
{
"altitude": 169,
"chipTemp": 44.37,
"device_id": "lora-gateway-node-ra01",
"pressure": 992,
"raw": "DJQD4ACpDNMRVQ==",
"temperature": 32.2,
"time": "2018-04-26T15:52:33.173748387Z",
"voltage": 3.283
},
![[Pending Enhancement] RTC values resetting](https://sparklogic.ru/wp-content/uploads/2019/11/nucleo-l476rg-zestaw-startowy-z-mikrokontrolerem-z-rodziny-stm32-stm32l476-90x90.jpg)
