#Backlight and Boolean?
Explore tagged Tumblr posts
branmuffins22 · 2 years ago
Text
Woke up today with visions of a new WIP.
The Owl House characters in a Code Lyoko -esque setting/story, in a similar vein as the Owl House X Adventure Time fusion Owlventure Time! by GoreMiser (its a good read, and almost complete, for a certain definition of "complete"), only in this case it'd also be sort of a Swap AU, putting Luz on the magical otherworld and the hexolios on Earth.
...Actually, given the almost-a-Swap-AU-ness, perhaps a better comparison would be the Owl House X Steven Universe fusion Seashells and Stars by Unniebeans (another good read, though nowhere near completion).
Anyways, Amity would replace Jeremie as the guy in the chair; Gus, Willow, and Hunter would replace Odd, Yumi, and Ulrich as the ones primarily on the front line; Luz and King would split the role of Aelita as the amnesiac kids stuck in the machine; Belos would replace X.A.N.A. as the BBEG (obviously); Eda would replace Franz as the creator of not!Lyoko (and once-guardian of the kids in the machine); and Boscha would replace Sissy as the nosy bully (and unwelcome suitor).
Members of the Hagsquad would also be sprinkled throughout the faculty of Hexside (which replaces Kadic), such as Lilith as the history teacher and Raine as the music teacher, and I've got A Few Ideas about Camila replacing Dorothy/Yolanda as the school nurse. Basically, I think it'd be neat to have a bunch of characters with ties to the supercomputer but who are nonetheless unaware of its existence.
I might leave Jim as Jim though, both because TOH doesn't have a similar character to replace him with, and because he's just kinda fantastic. I think he and Steve would be besties.
I would probably also incorporate ideas from my Code Lyoko rewrite, a backburner project I may or may not have mentioned here once or twice.
For instance, Franz (or in this case, Eda) retiring from whatever sketchy military thing to become a game developer rather than a science teacher, with Lyoko (or, whatever I call this not!Lyoko) as the world of the overly-ambitious-game-turned-haven. Maybe also the initial attempts at materialization ending up a bit crude, and leaving Aelita (or, in this case, Luz) with characteristics of her virtual avatar for her first season's-worth of trips to Earth.
8 notes · View notes
crankycoderblog · 7 years ago
Text
18650 Battery capacity checker
Some of you know, I really like lithium ion batteries
*shocked*
Shut it!  This is a short post, I don’t need you hamming up the works.
Just wait till I show up in your videos….
You wouldn’t….
Hello….
Oh hell…..
Ok, lets not worry about that now.
I picked up a pretty sweet haul of batteries this week.
        22lbs.  I counted 107 2cell packs.  214 cells to check out.  This is great, but I have a single opus charger that can do 4 cells at a time.
