Skip to content

Commit

Permalink
BattAnalog: adjust values of HV battery (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
offer-shmuely authored Jun 10, 2024
1 parent 6cbb06b commit de40b2d
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions sdcard/c480x272/WIDGETS/BattAnalog/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
-- Author : Offer Shmuely
-- Date: 2021-2023
local app_name = "BattAnalog"
local app_ver = "0.7"
local app_ver = "0.8"

local CELL_DETECTION_TIME = 8

Expand All @@ -50,14 +50,17 @@ local _options = {

-- Data gathered from commercial lipo sensors
local percent_list_lipo = {
{ { 3.000, 0 }, { 3.093, 1 }, { 3.196, 2 }, { 3.301, 3 }, { 3.401, 4 }, { 3.477, 5 }, { 3.544, 6 }, { 3.601, 7 }, { 3.637, 8 }, { 3.664, 9 }, { 3.679, 10 }, { 3.683, 11 }, { 3.689, 12 }, { 3.692, 13 } },
{ { 3.705, 14 }, { 3.710, 15 }, { 3.713, 16 }, { 3.715, 17 }, { 3.720, 18 }, { 3.731, 19 }, { 3.735, 20 }, { 3.744, 21 }, { 3.753, 22 }, { 3.756, 23 }, { 3.758, 24 }, { 3.762, 25 }, { 3.767, 26 } },
{ { 3.774, 27 }, { 3.780, 28 }, { 3.783, 29 }, { 3.786, 30 }, { 3.789, 31 }, { 3.794, 32 }, { 3.797, 33 }, { 3.800, 34 }, { 3.802, 35 }, { 3.805, 36 }, { 3.808, 37 }, { 3.811, 38 }, { 3.815, 39 } },
{ { 3.818, 40 }, { 3.822, 41 }, { 3.825, 42 }, { 3.829, 43 }, { 3.833, 44 }, { 3.836, 45 }, { 3.840, 46 }, { 3.843, 47 }, { 3.847, 48 }, { 3.850, 49 }, { 3.854, 50 }, { 3.857, 51 }, { 3.860, 52 } },
{ { 3.863, 53 }, { 3.866, 54 }, { 3.870, 55 }, { 3.874, 56 }, { 3.879, 57 }, { 3.888, 58 }, { 3.893, 59 }, { 3.897, 60 }, { 3.902, 61 }, { 3.906, 62 }, { 3.911, 63 }, { 3.918, 64 } },
{ { 3.923, 65 }, { 3.928, 66 }, { 3.939, 67 }, { 3.943, 68 }, { 3.949, 69 }, { 3.955, 70 }, { 3.961, 71 }, { 3.968, 72 }, { 3.974, 73 }, { 3.981, 74 }, { 3.987, 75 }, { 3.994, 76 } },
{ { 4.001, 77 }, { 4.007, 78 }, { 4.014, 79 }, { 4.021, 80 }, { 4.029, 81 }, { 4.036, 82 }, { 4.044, 83 }, { 4.052, 84 }, { 4.062, 85 }, { 4.074, 86 }, { 4.085, 87 }, { 4.095, 88 } },
{ { 4.105, 89 }, { 4.111, 90 }, { 4.116, 91 }, { 4.120, 92 }, { 4.125, 93 }, { 4.129, 94 }, { 4.135, 95 }, { 4.145, 96 }, { 4.176, 97 }, { 4.179, 98 }, { 4.193, 99 }, { 4.200, 100 } },
{ {3.000, 0}},
{ {3.093, 1}, {3.196, 2}, {3.301, 3}, {3.401, 4}, {3.477, 5}, {3.544, 6}, {3.601, 7}, {3.637, 8}, {3.664, 9}, {3.679, 10} },
{ {3.683, 11}, {3.689, 12}, {3.692, 13}, {3.705, 14}, {3.710, 15}, {3.713, 16}, {3.715, 17}, {3.720, 18}, {3.731, 19}, {3.735, 20} },
{ {3.744, 21}, {3.753, 22}, {3.756, 23}, {3.758, 24}, {3.762, 25}, {3.767, 26}, {3.774, 27}, {3.780, 28}, {3.783, 29}, {3.786, 30} },
{ {3.789, 31}, {3.794, 32}, {3.797, 33}, {3.800, 34}, {3.802, 35}, {3.805, 36}, {3.808, 37}, {3.811, 38}, {3.815, 39}, {3.818, 40} },
{ {3.822, 41}, {3.825, 42}, {3.829, 43}, {3.833, 44}, {3.836, 45}, {3.840, 46}, {3.843, 47}, {3.847, 48}, {3.850, 49}, {3.854, 50} },
{ {3.857, 51}, {3.860, 52}, {3.863, 53}, {3.866, 54}, {3.870, 55}, {3.874, 56}, {3.879, 57}, {3.888, 58}, {3.893, 59}, {3.897, 60} },
{ {3.902, 61}, {3.906, 62}, {3.911, 63}, {3.918, 64}, {3.923, 65}, {3.928, 66}, {3.939, 67}, {3.943, 68}, {3.949, 69}, {3.955, 70} },
{ {3.961, 71}, {3.968, 72}, {3.974, 73}, {3.981, 74}, {3.987, 75}, {3.994, 76}, {4.001, 77}, {4.007, 78}, {4.014, 79}, {4.021, 80} },
{ {4.029, 81}, {4.036, 82}, {4.044, 83}, {4.052, 84}, {4.062, 85}, {4.074, 86}, {4.085, 87}, {4.095, 88}, {4.105, 89}, {4.111, 90} },
{ {4.116, 91}, {4.120, 92}, {4.125, 93}, {4.129, 94}, {4.135, 95}, {4.145, 96}, {4.176, 97}, {4.179, 98}, {4.193, 99}, {4.200,100} },
}

-- from: https://electric-scooter.guide/guides/electric-scooter-battery-voltage-chart/
Expand Down Expand Up @@ -85,19 +88,20 @@ local percent_list_lion = {
{ { 4.10, 100}, { 4.15,100 }, { 4.20, 100} },
}

-- TODO new to fine tune the graph!
local percent_list_hv = {
{ { 3.150, 0 }, { 3.243, 1 }, { 3.346, 2 }, { 3.451, 3 }, { 3.551, 4 }, { 3.627, 5 }, { 3.694, 6 }, { 3.751, 7 }, { 3.787, 8 }, { 3.814, 9 }, { 3.829, 10 }, { 3.833, 11 }, { 3.839, 12 }, { 3.842, 13 } },
{ { 3.855, 14 }, { 3.860, 15 }, { 3.863, 16 }, { 3.865, 17 }, { 3.870, 18 }, { 3.881, 19 }, { 3.885, 20 }, { 3.894, 21 }, { 3.903, 22 }, { 3.906, 23 }, { 3.908, 24 }, { 3.912, 25 }, { 3.917, 26 } },
{ { 3.924, 27 }, { 3.930, 28 }, { 3.933, 29 }, { 3.936, 30 }, { 3.939, 31 }, { 3.944, 32 }, { 3.947, 33 }, { 3.950, 34 }, { 3.952, 35 }, { 3.955, 36 }, { 3.958, 37 }, { 3.961, 38 }, { 3.965, 39 } },
{ { 3.968, 40 }, { 3.972, 41 }, { 3.975, 42 }, { 3.979, 43 }, { 3.983, 44 }, { 3.986, 45 }, { 3.990, 46 }, { 3.993, 47 }, { 3.997, 48 }, { 4.000, 49 }, { 4.004, 50 }, { 4.007, 51 }, { 4.010, 52 } },
{ { 4.013, 53 }, { 4.016, 54 }, { 4.020, 55 }, { 4.024, 56 }, { 4.029, 57 }, { 4.038, 58 }, { 4.043, 59 }, { 4.047, 60 }, { 4.052, 61 }, { 4.056, 62 }, { 4.061, 63 }, { 4.068, 64 } },
{ { 4.073, 65 }, { 4.078, 66 }, { 4.089, 67 }, { 4.093, 68 }, { 4,099, 69 }, { 4.105, 70 }, { 4.111, 71 }, { 4.118, 72 }, { 4.124, 73 }, { 4.131, 74 }, { 4.137, 75 }, { 4.144, 76 } },
{ { 4.151, 77 }, { 4.157, 78 }, { 4.164, 79 }, { 4.171, 80 }, { 4.179, 81 }, { 4.186, 82 }, { 4.194, 83 }, { 4.202, 84 }, { 4.212, 85 }, { 4.224, 86 }, { 4.235, 87 }, { 4.245, 88 } },
{ { 4.255, 89 }, { 4.261, 90 }, { 4.266, 91 }, { 4.270, 92 }, { 4.275, 93 }, { 4.279, 94 }, { 4.285, 95 }, { 4.295, 96 }, { 4.326, 97 }, { 4.329, 98 }, { 4.343, 99 }, { 4.350, 100 } },
{ {3.000, 0}},
{ {3.093, 1}, {3.196, 2}, {3.301, 3}, {3.401, 4}, {3.477, 5}, {3.544, 6}, {3.601, 7}, {3.637, 8}, {3.664, 9}, {3.679, 10} },
{ {3.683, 11}, {3.689, 12}, {3.692, 13}, {3.705, 14}, {3.710, 15}, {3.713, 16}, {3.715, 17}, {3.720, 18}, {3.731, 19}, {3.735, 20} },
{ {3.744, 21}, {3.753, 22}, {3.756, 23}, {3.758, 24}, {3.762, 25}, {3.767, 26}, {3.774, 27}, {3.780, 28}, {3.783, 29}, {3.786, 30} },
{ {3.789, 31}, {3.794, 32}, {3.797, 33}, {3.800, 34}, {3.802, 35}, {3.805, 36}, {3.808, 37}, {3.811, 38}, {3.815, 39}, {3.828, 40} },
{ {3.832, 41}, {3.836, 42}, {3.841, 43}, {3.846, 44}, {3.850, 45}, {3.855, 46}, {3.859, 47}, {3.864, 48}, {3.868, 49}, {3.873, 50} },
{ {3.877, 51}, {3.881, 52}, {3.885, 53}, {3.890, 54}, {3.895, 55}, {3.900, 56}, {3.907, 57}, {3.917, 58}, {3.924, 59}, {3.929, 60} },
{ {3.936, 61}, {3.942, 62}, {3.949, 63}, {3.957, 64}, {3.964, 65}, {3.971, 66}, {3.984, 67}, {3.990, 68}, {3.998, 69}, {4.006, 70} },
{ {4.015, 71}, {4.024, 72}, {4.032, 73}, {4.042, 74}, {4.050, 75}, {4.060, 76}, {4.069, 77}, {4.078, 78}, {4.088, 79}, {4.098, 80} },
{ {4.109, 81}, {4.119, 82}, {4.130, 83}, {4.141, 84}, {4.154, 85}, {4.169, 86}, {4.184, 87}, {4.197, 88}, {4.211, 89}, {4.220, 90} },
{ {4.229, 91}, {4.237, 92}, {4.246, 93}, {4.254, 94}, {4.264, 95}, {4.278, 96}, {4.302, 97}, {4.320, 98}, {4.339, 99}, {4.350,100} },
}


local voltageRanges_lipo = {4.3,8.6,12.9,17.2,21.5,25.8,30.1,34.4,38.7,43.0,47.3,51.6}
local voltageRanges_lion = {4.2,8.4,12.6,16.8,21,25.2,29.4,33.6,37.8,42,46.2,50.4,54.6}
local voltageRanges_hv = {4.45,8.9,13.35,17.8,22.25,26.7,31.15,35.6,40.05,44.5,48.95,53.4,57.85}
Expand Down

0 comments on commit de40b2d

Please sign in to comment.