Some weeks it seems every project just gets hit with every problem in the book, which tests one's mettle and plays havoc with all the schedules. This has been one of those weeks -- lots of work on lots of projects, but not as much progress as expected. It was touch and go whether there would be any progress on this project at all, but things started to look up after midnight on Sunday.
I did manage to fix the temperature sensor issue by digging though my parts stock and also finally got Bluetooth working, so now I can get on with the rest of the tasks.
Here is a short video demonstrating Bluetooth in action:
Here is an image showing the kludged smt temperature sensor - TC1046 (Buy Now ), which will end up flush with the bottom of the chassis:
It is in the little rectangular pocket at the bottom of the yellow chassis.
I will include the demo code here even though it is not elegant:
// Super Capacitor Weather Station // // // Author : Doug Wong // Date : 2022 // Version: 1.00 // File : SuperCapWeather.ino // // // Include application, user and local libraries #include "SPI.h" #include "OneMsTaskTimer.h" #include "LCD_SharpBoosterPack_SPI.h" // Variables LCD_SharpBoosterPack_SPI myScreen; uint8_t myOrientation = 0; uint16_t myCount = 0; int TMP = 23; // scaled temperature uint16_t MV = 5400; // scaled capacitor voltage in mV int TMP36Pin = 12; // analog temperature sensor pin int VcapPin = 13; // analog capacitor voltage sensor pin float TMPa; // raw temperature reading long TMPb; // raw temperature reading long Vcapa; // raw capacitor voltage int Vcap; // scaled capacitor voltage int AenPin = 8; // analog enable pin int BenPin = 11; // Bluetooth enable pin int BTTxPin = 4; // Bluetooth Tx pin int BTRxPin = 3; // Bluetooth Rx pin int CMD; // Bluetooth command #define LCD_VERTICAL_MAX myScreen.getSize() #define LCD_HORIZONTAL_MAX myScreen.getSize() // Add setup code void setup() { pinMode(BTTxPin, OUTPUT); pinMode(BTRxPin, INPUT); Serial1.begin(9600); myScreen.begin(); myScreen.clearBuffer(); myScreen.setFont(0); myScreen.text(4, 4, "Super Capacitor"); myScreen.text(4, 20, "Weather Station"); myScreen.text(26, 40, "T: 22"); myScreen.text(20, 60, "mV: 5300"); myScreen.text(64, 84, "DougW"); myScreen.flush(); pinMode(AenPin, OUTPUT); // setup analog power enable pin pinMode(BenPin, OUTPUT); // setup Bluetooth power enable pin digitalWrite(BenPin, HIGH); // disable Bluetooth digitalWrite(AenPin, LOW); // enable analog circuitry delay(100); // wait for sensor to seltle down TMPa = analogRead(TMP36Pin); TMPa = TMPa * 10 /33; TMP = TMPa - 190; myScreen.text(44, 40, String(TMP)); for (uint8_t i = 0; i < 20; i++) { delay(100); } } void loop() { delay(100); TMPa = 0; Vcapa = 0; for (int i = 0; i < 10; i++) // add 10 readings to obtain an average { TMPa = TMPa + analogRead(TMP36Pin); Vcapa = Vcapa + analogRead(VcapPin); } // TMPa = TMPa / 33; TMP = TMPa / 33 - 190; myScreen.text(44, 40, " "); myScreen.text(44, 40, String(TMP)); Vcap = Vcapa * 2118 / 10000; myScreen.text(44, 60, " "); myScreen.text(44, 60, String(Vcap)); myScreen.flush(); // digitalWrite(AenPin, HIGH); digitalWrite(BenPin, LOW); // enable Bluetooth while(Serial1.available()>0){ CMD = 0; CMD = Serial1.read(); if (CMD == 'T' || CMD == 't'){ // "T" or "t" Serial1.println(TMP); } else if (CMD == 'V' || CMD == 'v'){ // "V" or "v" Serial1.println(Vcap); } else if (CMD == '?'){ Serial1.println("SuperCap Weather"); } } for (uint8_t i = 0; i < 20; i++) { delay(100); } // digitalWrite(BenPin, HIGH); // disable Bluetooth }
So now that the hardware is pretty functional and the firmware is under control I can start doing some interesting tests.
Project Status
- The temperature sensor is working, actually all the electronics are working
- Bluetooth communications are working
- The firmware has all the functions working, although the final timing hasn't been determined yet. (it isn't known how thrifty I need to be with power yet)
Issues Dealt With
- Defective temperature sensor - replaced with an SMT substitute
- Low Bluetooth voltage - replaced FET
- Wrong serial port - DUH
Next Steps
- Test the super capacitors and their protection circuit
- Write an android app to get data via Bluetooth
- Test power consumption performance of the system
- Test to ensure the case is waterproof
Relevant Links
Just Encase Solar Super Capacitor Experiment - Blog 1
Just Encase Solar Super Capacitor - Project Outline - Blog 2
Just Encase Super Capacitor Solar Weather Station - Design - Blog 3
Just Encase Super Capacitor Solar Weather Station - Assembly - Blog 4
Just Encase Super Capacitor Solar Weather Station - Bluetooth - Blog 5
Just Encase Super Capacitor Solar Weather Station - Indoor Operation - Blog 6
Just Encase Solar Super Capacitor Weather Station - Outdoor Tests - Blog 7
Just Encase Design Challenge
Tube Amp using Hammond transformers
GPS location and distance tracking using LoRa on a MKR WAN 1300