Sensor Programming

Although we discuss sensors in depth in the third book in this series, DIY Instruments for Amateur Space (O’Reilly, 2012), you have to think about your sensor programming architecture when you are choosing your build-out for your basic satellite platform. Sensors will be analog or digital. Analog sensors require you hook to the A2D (analog-to-digital) ports on your microprocessor, while digital sensors will hook in directly through digital input pins.

There are competing standards for hobby sensor use. A fixed-baudrate serial line (UART) is not something I recommend, as one thing you require is to identify a given sensor as well as receiving the data. For a single sensor, however, it is possible to go with a serial connection. CAN Bus or 1-wire, similarly, are technically possible and have some library support for both processor types, but I would not recommend them.

I2C is a low-powered two-wire sensor standard that can run at a 10kbit per second low-speed mode using 3.3V or 5V signals, ideal for the processors chosen. Standard libraries exist for both BasicX-24 and Arduino to manipulate I2C data. The primary advantage of using I2C is the wealth of premade sensors that use this format.

Data typically comes in constantly, but to save on storage, you can decide whether to transmit periodic values, rolling averages, or deltas. For a periodic value, you check the incoming data stream against your processor’s internal clock and sample the data at the desired interval, ...

Get DIY Satellite Platforms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.