1

TL;DR I am storing a 24-bit number that represents number of pulses from a clock on a digital counter IC, and want to transmit that number to a more sophisticated device to perform a speed = distance/time calculation. Is there a simple way to do this over an internet protocol like HTTP, or utility like netcat, without a CPU?

Conceptually the problem is very simple - I have a 24-bit number that I need to transmit to a hard-coded network address.

I am making a speedometer using digital ICs and motion sensors - when an object moves past the first row of motion sensors, it starts the timer (LM555 IC), and when it moves past the second row it stops the timer. The timer is pulsing a 24-bit counter (74HC590's chained together). In order to calculate the speed of the object, we need to calculate speed = distance / time = distance_between_sensors / (sampling_frequency * num_pulses). This computation, though possible to perform using ICs, would be simpler to perform on a more sophisticated device because it involves floating point numbers up to 24 bits. I am trying to do this project without a CPU to keep costs lower and make it easier to reproduce. Most people alredy own multiple sophisticated computers and devices with network acccess that I would like to make use of.

Is it possible to transmit the 24-bit number (representing number of pulses from the clock) to such a device without a CPU on the speedometer? Ideally there would be a black-box device that would require a hard-coded network address for HTTP or other network protocol like netcat. This address would be serving requests of a fixed format from the device, and performing the computation.

cornelius
  • 255
  • 1
  • 7
  • 3
    Define "CPU". You can probably find some way to make something that can do this that doesn't technically count as a CPU by any given metric. – Hearth Nov 17 '23 at 04:26
  • It sounds like a better question to ask would be: what is the best way to measure timing remotely, and transmit it onwards to a system where it can be processed into a speed, such as for a chronograph? If you agree, please add any relevant details to constrain such an application. – Tim Williams Nov 17 '23 at 04:46
  • @Hearth I have edited the original question to use the term "micro-controller" rather than CPU. I want to do this without an expensive multi-purpose component like a micro-controller – cornelius Nov 17 '23 at 05:19
  • What do you consider a network? Ethernet, wireless, bluetooth, some other network? And a CPU for that matter? Do you count a microcontroller as CPU, or Raspberry Pi, or ESP32? Sure you can do it without a CPU but do you really want to do a job of CPU and OS with network stack with something else like FPGA? What would justify it being harder, more expensive, taking longer to make, etc? – Justme Nov 17 '23 at 05:21
  • 4
    Many microcontrollers are cheaper that the parts and labour required to do this with discrete components. The necessary calculations could probably be done in an Arduino or similar device, without needing to send the data off somewhere for processing. – Peter Bennett Nov 17 '23 at 05:22
  • Where is it stored? Even one of the simplest kind of memory, a shift register, has an implicit interface that can be read either in parallel or series – tobalt Nov 17 '23 at 05:59
  • @PeterBennett a micro-controller is a multi-purpose device whose function is a large super-set of arithmetic logic or network capabilities. Therefore, shouldn't it be less expensive to perform these in isolation? – cornelius Nov 17 '23 at 06:16
  • @tobalt I am using three 8-bit counters (74HC590) chained together to store the 24- bit number – cornelius Nov 17 '23 at 06:28
  • Depending on the network's protocol, a microcontroller like an ARM based MCU can be factors less expensive than the discrete digital circuits. I'm afraid your assumptions about costs are wrong. That's why we ask for clarification and your requirements. – the busybee Nov 17 '23 at 06:51
  • @thebusybee there aren't many requirements, it's a personal project I am doing for a hobby, with a goal to reduce costs as much as possible. See my reply to Peter Bennet regarding my assumptions about costs – cornelius Nov 17 '23 at 08:36
  • 4
    @cornelius Therefore, shouldn't it be less expensive to perform these in isolation? No, the opposite is the case. Economies of scale allow microcontrollers to be very cheap for what they can do. Your system would probably get cheaper if you threw away all your custom logic and replaced it with a single microcontroller. – Marcus Müller Nov 17 '23 at 09:12
  • The ethernet bit is easy in a microcontroller as you can just use some already developed code and usually has at least a 16 bit counter that can do your counting. Just add the sensor interface and you're pretty well done. See https://electronics.stackexchange.com/questions/297/what-is-a-good-microcontroller-for-ethernet-applications and https://www.instructables.com/PIC18-Development-Board-with-Ethernet-and-USB/ – D Duck Nov 17 '23 at 09:24
  • 1
    @cornelius There are microcontrollers that cost less than $0.10. It is almost always cheaper to use a microcontroller than to try to do it with discrete logic. – Hearth Nov 17 '23 at 13:28

2 Answers2

2

If you are measuring the time for an object to move between two points using discrete ICs, then you have already spent as much on components as you would have spent on a microcontroller.

Discrete component circuits are good learning tools. They teach you about what goes on inside of more complicated systems. The problem is that they become really expensive and complicated when you try to expand them.

You've found that it is relatively simple to count the time period with a timer IC and some counter ICs. Now you'd like to do some math, and the project complexity is going to explode.

You can't really "offload" the calculations to a PC or other full sized computer.

If you try to implement, for example, an Ethernet stack so that you can send the count to a PC you will end up implementing a tremendously complex pile of electronics that will (at some point) end up implementing all the things contained in a typical microcontroller. On top of that, you have to implement the hardware interface - Ethernet isn't simply some wires connected to a chip. There are transformers involved and line drivers to push a signal with the proper levels through long wires.

The cheapest way to implement what you want to do is to use a microcontroller development board. Something like an Arduino, or any one of many alternatives.

I can buy Arduino Nano knock-offs for about $4 US each. That's probably less than you spent on your 555 timer, the counter ICs, and whatever glue logic you needed to make it go. You could program a Nano to measure the time period easily, then adding the speed computation is trivial - and you can easily connect the Nano to a display of some sort to show the result. You could also put an Ethernet adapter on the Nano and send the data to a server some where for logging or analysis. Even easier would be an ESP32. $5 US each in a pack of three, and it has WiFi built in.

I'm all for using discrete components to learn, but it is usually cheaper and simpler to throw a microcontroller and some software at real world tasks.


I find your 74HC590 at $0.88 US at DigiKey, and the LM555 for $0.80. That's already $3.44 US. That's already most of the price of an ESP32. You are headed for a really expensive project if you stick with discrete parts.

JRE
  • 71,321
  • 10
  • 107
  • 188
1

I don’t think so.

A networking protocol stack requires elaborate state machines, nontrivial data storage and serialization, and support hardware. A simple digital system could transmit your 24-bit value via something like SPI or UART, but Ethernet+TCP/IP is out of the question even for the most minimal robustness and security. The internet protocols were designed to run on CPUs. Even the ugliest hack would probably require at least an FPGA, and CPUs are easier to work with than FPGAs.

Adam Haun
  • 21,959
  • 4
  • 51
  • 91
  • I agree: It's possible to send 24 bits via SPI or I2C and to a PC via a USB-to-RS485 or USB-to-SPI adapter. I did the experiment myself. But via the internet or Ethernet, addressing and protocols are too complicated. It would require an insane amount of logic ICs if you can manage to find out how and a very large PCB. Of course the cost of programming, if you can't program a CPU yourself, is quite high. There is also cost related to factory programming in mass production. But that's the only way to do it. – Fredled Nov 17 '23 at 13:36
  • 1
    There are chips out there that do Ethernet to/from simple serial protocols like UART, but they're basically full microcontrollers just preprogrammed. And I don't recommend them; they have no hope of keeping up with security features of any type. – Ben Voigt Nov 20 '23 at 16:12