Application design recommendations for embedded Raspberry Pi with screen reading GPIO & i2c - raspberry-pi

I am creating a simple car dashboard cluster using a Raspberry Pi 4 with a 7in screen and using an 8 channel ADC hat and the GPIO pins for sensor input.
The GPIO pins will be used to read the state of various switches in the car using a step down converter so that when a switch is on 12v from that switch will be converted to 3.3V and send to a GPIO pin so it will be high.
The ADC will be used to read the values of various 5V sensors in the car like oil pressure, coolant temp etc.
The screen is a basic HDMI 7in screen with the Pi mounted behind it and I plan to 3D print a new gauge cluster bezel to fit everything into the stock location. I have a Mausberry power controller so that the Pi will turn on with key on and turn off again with key off. I have modified the Pi so it boots from SSD and starts up pretty quickly.
I have used simple Python programs to read the data from the ADC over i2c and the GPIO pins and output it, no issues there. I have found a nice Javascript based library called Justgage which looks like a great way to display my data in a simple HTML page and have designed my page layout with the various gauges and lights that will eventually have the data read from the ADC or GPIO pins.
What I need some advice on is how best to architect the overall solution, I have all the various parts but need to integrate them. I want to minimise the amount of software running on the Pi so it boots quickly.
At the moment when the Pi boots it auto loads Chromium and opens my page I have created but I need a method to be able to read the i2c and GPIO data and then refresh the elements in the HTML page. The Justgage library supports refreshing the data so that I don't have to refresh the page and would like a method to read the data every second or so and then call the Justgage refresh function.
All the examples of this sort of model I can see online use a webserver running on the Pi but as the screen is directly connected to the Pi I don't actually need a webserver and would like to minimise the amount of software running for reliability and boot times.
Sorry for the long first post and appreciate any guidance. Happy to post the HTML if that would be of any help.
Cheers
Matt.

Related

How to make Raspbian recognize SPI input from ADC as a soundcard

I have an analog to digital converter (ADC) MCP3008 connected to Raspberry PI 4 via SPI interface.
I need to process the signal from ADC in ODAS library (Open embeddeD Audition System).
ODAS is capable to process signal from a device in real time, but requires the device to be a soundcard.
Therefore I need to make Raspbian recognize SPI input from ADC as a soundcard.
After googling I found out that I need to write a device tree overlay to describe the soundcard.
I read about device tree overlays and viewed the device tree specification, but still can't figure out, which nodes and properties should I describe in the overlay?

how could monitor device status using raspberry pi

I want to build a small project which will monitor some devices(pump,ac etc) status(on/off, current/voltage level etc). I have decided to use raspberry pi 3 as a server. I am thinking about scada. is it efficient to do these works? also i am not familiar to scada. is there anyone to guide me--
where should i start?
what is the suitable software for doing it??
You could just use Python and the RPi.GPIO module to control and monitor the GPIO pins on the Raspberry. Python is powerful, open-script and easy to get into.
You would need to develop a bread-board to protect your Raspberry and allow for monitoring higher voltages.
Some example code on using GPIO with Sockets here: https://github.com/matzpersson/raspberry-gpio-sockets
You may use ScadaLTS on Raspberry.
In ScadaLTS have available modbus protocol among many others.
This is web oriented software with graphics views drag and drop editor.
For now you may read GPIO data programmatically to file and use ASCII File Reader DataSource.
We plan to have datasource dedicated for GPIO.
ScadaLTS based on ScadaBR - fast tutorial https://www.youtube.com/watch?v=JjOQWwoaQuQ.
you could also check out mySCADA. they make a solution for Raspberry pi at http://www.smarthouse.cloud
you can use the GPIO on the Pi or talk to industrial PLC's.

Coding Raspberry Pi with an ADC - SPI