So 214 cells will take some time to process.  I have done that game.  So I wanted to do more cells.  There are examples online of doing this with arduino’s and what not and since I am big fan of arduino’s anyways I decided to give that a shot.  I built it out initially with an arduino uno.  Using the awesome guidance of Adam Welch.  If you don’t know who Adam is, you gotta check out his work.
Website: http://adamwelch.co.uk/  Youtube: https://www.youtube.com/channel/UCm5sG3-BXQZfVy3st2T_XKg
His work I used for this is here.
youtube
I modified the code a little as I didn’t have that screen.  I have a 20×4 screen.  I also updated mine to calculate the voltage reference from the internal 1.1v reference.
/* * Battery Capacity Checker * Uses Nokia 5110 Display * Uses 1 Ohm power resister as shunt - Load can be any suitable resister or lamp * * YouTube Video: https://www.youtube.com/embed/qtws6VSIoYk * * http://AdamWelch.Uk * * Required Library - LCD5110_Graph.h - http://www.rinkydinkelectronics.com/library.php?id=47 */ #include <LiquidCrystal_I2C.h> #define gatePin 2 #define highPin A0 #define lowPin A1 boolean finished = false; int interval = 5000; //Interval (ms) between measurements float mAh = 0.0; float shuntRes = 1.0; // In Ohms - Shunt resistor resistance float current = 0.0; float battVolt = 0.0; float shuntVolt = 0.0; float battLow = 2.9; LiquidCrystal_I2C lcd(0x27,20,4); unsigned long previousMillis = 0; unsigned long millisPassed = 0; void setup() { analogReference(INTERNAL); Serial.begin(115200); lcd.init(); //initialize the lcd lcd.backlight(); //open the backlight Serial.println("Battery Capacity Checker v1.1"); Serial.println("battVolt current mAh"); pinMode(gatePin, OUTPUT); digitalWrite(gatePin, LOW); lcd.setContrast(68); lcd.clear(); lcd.print("Battery"); lcd.print("Check"); lcd.print("Please Wait"); lcd.print("AdamWelch.Uk"); delay(2000); lcd.clear(); } void loop() { voltRef = readVcc() / 1024.0; Serial.print("Volt Ref: "); Serial.println(voltRef); battVolt = analogRead(highPin) * voltRef / 1024.0; Serial.print("Batt Vol: "); Serial.println(battVolt); shuntVolt = analogRead(lowPin) * voltRef / 1024.0; Serial.print("Shunt Val: "); Serial.println(shuntVolt); Serial.println(); Serial.println(); /* Serial.print(battVolt); Serial.print("\t"); Serial.print(current); Serial.print("\t"); Serial.println(mAh); */ if(battVolt >= battLow && finished == false) { digitalWrite(gatePin, HIGH); millisPassed = millis() - previousMillis; current = (battVolt - shuntVolt) / shuntRes; mAh = mAh + (current * 1000.0) * (millisPassed / 3600000.0); previousMillis = millis(); lcd.setCursor(0,0); lcd.print("Discharge "); lcd.setCursor(0,1); lcd.print("Volt:"); lcd.print(battVolt); lcd.print("v "); lcd.setCursor(0,2); lcd.print("Current:"); lcd.print(current); lcd.print("a "); lcd.setCursor(0,3); lcd.print(mAh); lcd.print("mAh "); lcd.print("Running "); } if(battVolt < battLow) { digitalWrite(gatePin, LOW); finished = true; lcd.clear(); lcd.print("Discharge"); lcd.print("Voltage:"); lcd.print(battVolt); lcd.print("v"); lcd.print(mAh); lcd.print("mAh"); lcd.setCursor(0,1); lcd.print("Complete"); } delay(interval); } long readVcc() { long result; // Read 1.1V reference against AVcc ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); delay(2); // Wait for Vref to settle ADCSRA |= _BV(ADSC); // Convert while (bit_is_set(ADCSRA,ADSC)); result = ADCL; result |= ADCH<<8; result = 1126400L / result; // Back-calculate AVcc in mV return result; }
Next step is to add a “charging” function with a tp4056 so I can charge then discharge.
  Amazon – 5 for 6.95
Ebay – 10 for 4.95
Aliexpress – 10 < 2 bucks.
  Once that is working I should be able to add a couple more modules.  I have been really looking towards doing something with Brett Wattys 8 module charger.  That things is INTENSE!!!
If you want to see all the info check out the secondlifestorage forum.
https://secondlifestorage.com/t-Brett-s-Arduino-8x-Smart-Charger-Discharger
He also has a portal he is setting up to help aggregate some numbers on how many cells the community has recycled.
    Until later!!!
