You could package the values on a single output line, using commas as a data separator. Maybe you have multiple gauges that read multiple sensors. There are lots of cool things you can do with “sim data” capability. Here’s some brute-force code that sweeps values up and down, from zero to 100, in increments of 10, at 1/2 second intervals.Ĭertainly, we’d need to scale the sim data and the Processing gauge program to handle the 0 to 900 thermocouple temperature range, along with an appropriate change to the dial face on the display machine side. Write some code to print a string of values to the serial port, upload it to any old Arduino you have lying around and when it reboots start reading the data on the other end of the USB cable. ![]() You can actually build a bare-bones hardware data simulator on an Arduino in a matter of minutes. This week we’ll look at a few simple ways to simulate data for on-screen gauges, readouts, dials and other uses. Your gauge program thinks it’s reading real sensor data. That frees you up to develop your gauge or another program on the Linux machine while you wait for the sensor to arrive. The good news is that you can “simulate” data with a minimal bit of code on the Arduino sensor device. It could be on the proverbial slow boat (or plane) from China or something. Occasionally the sensor isn’t available yet. A companion program, on Linux display machine, can suck in the data and do something like spin the needle of an on-screen analog gauge according to the sensor readings. ![]() ![]() We read the sensor, scale the value to something practical, then print the data out to the USB port. Capturing real-world measurements with a sensor and an Arduino microcontroller, then pushing those readings over to a Linux computer for display on an analog gauge program or other usage is fairly common now.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |