Need help with a simple project involving a timer

Status
Not open for further replies.

Masonaeck

New Member
I wanted to make a small random timer like this one (https://creativetechguy.com/utilities/randomtimer) in a small box. My goal with this would be to use it for practicing starts on a dirt bike, by myself. I would, in theory press a button and it would start a random timer and once that timer is up the screen would turn green simulating a gate drop/start. I would also like the ability to be able to start a 30min timer on it. I just need to know what parts I need to make it. Any help would be appreciated thanks.

This is what I imagined this front would look like but I don't even know what this thing is so yeah. --> https://www.adafruit.com/product/45...BSfKMkVKK0vwOFriPcfvSJJtWY02W9mxoCpiIQAvD_BwE
 
Why not learn HTML and modify that page to do what you want. You can run that page on any browser - even the one on your phone.

Mike.
 
Why not learn HTML and modify that page to do what you want. You can run that page on any browser - even the one on your phone.

Mike.
Ok so when I learn HTML would it be possible to put what I made on some type of screen that is not my phone so I do not have to strap it to my handlebars. thanks for responding.
 
You could make one with simple parts that gives a random time, just to turn a LED on.

I'd use something like a CD4020 counter IC plus a couple of oscillators based on sections of a CD4093 schmitt nand gate.

One oscillator would run at a low speed, so around 2000 cycles gave the longest delay you wanted. The other would run at very high speed, 2 - 3 MHz.

The start /reset button would switch from the slow osc to the fast osc, so the counter was cycling (it's full count) something like a thousand times or more per second, plus gating the last output back to the reset line which in fast mode.
[Think of it a bit like rolling 2048 sides dice]

Take the highest / last countrer output, use that to control the "GO" LED and also feed it back inverted to the second input on the slow oscilator gate, so that stops as soon as the LED comes on (though it would stay on for the next 30 mins anyway, even without that).

The random intervals would be a fraction under one second, any time from releasing the button to 30 mins later..

If you wanted a delayed start you could use a bit more logic and an R-C delay from releasing the button before the timer switched to low speed.
 
A couple of questions -

1) Do you only use display for a color screen or you also want to put data up on it,
like reaction time, settings, etc...?

2) What languages do you normally code in ?

3) There is a range of solutions, you show a raspberry pi display hat implying using
a raspberry pi either running an OS or something like python. Perfectly adequate
solution could be Arduino running a PWM into an RGB LED that illuminates a diffused
screen to effect a "gate" look. Share some thoughts on this, eg. hi end or low end. Note
Arduino has a random() function to generate the random time for a timer, and can
easily debounce the start switch and handle the color LED drive.

4) Do you need any wireless capability for data gathering or .....?


Regards, Dana.
 
1)For the display I was thinking that there would be some data like menu to choose a 30 minute timer, or for starts.

2) As for what language I code in, I don't but would like to learn so what language would I have to learn.

3) The "Arduino running a PWM into an RGB LED that illuminates a diffused screen to effect a "gate" look" sounds good I have no prior knowledge on anything to do with coding or electronics I just had an idea and wanted to know what it takes to make it real

4) For any wireless capability I do not think I would need any for the random timer and a 30 min timer but I don't know.
 
Based on your answers I would say C for language, Arduino for processor/platform,
a small color OLED display shield for menu and gate indicator (no LED needed). When you
pick a display, size, brightness, make sure it has a library to use with Arduino.

If you have never coded there are tons of videos on youtube to learn C, Arduino is
mostly a C like language.

Do you have an oscilloscope and voltmeter ? For test/debug/development work ?

Its going to take you some time to learn coding. But Arduino is a good place to start.



Regards, Dana.
 
As Arduino uses C++ it would be best to learn that, no real point learning C even though C++ is derived from it.

Even if the OP chooses something else, Arduino is still important, as there's just so much Arduino specific information out there - it's easier to reverse engineer an Arduino C++ library than start your own from scratch from a datasheet (many of which are often quite unhelpful). A combination of Arduino library and Datasheet gives you the best of both worlds. You often get that 'light bulb moment' - when you realise "that's what the datasheet meant"

There are also numerous Ardunio compatible boards, such as STM32 or ESP32, which are small, cheap, and have massively higher performance than an Arduino itself, or 8 bit PIC's
 
Ok I will start learning C++ and I have a voltmeter, I might have a oscilloscope I will look, thank you guys for the help I will let you know how it goes.
 
Looking at web Arduino is not exactly C or C++ but rather a mashup of both.

As an aside there are visual languages that are graphical block based, and you
can get going in under a day. Not professional coding per se, but handy
to use on simple stuff. Kids in 6'th grade and up using them to code robots.

XOD, Ardublock, Snap4Arduino, mBlock, FlowCode to name a few. Here is an example
using mBlock. These drag and drop blocks onto a canvas, you configure, and tool generates
C code for you. That being said if you plan a career in embedded....learn C/C++
for starters.


Here is a simple way to do a talking voltmeter with an Arduino tethered to a PC. In C or C++
that would take significant time to create with C or C++, done in Snap4Arduino ~ 1 hour.




Regards, Dana.
 
Last edited:
1. What is the range for the random timer part. That is, what are the minimum and maximum delay times before the green LED comes on?

2. The 30 second timer is unclear. What is its purpose, what starts it, shat stops it, and what resets it, and what is its output?

rjen has a good approach. A single CD4093 can act as the start/stop flipflop and a dual-function oscillator. One small signal transistor plus one diode can switch between red and green LEDs. The minimum time delay is tricky . . .

ak
 
The random timer minimum would be about 2 seconds and the max would be 5

The 30 "minute" timer would just be a countdown to stop riding. 30 minutes is the standard time for a race so its good to practice that, so ideally I would have two modes "start mode" and "Moto mode" when I am ready for a "moto" I would set the timer for 30 minutes and then get off when that 30 minutes ends with a green screen indicating I am done.
 
Attached is a simple html page that does what you want. You can set minimum and maximum times and then press the go button.
The screen will turn red for the random time.
It will then go green for 2 seconds before returning to white.
If you look at the code in a text editor, the "values" on lines 28 and 29 set the initial values.
The two seconds is the 2000 value on line 48.

Mike.
html files aren't allowed on this forum so it's a text file. Rename to .html and double click it to run it.
Edit, I now try to write lots of things in html and javascript as it's a simple way to get something that will run on almost any device. When you can get Android tablets for US$44 then it's hard to beat. The OP may actually find that a cheap android tablet is the way to go.
 

Attachments

  • timer.txt
    1.4 KB · Views: 325
Last edited:
Reactions: Buk
Looking at web Arduino is not exactly C or C++ but rater a mashup of both.
C++ is always going to be a mix of C, as it's derived from it (and pretty well upwards compatible).

But it's still C++, just C++ for microcontrollers - so has extra functions for that purpose, and needless ones removed - just like all micro-controller languages.
 
no real point learning C even though C++ is derived from it.
I cannot agree with you on that; C++ is a set of additions to C, in some cases just using alternate names or terminology for the existing features.
(eg. a object is a struct under a different name). It's extensions to the original language, not a separate one.

A lot of the syntax is the same regardless of which style you use, procedural or OO, and the compiler may produce the same code from equivalent functions in either style.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…