bye!!!!
18650 Battery capacity checker was originally published on Cranky Coder
1 note · View note
Text
Pomodoro timer and alarm clock Experiment 3: Connecting a push-button and a buzzer
Why push-buttons and a buzzer?
Push-buttons are a nice and simple way for an user to interact with the micro-controller. They are pretty straight forward and intuitive, in the sense that buttons have always been associated with human input. While a variety of sensors could have been used for this project to interact with the system, I considered that none would be as efficient as a button. As for the buzzer, its use is to offer an auditory form of output to the user, alerting him of certain events (in this case, an alarm clock or a timer reaching zero). The goal being to create something cheap and easy to understand and build, I believe these choices to be perfect for me.
Connecting the physical parts
The push-button has four pins, out of which three of them have to be connected to the Arduino board. A pull-up resistor, ranging from either 1k to 10k Ohm is also needed to make the circuit. Begin by plugging the pushbutton into the Breadboard, each pin being plugged into an unique column. Connect the column of one of the pins to the Positive Bus (5V) of the breadboard. Connect a pull-up resistor to the parallel column of the previous pin, and link it to the Negative Bus (Ground) of the Breadboard either directly through the pull-up resistor, or through an additional cable. Finally, connect any of the two remaining columns to one of the PWM Analog pins of the Arduino board through a Male to Male wire. The result should be something like this:
Tumblr media Tumblr media Tumblr media
The diagram:
Tumblr media
Now, to connect the buzzer, plug the two pins of the buzzer into two different columns of the Breadboard. Connect one of the columns to the Positive Bus, just like we did with the push-button, and the other one to another PWM Analog pin of the Arduino board. If you want the sound made by the buzzer to be weaker, use an additional pull-up resistor. I used a 220 Ohm one because I wanted to sound to be clear and powerful, so the alarm can be heard from further away. Now, the breadboard should look like this:
Tumblr media
In this picture, you can see that I added four additional buttons through the exact same process as previously described. The pins I have used for the buttons are numbered from 9 to 13.
The diagram:
Tumblr media
Now that the physical parts are all connected, it is time to move on to coding the micro-controller on how to use them.
Programming the push-button to turn the screen on and off
To program the push-button to turn the display on and off, we need to first assign the pin number of the push-button connected to it to a variable, use the pinMode() method in the setup() of the sketch to assign it the INPUT mode, then have the state of a flag change based on the activity of the button. A boolean, screenOn is used to tell the loop() method if content needs to be drawn or not. The push of the button will turn the flag to false if it previously true, and true if it was false. The push of the button also affects the LCD’s backlight, turning it on and off. In order for the user to turn the screen off, I want the button to be held pressed for one second. To achieve that, I use a loop that checks the updated state of the button from when it was originally pressed, every 100 milliseconds. If the state of the button doesn’t change in 1000 milliseconds, then the shutDownScreen() method will be called. If the button was pressed while the screenOn variable is false, the screen will automatically turn on. 
The code:
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
The result:
vimeo
Programming the buzzer to go off every minute
Now, to program the buzzer, we follow the same steps as for the push-button. We begin by creating a constant variable and assigning it the value of the Analog pin of the Arduino board connected to the buzzer. Then, we use pinMode to assign that pin to be on OUTPUT mode and we set the value of the pin to HIGH, so it doesn’t ring. After that, we write a method that triggers the buzzer every minute and we call that method in the loop function.
The code:
Tumblr media
Those are global variables declared before the setup() method;
Tumblr media
This goes in the setup() method;
Tumblr media
This goes in the loop() method;
Tumblr media
This is the main method we use to test the buzzer;
The result:
vimeo
Now that we have a working button and a buzzer, we can do some more interesting things. In the next experiment we will be working on a button that swaps between different screen contents, and an RGB LED that will serve as an indicator as to why the buzzer has gone off.
The complete code can be found HERE!
The source code can be found HERE!
Technical evaluation
Using the push-button to control the LCD screen is one of the major achievements of this project. This opened up so many possibilities for me, and the fact that it was so easy to do, made this experiment very enjoyable to carry on. I had no issues with connecting the push-button and the buzzer, so there is nothing much I can add on this note.
References:
https://www.instructables.com/id/How-to-use-a-Buzzer-Arduino-Tutorial/
https://www.instructables.com/id/How-to-use-a-Push-Button-Arduino-Tutorial/
0 notes
lovett4ever · 8 years ago
Video
youtube
https://drive.google.com/file/d/1RAcBqAOxfJzWJvHedNLNSF3T5QEdcUA0/view?usp=sharing
Tumblr media Tumblr media
Project 4: Alien Scene
Description: For this project, create a short movie with some focus in Maya. My choice is on the modeling, texturing and lighting.
Process: Firstly, I found a small scene online that can satisfy my request which I thought I can handle. Then I started to do the modeling. According to the scene, I adjusted the camera and measured the size of each part of the scene. Then I made a brief position of each part by some cubes and cylinders. There are many repeated stuff in this thing which we can take advantage of. For the pillars and other things made of stone, simply use a cube and adjust the size of each vertex and edge. For the pipeline and other metal-made thing on the back. Because they are pretty much like a tunnel, I used a NURBS circle and did extrude along a NURBS curve. For other stuff, I used extrude for the polygon as my basic idea. The polygons can be built not only using the basic shapes, but also using boolean tool to combine or cut out the shapes we want. Also, for the robot and the source, I did each part separately. Though it takes time to combine them, the modeling process will be simplified. Especially for the cloth of the robot. I used a sphere to start. Then select the part of faces I want. Do extrude to give it some thickness. Then do extrude on all the direction we need, use boolean or simply delete the faces I don’t want. Finally, use soft selection to give it some randomness. 
Secondly, I start to do the texturing. Before apply texture on it, I need to figure out the attributes of each shaders. For example, for the stone shader, I used a lambert so that it can look rough. For the metal shader, I used a blinn shader to make it shiny. Then slightly adjust their parameters and always render it when I have made any. When the shaders look good. I can apply texture on it. I found some similar material textures online and use PS to adjust their color to make them more like the scene. Then I edit the UV of some irregular stuff like the cloth and the pillar. I use UV editor to cut out the UV of each different part and separate them. Then use tools to stretch them out. Generate a picture of the UV coordinate and put it to PS. Use the texture I found to cover each part of different materials and patterns. Then apply the texture to the color of the shader. For the ground and pillars. I also use PS to make a gray picture to apply to their bump map to make them look real. Especially for the lights. I use the special effects of the shader and add its glow intensity so that they will look bright under the lights.
At last, I applied three-point lights on the scene. I turned on the shadow map of the backlight to create some shadows. Then I import a image plane for the background of the scene. Use product level to generate a HD 1080p rendering.  Also I turned on the ray tracing to make it look more real.
Link to the maya file: https://drive.google.com/file/d/1pacEV9uaL-aVcr-fnXoQ_4tlplQ14NKa/view?usp=sharing
Link to the movie:  https://drive.google.com/file/d/1RAcBqAOxfJzWJvHedNLNSF3T5QEdcUA0/view?usp=sharing
Link to the whole project: https://drive.google.com/file/d/1ZhLzFIDt81y5pmGzuL5UO-AR-hfXgASC/view?usp=sharing 
0 notes
otherassorted · 8 years ago
Photo
Tumblr media Tumblr media
One of many arduino projects.
air pollution counter with two sensors (2015)
// 24-12-2014 Nikos Siolios //==================display 16x2 #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h>
#define I2C_ADDR    0x27 // <<----- Add your address here.  Find it from I2C Scanner #define BACKLIGHT_PIN     3 #define En_pin  2 #define Rw_pin  1 #define Rs_pin  0 #define D4_pin  4 #define D5_pin  5 #define D6_pin  6 #define D7_pin  7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
//==========variables for SY int pinSY = 8; unsigned long duration; unsigned long starttime; unsigned long endtime; unsigned long sampletime_ms = 3000; unsigned long lowpulseoccupancy = 0; float ratio = 0; float concentration = 0; float myConceSY; //===========variables for SHARP int measurePinSHARP = 0; //Connect dust sensor to Arduino A0 pin int ledPowerSHARP = 2;   //Connect 3 led driver pins of dust sensor to Arduino D2
int samplingTime = 280; int deltaTime = 40; int sleepTime = 9680;
float voMeasured = 0; float calcVoltage = 0; float dustDensity = 0; float dustmgSH; //=========================== int count=0; float meanVsy=0; float meanVsh=0; unsigned long  stabilizationTime=60000; //60 sec . // all this time the data are not counted in the mean values // just displays the values // there are no reliable values for the  first 1 min
unsigned long  timeStab; //variable for stabilization time boolean warming=true;
// variables for mean of the last 20 (meanPlyth) values #define numberofMeans 20 const int meanPlyth=numberofMeans; // meanPlyth x sampletime_ms =20 x3000ms= 1min float lastValueSY[numberofMeans]; //including zero from 0 to 19 float lastValueSH[numberofMeans]; float meanV5sy; float meanV5sh;
void setup() {   lcd.begin (16,2); //  <<----- My LCD was 16x2   lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); // Switch on the backlight   lcd.setBacklight(LOW); //off   lcd.home (); // go home  //-----------------------  Serial.begin(115200);  pinMode(pinSY,INPUT);  pinMode(ledPowerSHARP,OUTPUT);
    lcd.setCursor (5,0);        // go to 1st line     lcd.print("warming up");     lcd.setCursor (5,1);        // go to 2nd line     lcd.print("sensors....");
 starttime = millis();  timeStab=starttime; }
