Compare commits

...

2 Commits
v1.04 ... v1.05

Author SHA1 Message Date
Ben V. Brown
1522c419cf Add ability to calibrate input DC voltage reading, V1.05
Closes #5
2017-05-18 23:58:39 +10:00
Ben V. Brown
ddedd9ad4f Update README.md 2017-05-18 23:34:01 +10:00
8 changed files with 112 additions and 54 deletions

View File

@@ -1,23 +1,22 @@
# TS100 # TS100
This is a complete open source re-write of the software for the ts100 soldering iron. This is a complete re-write of the open source software for the ts100 soldering iron.
This project is feature complete for use as a soldering iron, but is still open to ideas and suggestions. This project is feature complete for use as a soldering iron, but is still open to ideas and suggestions.
This project was started to remove the need for USB for changing system settings. This project was started to remove the need for USB for changing system settings.
In the latest official firmware they have also added a settings menu system, so it is still worth comparing the two firmwares to select your preferred option. In the latest official firmware they have also added a settings menu system, so it is still worth comparing the two firmwares to select your preferred option.
## Features Working ## Features
* Soldering / Temperature control * Soldering / Temperature control
* Full PID iron temperature control * Full PID iron temperature control
* Adjusting temperature * Automatic sleep with selectable sensitivity
* Automatic sleep
* Motion wake support * Motion wake support
* Settings menu * Settings menu
* Input voltage UVLO measurement * Input voltage UVLO measurement for battery powered use
* Saving settings to flash for persistence * All settings saved
* Improved GUI Fonts * Improved readability Fonts
* Use hardware I2C for communications * Use hardware features to improve reliability
* Can disable movement detection if desired * Can disable movement detection if desired
* Calibration of the temperature offset
# Upgrading your ts100 iron # Upgrading your ts100 iron
This is completely safe, if it goes wrong just put the .hex file from the official website onto the unit and your back to the old firmware. Downloads for the hex files to flash are available on the [releases page.](https://github.com/Ralim/ts100/releases) This is completely safe, if it goes wrong just put the .hex file from the official website onto the unit and your back to the old firmware. Downloads for the hex files to flash are available on the [releases page.](https://github.com/Ralim/ts100/releases)
@@ -38,11 +37,39 @@ There is a complete device flash backup included in this repository. (Note this
# New Menu System # New Menu System
This new firmware uses a new menu system to allow access to the settings on the device. This new firmware uses a new menu system to allow access to the settings on the device.
This menu can be accessed as shown in following flow chart, in the settings numbers roll over from top to bottom. When on the main screen, the unit shows prompts for the two most common operations.
![TS100: Software Menu](TS100.png "Fairly easy to learn") -> Pressing the button near the tip enters soldering mode
-> Pressing the button near the power input enters the settings menu.
-> Pressing both buttons together enters the Extras menu
## Soldering mode
In this mode the iron works as you would expect, pressing either button will take you to a temperature change screen. Use each button to go up and down in temperature. Pressing both buttons will exit you from the temperature menu (or wait 3 seconds and it will time out).
Pressing both buttons will also exit the soldering mode.
## Settings Menu
This menu allows you to cycle through all the options and set their values.
The button near the tip cycles through the options, and the one near the usb changes the selected option.
* UVCO -> Undervoltage cut out level, settable in 1V increments from 10-24V
* STIME -> Sleep time, how long it takes before the unit goes to sleep
* STMP -> The temperature the unit drops to in sleep mode
* MOTION -> Wether motion detection is enabled or not
* TMPUNIT -> Temperature unit, C or F
* FLPDSP -> Flip display for left handed users
* SENSE -> Motion Sensitivity, H is more sensitive. L is lowest sensitivity (ie takes more movement to trigger)
## Extras Menu
This menu defaults to showing the current temperature on the tip. Pressing the button near the iron tip will show the current input voltage. Pressing the button near the usb enters the temperature offset setting menu, when the iron is cold, pressing the other button will start the unit calibrating for any offset in the tip temperature.
# Version Changes: # Version Changes:
V1.04
- Increased accuracy of the temperature control
- Improved PID response slightly
- Allows temperature offset calibration
- Nicer idle screen
V1.03
- Improved Button handling
- Ability to set motion sensitivity
- DC voltmeter page shows input voltage
V1.02 V1.02
- Adds hold both buttons on IDLE to access the therometer mode. - Adds hold both buttons on IDLE to access the therometer mode.
- Changes the exit soldering mode to be holding both buttons (Like original firmware). - Changes the exit soldering mode to be holding both buttons (Like original firmware).

View File

@@ -16,5 +16,5 @@ extern volatile uint16_t ADC1ConvertedValue[2];
uint16_t Get_ADC1Value(uint8_t i); uint16_t Get_ADC1Value(uint8_t i);
uint16_t readIronTemp(uint16_t calibration_temp, uint8_t read,uint16_t setPointTemp); //read the iron temp in C X10 uint16_t readIronTemp(uint16_t calibration_temp, uint8_t read,uint16_t setPointTemp); //read the iron temp in C X10
uint16_t readDCVoltage();/*Get the system voltage X10*/ uint16_t readDCVoltage(uint16_t divFactor);/*Get the system voltage X10*/
#endif /* ANALOG_H_ */ #endif /* ANALOG_H_ */

View File

@@ -17,16 +17,17 @@
#include "Settings.h" #include "Settings.h"
#include "Analog.h" #include "Analog.h"
enum { enum {
STARTUP, //we are sitting on the prompt to push a button STARTUP, //we are sitting on the prompt to push a button
SOLDERING, SOLDERING, //Normal operating mode
TEMP_ADJ, TEMP_ADJ, //Adjust the set temperature
SETTINGS, SETTINGS, //Settings menu
SLEEP, SLEEP, //Iron is snoozing due to lack of use
COOLING, COOLING, //Iron is cooling down -> Warning screen
UVLOWARN, UVLOWARN, //Unit tripped low voltage
THERMOMETER, THERMOMETER, //Read the tip temp
DCINDISP, DCINDISP, //Disp the input voltage && Cal the DCin voltage divider
TEMPCAL, TEMPCAL, //Cal tip temp offset
} operatingMode; } operatingMode;
enum { enum {

View File

@@ -11,7 +11,7 @@
#define SETTINGS_H_ #define SETTINGS_H_
#include <stdint.h> #include <stdint.h>
#include "stm32f10x_flash.h" #include "stm32f10x_flash.h"
#define SETTINGSVERSION 0x03 /*Change this if you change the struct below to prevent people getting out of sync*/ #define SETTINGSVERSION 0x04 /*Change this if you change the struct below to prevent people getting out of sync*/
#define SETTINGSOPTIONSCOUNT 6 /*Number of settings in the settings menu*/ #define SETTINGSOPTIONSCOUNT 6 /*Number of settings in the settings menu*/
#define MOTION_HIGH (0x00) #define MOTION_HIGH (0x00)
#define MOTION_MED (0x10) #define MOTION_MED (0x10)
@@ -30,6 +30,7 @@ struct {
uint8_t flipDisplay:1; //If true we want to invert the display for lefties uint8_t flipDisplay:1; //If true we want to invert the display for lefties
uint8_t sensitivity:7; //Sensitivity of accelerometer uint8_t sensitivity:7; //Sensitivity of accelerometer
uint16_t tempCalibration; //Temperature calibration value uint16_t tempCalibration; //Temperature calibration value
uint16_t voltageDiv; //Voltage divisor factor
} systemSettings; } systemSettings;
void saveSettings(); void saveSettings();

View File

@@ -10,12 +10,12 @@
//Reads the dc input and returns it as X10 voltage (ie 236 = 23.6V) //Reads the dc input and returns it as X10 voltage (ie 236 = 23.6V)
//Seems unstable below 9.5V input //Seems unstable below 9.5V input
uint16_t readDCVoltage() { uint16_t readDCVoltage(uint16_t divFactor) {
uint16_t reading = 0; uint16_t reading = 0;
for (u8 i = 0; i < 10; i++) { for (u8 i = 0; i < 10; i++) {
reading += ADC_GetConversionValue(ADC2); reading += ADC_GetConversionValue(ADC2);
} }
reading /= 144; //take the average and convert to X10 voltage reading /= divFactor; //take the average and convert to X10 voltage
return reading; //return the read voltage return reading; //return the read voltage
} }

View File

@@ -37,7 +37,7 @@ void setup() {
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
Init_Oled(systemSettings.flipDisplay); //Init the OLED display Init_Oled(systemSettings.flipDisplay); //Init the OLED display
OLED_DrawString("VER 1.04", 8); // OLED_DrawString("VER 1.05", 8); //
delayMs(800); //Pause to show version number delayMs(800); //Pause to show version number
Start_Watchdog(1000); //start the system watch dog as 1 second timeout Start_Watchdog(1000); //start the system watch dog as 1 second timeout
} }

View File

@@ -5,7 +5,7 @@
* Author: Ralim <ralim@ralimtek.com> * Author: Ralim <ralim@ralimtek.com>
*/ */
#include "Modes.h" #include "Modes.h"
uint8_t tempCalStatus = 0; uint8_t CalStatus = 0;
//This does the required processing and state changes //This does the required processing and state changes
void ProcessUI() { void ProcessUI() {
uint8_t Buttons = getButtons(); //read the buttons status uint8_t Buttons = getButtons(); //read the buttons status
@@ -51,7 +51,7 @@ void ProcessUI() {
return; return;
} }
} }
uint16_t voltage = readDCVoltage(); //get X10 voltage uint16_t voltage = readDCVoltage(systemSettings.voltageDiv); //get X10 voltage
if ((voltage / 10) < systemSettings.cutoutVoltage) { if ((voltage / 10) < systemSettings.cutoutVoltage) {
operatingMode = UVLOWARN; operatingMode = UVLOWARN;
lastModeChange = millis(); lastModeChange = millis();
@@ -180,9 +180,10 @@ void ProcessUI() {
if (Buttons == BUT_A) { if (Buttons == BUT_A) {
//Single button press, cycle over to the DC display //Single button press, cycle over to the DC display
CalStatus = 0;
operatingMode = DCINDISP; operatingMode = DCINDISP;
} else if (Buttons == BUT_B) { } else if (Buttons == BUT_B) {
tempCalStatus = 0; CalStatus = 0;
operatingMode = TEMPCAL; operatingMode = TEMPCAL;
} else if (Buttons == (BUT_A | BUT_B)) { } else if (Buttons == (BUT_A | BUT_B)) {
//If the user is holding both button, exit the screen //If the user is holding both button, exit the screen
@@ -193,13 +194,37 @@ void ProcessUI() {
break; break;
case DCINDISP: { case DCINDISP: {
//This lets the user check the input voltage //This lets the user check the input voltage
if (CalStatus == 0) {
if (Buttons == BUT_A) { if (Buttons == BUT_A) {
//Single button press, cycle over to the temp display //Single button press, cycle over to the temp display
operatingMode = THERMOMETER; operatingMode = THERMOMETER;
} else if (Buttons == (BUT_A | BUT_B)) { } else if (Buttons == BUT_B) {
//If the user is holding both button, exit the screen //dc cal mode
operatingMode = STARTUP; CalStatus = 1;
} else if (Buttons == (BUT_A | BUT_B)) {
//If the user is holding both button, exit the screen
operatingMode = STARTUP;
}
} else {
//User is calibrating the dc input
if (Buttons == BUT_A) {
if (!systemSettings.flipDisplay)
systemSettings.voltageDiv++;
else
systemSettings.voltageDiv--;
} else if (Buttons == BUT_B) {
if (!systemSettings.flipDisplay)
systemSettings.voltageDiv--;
else
systemSettings.voltageDiv++;
} else if (Buttons == (BUT_A | BUT_B)) {
CalStatus = 0;
saveSettings();
}
if (systemSettings.voltageDiv < 120)
systemSettings.voltageDiv = 160;
else if (systemSettings.voltageDiv > 160)
systemSettings.voltageDiv = 120;
} }
} }
@@ -210,13 +235,13 @@ void ProcessUI() {
operatingMode = THERMOMETER; operatingMode = THERMOMETER;
} else if (Buttons == BUT_A) { } else if (Buttons == BUT_A) {
//Try and calibrate //Try and calibrate
if (tempCalStatus == 0) { if (CalStatus == 0) {
if ((readTipTemp() < 300) && (readSensorTemp() < 300)) { if ((readTipTemp() < 300) && (readSensorTemp() < 300)) {
tempCalStatus = 1; CalStatus = 1;
systemSettings.tempCalibration = readTipTemp(); systemSettings.tempCalibration = readTipTemp();
saveSettings(); saveSettings();
} else { } else {
tempCalStatus = 2; CalStatus = 2;
} }
} }
} else if (Buttons == (BUT_A | BUT_B)) { } else if (Buttons == (BUT_A | BUT_B)) {
@@ -237,7 +262,7 @@ void drawTemp(uint16_t temp, uint8_t x) {
if (systemSettings.displayTempInF) if (systemSettings.displayTempInF)
temp = (temp * 9 + 1600) / 5;/*Convert to F -> T*(9/5)+32*/ temp = (temp * 9 + 1600) / 5;/*Convert to F -> T*(9/5)+32*/
if (temp % 10 > 5) if (temp % 10 > 5)
temp += 10;//round up temp += 10; //round up
OLED_DrawThreeNumber(temp / 10, x); OLED_DrawThreeNumber(temp / 10, x);
} }
@@ -370,26 +395,30 @@ void DrawUI() {
drawTemp(temp, 5); drawTemp(temp, 5);
break; break;
case DCINDISP: { case DCINDISP: {
uint16_t voltage = readDCVoltage(); //get X10 voltage uint16_t voltage = readDCVoltage(systemSettings.voltageDiv); //get X10 voltage
OLED_DrawString("IN", 2);
OLED_DrawChar((voltage / 100) % 10, 2);
voltage -= (voltage / 100) * 100;
OLED_DrawChar((voltage / 10) % 10, 3);
voltage -= (voltage / 10) * 10;
OLED_DrawChar('.', 4);
OLED_DrawChar(voltage % 10, 5);
OLED_DrawChar('V', 6);
OLED_DrawChar(' ', 7);
if (CalStatus == 0 || ((millis() % 1000) > 500)) {
OLED_DrawString("IN", 2);
OLED_DrawChar((voltage / 100) % 10, 2);
voltage -= (voltage / 100) * 100;
OLED_DrawChar((voltage / 10) % 10, 3);
voltage -= (voltage / 10) * 10;
OLED_DrawChar('.', 4);
OLED_DrawChar(voltage % 10, 5);
OLED_DrawChar('V', 6);
OLED_DrawChar(' ', 7);
} else {
OLED_DrawString("IN ", 8);
}
} }
break; break;
case TEMPCAL: { case TEMPCAL: {
if (tempCalStatus == 0) { if (CalStatus == 0) {
OLED_DrawString("CAL TEMP", 8); OLED_DrawString("CAL TEMP", 8);
} else if (tempCalStatus == 1) { } else if (CalStatus == 1) {
OLED_DrawString("CAL OK ", 8); OLED_DrawString("CAL OK ", 8);
} else if (tempCalStatus == 2) { } else if (CalStatus == 2) {
OLED_DrawString("CAL FAIL", 8); OLED_DrawString("CAL FAIL", 8);
} }
} }

View File

@@ -51,6 +51,6 @@ void resetSettings() {
systemSettings.flipDisplay=0; //Default to right handed mode systemSettings.flipDisplay=0; //Default to right handed mode
systemSettings.sensitivity=0x00; //Default high sensitivity systemSettings.sensitivity=0x00; //Default high sensitivity
systemSettings.tempCalibration=239; //Default to their calibration value systemSettings.tempCalibration=239; //Default to their calibration value
systemSettings.voltageDiv=144; //Default divider from schematic
} }