Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - varotodfc

Pages: 1
1
Hello,

I have a project that intends to charge  a 500mAh battery  and  power the  tinyduino  board and sensors using solar panels that produce nominally 5V and 30 mA. In addition, I want to know what panel is charging and what is the current running through them.  Since the solar panels are in parallel the voltage drop is the same for all of them, so I decided to use Ge diodes in order to minimize the power loss.

At this point I'm running tests with just one solar panel. Apparently, due to the diode the solar panel is asked to provide 6V, therefore I introduced a voltage divider using 2 resistors of 100 kOhms and later I substituted them by 2 of 10 kOhms. My problem is that when I measure the voltage drop in one of the resistors using a multimeter it indicates 2.5V and using the AnalogRead(A0) it shows 2.83V. (See image attached for the wiring)


My code for the TX is:
Code: [Select]
#include <Wire.h>
#include <SPI.h>
#include "RH_RF22.h"

#ifndef ARDUINO_ARCH_SAMD
#include <EEPROM.h>
#endif

#if defined(ARDUINO_ARCH_SAMD)
  #define SerialMonitorInterface SerialUSB
#else
  #define SerialMonitorInterface Serial
#endif

RH_RF22 rf22(7,3);

int sensorValue;

void setup() {
  // put your setup code here, to run once:
  SerialMonitorInterface.begin(115200);
  //pinMode(5, OUTPUT);
  //pinMode(A1, INPUT);
  pinMode(LED_BUILTIN, OUTPUT);

  rf22.init();
  rf22.setTxPower(RH_RF22_TXPOW_20DBM);
  rf22.setModemConfig(RH_RF22::GFSK_Rb125Fd125);
 

  while(!SerialMonitorInterface);
}

void loop() {
  // put your main code here, to run repeatedly:
      sensorValue = analogRead(A0);
      float voltage = float(sensorValue)/1023.*5.;
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
     

      SerialMonitorInterface.println(voltage);

      uint8_t data[2];
      //int voltage2=getVCClevel();
 
      //data[0]=voltage2>>8;   // bus voltage in 0.01V increments
      //data[1]=voltage2;
      data[0]=sensorValue>>8;
      data[1]=sensorValue;
      rf22.send(data, sizeof(data));//send return packet ot transmitter
      rf22.waitPacketSent();
  delay(1000);
}

The code for the RX is:
Code: [Select]
#include <Wire.h>
#include <SPI.h>
#include "RH_RF22.h"

RH_RF22 rf22(7,3);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Wire.begin();
  while(!Serial);

  if (!rf22.init())
    Serial.println("init failed");
  rf22.setTxPower(RH_RF22_TXPOW_20DBM);
  rf22.setModemConfig(RH_RF22::GFSK_Rb125Fd125);//FSK_Rb2_4Fd36

}

void loop() {
  // put your main code here, to run repeatedly:
  if (rf22.waitAvailableTimeout(50))//wait for up to 50ms, see if there's a response
  {
    uint8_t buf[RH_RF22_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    if (rf22.recv(buf, &len))//receive packet into buffer
    {
      int voltage1 = buf[0]<<8 | buf[1];
      float result =float(voltage1)/1023*5;
      Serial.println(result);
    }
  } 

}

Thank you in advance.

2
TinyDuino Processors & TinyShields / read the status led for the battery
« on: October 06, 2020, 08:33:01 PM »
Hi everyone,

I wonder if there is a command to access the status of the led that indicates if the battery is charging or not and what is the name of that LED. 

For example:

Code: [Select]
digitalRead(LED_name)

Pages: 1
SMF spam blocked by CleanTalk