update strain docs

master
Peter Babič 3 years ago
parent 8b328b0cdf
commit 439255a2fd
Signed by: peter.babic
GPG Key ID: 4BB075BC1884BA40
  1. 29
      README.md
  2. BIN
      docs/4-strain.fzz
  3. BIN
      docs/4-strain_bb.jpg
  4. BIN
      docs/4-strain_schem.jpg
  5. 35
      docs/README.md
  6. 197
      src/main.cpp__

@ -1,31 +1,4 @@
# Upload
```bash
platformio run --target upload
```
## Single strain
Individual strain consists of two 1k resistors connected as a voltage
divider. Connection with two fixed 1k resistors as a voltage divider
creates a full bridge. **50kg max.**
![Single strain half bridge with two additional 1k resistors
breadboard view](./docs/1-strain_bb.jpg)
![Single strain half bridge with two additional 1k resistors
schematic](./docs/1-strain_schem.jpg)
## Double strain
Using two single strain half bridges together forms a full bridge. **100kg
max.**
![Two single strain half bridges togerher breadboard
view](./docs/2-strain_bb.jpg)
![Two single strain half bridges togerher breadboard
schematic](./docs/2-strain_schem.jpg)
# Bee weighter
## Quadruple strain

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 KiB

After

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 173 KiB

@ -0,0 +1,35 @@
# Strain connections
## Single strain
Individual strain consists of two 1k resistors connected as a voltage
divider. Connection with two fixed 1k resistors as a voltage divider
creates a full bridge. **50kg max.**
![Single strain half bridge with two additional 1k resistors
breadboard view](./docs/1-strain_bb.jpg)
![Single strain half bridge with two additional 1k resistors
schematic](./docs/1-strain_schem.jpg)
## Double strain
Using two single strain half bridges together forms a full bridge. **100kg
max.**
![Two single strain half bridges togerher breadboard
view](./docs/2-strain_bb.jpg)
![Two single strain half bridges togerher breadboard
schematic](./docs/2-strain_schem.jpg)
## Quadruple strain
Using four single strain half bridges together again forms a full bridge,
with the resistance doubled. **200kg max.**
![Two single strain half bridges togerher breadboard
view](./docs/4-strain_bb.jpg)
![Two single strain half bridges togerher breadboard
schematic](./docs/4-strain_schem.jpg)

