if (derivative > 0) Serial.println(100);
else Serial.println(0);
you can of course also use newval in this comparison to suppress some noise.
if (derivative > 0 && newval > 40) Serial.println(100);
else Serial.println(0);
Multiple analog reads and averaging them also suppresses some noise of the ADC (==analogRead().
I often average 4, 8 or 16 reads as this divides fast.