void loop() {  //============= read SY =============  duration = pulseIn(pinSY, LOW);  /*reads a pulse (either HIGH or LOW) on a pin.  For example, if value is HIGH, pulseIn() waits for  the pin to go HIGH, starts timing,  then waits for the pin to go LOW and stops timing.  Returns the length of the pulse in microseconds.  Gives up and returns 0 if no pulse starts within a  specified time out.  */  lowpulseoccupancy = lowpulseoccupancy+duration; //microsec420*6
Serial.println(duration); //lcd.setBacklight(LOW);      // Backlight off
  endtime = millis();  if ((endtime-starttime) > sampletime_ms)  //every 3sec find the value  {    ratio = (lowpulseoccupancy)/((endtime-starttime)*10.0);  // Integer percentage 0=>100    concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; // using spec sheet curve       //the above equation  Concentration in particles (pcs/283ml=0.01cf) Particle Size :over 1µm    Serial.print("lowpulseocc:");    Serial.print(lowpulseoccupancy);    Serial.print(" - ratio:");    Serial.print(ratio);    Serial.print(" - consentr:");    Serial.print(concentration);    myConceSY=(ratio+0.16)/9.6; //this equation gives mg/m3 it is from dust sensor  DSM501 spec sheet /* if you need the concentration in mg/m3 instead of concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; just use concentration =(ratio+0.16)/9.6; //it gives mg/m3 . (not ug/m3) it is a simplyfied equation because the sensor has no so much accuracy */
   if (lowpulseoccupancy==0)        myConceSY=0;    Serial.print(" - myco mg/m3:");    Serial.println(myConceSY);
   lowpulseoccupancy = 0;
//=============== read the SHARP NOW  ============  digitalWrite(ledPowerSHARP,LOW); // power on the LED  delayMicroseconds(samplingTime);   voMeasured = analogRead(measurePinSHARP); // read the dust value  delayMicroseconds(deltaTime);  digitalWrite(ledPowerSHARP,HIGH); // turn the LED off  delayMicroseconds(sleepTime);   // 0 - 5V mapped to 0 - 1023 integer values  calcVoltage = voMeasured * (5.0 / 1024.0);  dustDensity = 0.17 * calcVoltage - 0.1;  Serial.print("signal (0-1023): ");  Serial.print(voMeasured);  Serial.print(" - V=: ");  Serial.print(calcVoltage);  Serial.print(" - Dust=");  dustmgSH= constrain(dustDensity,0,2000);// used only in order to cut negative values  Serial.print(dustmgSH); // unit: mg/m3  Serial.print("mg/m3");    int ug=dustDensity*1000;  Serial.print(" = ");  Serial.print(ug); // unit: ug/m3  Serial.println("ug/m3"); // unit: ug/m3 //=============Write ============================ // lcd.setBacklight(HIGH);     // Backlight on. don't light because there is voltage drop in the sensor SY. so wrong values  lcd.setCursor (0,0);        // go to start of 2nd line  lcd.print(myConceSY);  lcd.setCursor (0,1);        // go to start of 2nd line  lcd.print(dustmgSH);  //========mean values if not warming up  if (warming==true)  {    if ((millis() - timeStab)> stabilizationTime) //if warming time is gone clear screen message "warming up sensors"    {      warming=false;      lcd.setCursor (5,0);        // go to start of 2nd line      lcd.print("            "); // clean screen      lcd.setCursor (5,1);        // go to start of 2nd line      lcd.print("            ");    }  } if  (warming==false)  {  meanVsy=(meanVsy*count+myConceSY)/(count+1); //mean of all the values  meanVsh=(meanVsh*count+dustmgSH)/(count+1);  count+=1;  if (count<=meanPlyth)  //if there are less than 20 values fill the array  {        lastValueSY[count-1] = myConceSY;                  // gemisma tou pinaka twn teleytaiwn deka timwn        lastValueSH[count-1] = dustmgSH;                    }  else  {   //-----------------mean of the last meanPlyth+1 values     meanV5sy=0;     meanV5sh=0 ;    for(int i=0; i<=meanPlyth-2; i++)    {                // shift data in the  array        lastValueSY[i] = lastValueSY[i+1];                          lastValueSH[i] = lastValueSH[i+1];                meanV5sy+=lastValueSY[i];       meanV5sh+=lastValueSH[i] ;   }   lastValueSY[meanPlyth-1] = myConceSY;       lastValueSH[meanPlyth-1] = dustmgSH;      
       meanV5sy+=lastValueSY[meanPlyth-1];        meanV5sh+=lastValueSH[meanPlyth-1] ;  
       meanV5sy/=meanPlyth; //3000ms x20 =3x20 =6- sec=1min        meanV5sh/=meanPlyth ;  
  lcd.setCursor (5,0);      //the mean of the last 1 min     lcd.print(meanV5sy);   lcd.setCursor (5,1);         lcd.print(meanV5sh);  }  //---------------------------  lcd.setCursor (10,0);        lcd.print(meanVsy);  lcd.setCursor (10,1);        lcd.print(meanVsh);  Serial.print("count=");  Serial.println(count);  }  //=======================    starttime = millis();  }
}
0 notes