@ -1,197 +0,0 @@
// CONNECTIONS:
// DS1307 SDA --> SDA
// DS1307 SCL --> SCL
// DS1307 VCC --> 5v
// DS1307 GND --> GND
#define countof(a) (sizeof(a) / sizeof(a[0]))
/* for software wire use below
#include <SoftwareWire.h> // must be included here so that Arduino library object file references work
#include <RtcDS3231.h>
#include <EepromAT24C32.h>
SoftwareWire myWire(SDA, SCL);
RtcDS1307<SoftwareWire> Rtc(myWire);
for software wire use above
for normal hardware wire use below */
#include <Wire.h> // must be included here so that Arduino library object file references work
#include <RtcDS3231.h>
#include <EepromAT24C32.h>
RtcDS3231<TwoWire> Rtc(Wire);
EepromAt24c32<TwoWire> RtcEeprom(Wire);
// if you have any of the address pins on the RTC soldered together
// then you need to provide the state of those pins, normally they
// are connected to vcc with a reading of 1, if soldered they are
// grounded with a reading of 0. The bits are in the order A2 A1 A0
// thus the following would have the A2 soldered together
// EepromAt24c32<TwoWire> RtcEeprom(Wire, 0b011);
/* for normal hardware wire use above */
// nothing longer than 32 bytes
// rtc eeprom memory is 32 byte pages
// writing is limited to each page, so it will wrap at page
// boundaries.
// But reading is only limited by the buffer in Wire class which
// by default is 32
const char data[] = "What time is it in Greenwich?";
const uint16_t stringAddr = 64; // stored on page boundary
void printDateTime(const RtcDateTime& dt);
void setup ()
{
Serial.begin(9600);
Serial.print("compiled: ");
Serial.print(__DATE__);
Serial.println(__TIME__);
//--------RTC SETUP ------------
// if you are using ESP-01 then uncomment the line below to reset the pins to
// the available pins for SDA, SCL
// Wire.begin(0, 2); // due to limited pins, use pin 0 and 2 for SDA, SCL
Rtc.Begin();
RtcEeprom.Begin();
RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);
printDateTime(compiled);
Serial.println();
if (!Rtc.IsDateTimeValid())
{
if (Rtc.LastError() != 0)
{
// we have a communications error
// see https://www.arduino.cc/en/Reference/WireEndTransmission for
// what the number means
Serial.print("RTC communications error = ");
Serial.println(Rtc.LastError());
}
else
{
Serial.println("RTC lost confidence in the DateTime!");
Rtc.SetDateTime(compiled);
}
}
if (!Rtc.GetIsRunning())
{
Serial.println("RTC was not actively running, starting now");
Rtc.SetIsRunning(true);
}
RtcDateTime now = Rtc.GetDateTime();
if (now < compiled)
{
Serial.println("RTC is older than compile time! (Updating DateTime)");
Rtc.SetDateTime(compiled);
}
// never assume the Rtc was last configured by you, so
// just clear them to your needed state
Rtc.Enable32kHzPin(false);
Rtc.SetSquareWavePin(DS3231SquareWavePin_ModeNone);
/* comment out on a second run to see that the info is stored long term */
// Store something in memory on the Eeprom
// store starting address of string
RtcEeprom.SetMemory(0, stringAddr);
// store the string, nothing longer than 32 bytes due to paging
uint8_t written = RtcEeprom.SetMemory(stringAddr, (const uint8_t*)data, sizeof(data) - 1); // remove the null terminator strings add
// store the length of the string
RtcEeprom.SetMemory(1, written); // store the
/* end of comment out section */
}
void loop ()
{
if (!Rtc.IsDateTimeValid())
{
if (Rtc.LastError() != 0)
{
// we have a communications error
// see https://www.arduino.cc/en/Reference/WireEndTransmission for
// what the number means
Serial.print("RTC communications error = ");
Serial.println(Rtc.LastError());
}
else
{
// Common Causes:
// 1) the battery on the device is low or even missing and the power line was disconnected
Serial.println("RTC lost confidence in the DateTime!");
}
}
RtcDateTime now = Rtc.GetDateTime();
printDateTime(now);
Serial.println();
delay(5000);
// read data
// get the offset we stored our data from address zero
uint8_t address = RtcEeprom.GetMemory(0);
if (address != stringAddr)
{
Serial.print("address didn't match ");
Serial.println(address);
}
{
// get the size of the data from address 1
uint8_t count = RtcEeprom.GetMemory(1);
uint8_t buff[64];
// get our data from the address with the given size
uint8_t gotten = RtcEeprom.GetMemory(address, buff, count);
if (gotten != count ||
count != sizeof(data) - 1) // remove the extra null terminator strings add
{
Serial.print("something didn't match, count = ");
Serial.print(count, DEC);
Serial.print(", gotten = ");
Serial.print(gotten, DEC);
Serial.println();
}
Serial.print("data read (");
Serial.print(gotten);
Serial.print(") = \"");
for (uint8_t ch = 0; ch < gotten; ch++)
{
Serial.print((char)buff[ch]);
}
Serial.println("\"");
}
delay(5000);
}
void printDateTime(const RtcDateTime& dt)
{
char datestring[20];
snprintf_P(datestring,
countof(datestring),
PSTR("%02u/%02u/%04u %02u:%02u:%02u"),
dt.Month(),
dt.Day(),
dt.Year(),
dt.Hour(),
dt.Minute(),
dt.Second() );
Serial.print(datestring);
}
Loading…
Cancel
Save