I am trying to connect an analogue to digital converter to the raspberry pi. As far as I am able to understand, the RPi doesn't support Bi-directional SPI mode. The adc I am using says it is SPI compatible but only has the inputs SCLK, CNV and outputs CLKOUT+ and CLKOUT- and SD0+ and SD0-. This leads me to understand that it will only work with bi-directional SPI as there is only the serial data out. I am thinking of using a PWM for CNV (which I think CE), GPIO clock for SCLK and then an interrupt on the falling edge of the GPIO clock to just digitally read each bit from the adc. I don't understand SPI in detail but from what I've read quite often it requires sending data in order to receive it. Do you know if the setup I mentioned (without using SPI) will work? Or am I missing something about SPI and the adc will work with that while not in bi-directional mode?
We are using the Raspberry Pi 3 b
adc - http://cds.linear.com/docs/en/datasheet/232316fa.pdf
Thanks for any help you can provide.
Read the data sheet carefully, in particular pages 8 and 9. I suggest that you tie CMOS/LVDS pin to ground to enable CMOS mode. Then use only the "+"-pins. Use the SCK for SPI clock, SD01+ for SPI data input to the Rpi. Connect a GPIO pin to CNV.
Also observe that the RPi runs at 3.3V, and the ADC's max rating is also 3v3, that is running the IC right to the edge.

arduino +odroid (linaru ubuntu with eclipse and opencv) + usb camera

I hope you can help me. I am trying to build a robot but I am kind of stuck. The Arduino Mega is controlling the stepper motors drivers of the robot. The odroid-x is a single board computer that has installed linaro ubuntu and eclipse c++. All the programming is done in C++ and OpenCV is an image processing library.
The odroid-x has only as input a color camera. Therefore, the information from the camera is received and is processed in eclipse. Then, according to the information that is received, the odroid-x should send different integers to the arduino. The arduino should have a program already uploaded in itself, so it will be waiting for an integer and that integer is going to determine what the arduino is going to send to the drivers.
My questions are the following:
How can I do a serial communication between the arduino and the odroid-x?
How can I send information from eclipse to the arduino with a serial connection?
Thanks so much for any guide you can give me
First, be very, very, very careful. The ODROID boards use 1.8V signalling, so hooking up your 3.3V or 5V Arduino to the pins that expect no more than 1.8V will give you a burnt ODROID-X. It is possible to hook these two boards together if you put a level converter between them, and Sparkfun and Adafruit have some of those converters available. There is even a 1.8V reference voltage pin available... one of the pins that go to the LCD panel RGB-to-LVDS converter board puts out a constant 1.8V.
You could use either the four pins of the little white connector, or UART1, as a serial port, or you can use some of the pins in the 50-pin GPIO block as UART4. There are board schematics available on Hardkernel's website. These two UARTs show up as /dev/ttySAC0 (UART1) and /dev/ttySAC3 (UART4).
I don't know how to talk to those UARTs from a program, personally, but I know there are serial communications libraries available for python from watching threads pop up on the ODROID forums.

Set initial state as input on pins using FTDI device FT4232H

I am using a USB device from FTDI called FT4232H and I want to write on the EEPROM to make sure that some pins are set to inputs at start. I am using the D2XX drivers (pdf here). Here I found at page 106 that there is a struct called FT_EEPROM_4232H. Could this be something to use to make sure the pins are set to inputs at the beginning or is this totaly wrong? There are four UCHAR variables called A-, B-, C- and DDriverType. Does anyone know what these should be used for?
I realise this question is 3 months old now but I believe pins on the FTx232H series of chips only get set as GPIO once the MPSSE command SetOutput is issued.
The EEPROM configuration is used to define things like drive strength, slew rate and whether the pin is a schmitt input and what each of the 4 ports are set up to be (async FIFO akin to FT245 series, serial port (FT232), etc).
If anyone else can disprove this, I would be interested to know also!
I just plugged my FT232H board in my PC and ran FTDI FT_Prog, it does not appears you can control the GPIO mode input/output at start time. There is nothing in the FTDI FT_Prog UI that allow to set a mode for GPIO pins and set them as input.
I did set programmatically my FT232H board as an SPI device with 8 GPIOS
but this was done after the chip was started.
A video experimenting with the FT232H
I also once asked FTDI support a similar question for the FT232RL which is as default a UART and I asked if there was a way to configure the chip to start in Synchronous bit banging mode and set the GPIOs as OUTPUT. The answer was no.
The FT232RL will always start as a UART and then by software I can activate Synchronous bit banging mode, and set the mode of my GPIO.
I suppose it is the same for the FT232H, FT2232H and FT4232H.