Counting input pulses with a raspberry pi 3 and showing the results - raspberry-pi

this is my first time working with a raspberry pi and also with structure code( full ladder coding here) My main objective is to connect 4 inputs on my raspberry pi GPIO, I need to count each pulse and display each one of them with a log (date and time) on a web page or any other suggestions to view the data.

Related

PI controllers for 4 motors in a Raspberry Pi 4

I am trying to create a code for a Raspberry Pi4 where I want to control 4 motors (there is not a limited lenguage it could be Python, C or C++ code as long as it works) . I already did the simulation in Simulink with a cascade Pi controllers (3 Pi controllers for control the location and 4 Pi controllers for each motor - I attached an image to be more clear) and the simulation works already good; however, I am not sure how to do it into the Raspberry Pi.
The main idea is that the little car has to move to different given coordinates (X, Y and Z coordinates, but Z is always 0) controlling the positon and the velocities from each motor. My understanding is only to code the Outer PI, Inner PI and the Bi(teta) (see the images I attached) because the motor model, the dynamic model and the kinematic model is done with the robot mobil, so it does not have to be code. In the case of the reference they have to be given in a data sheet (e.g excel file).
The motor driver I am using is two L298N (1 per 2 motors).
Here is the image of the simulation with the cascade P - (https://i.stack.imgur.com/XDrFo.jpg)
Here is the image of the Bi(theta) matrix - (https://i.stack.imgur.com/iMJNU.jpg)
I have never done something like this, if someone can give me a hint or explain me how it can be done I would really appreciate it!!
I hope my explanaition was good enough but if not feel free to ask for a better clarification.
Thanks in advance an have a great day!!

raspberry pi gpio or rs232 relay board for simultaneous output bit-map?

I really wanted at first an rs232 8-channel relay board that I could command devices to turn on/off with a command string.
All of the ones I found online have the same deficiency in functionality for me: you can't set a subset of relays at the exact time. I can set relay 1 on, and then relay 7 on afterwards, I can set all 8 relays at once, but there is no command structure to pick out the exact leds I would like to turn on/off.
In the past I have dealt with hardware that had a bit-map of the IO pins, and a bit-map of the states and would apply all 8 settings at once. here are some examples:
to set pins 1 and 7 to on and the other pins off (8-bit binary bit-mapping,) send the following byte: in binary: 0100 0001b
to set pins 1,2,3,6 to on and the other pins off (8-bit binary bit-mapping,) send the following byte: in binary: 0010 0111b
I couldn't find any such device to do this so I thought I could make one with a raspberry pi using a simple 8-channel relay board, something like this:
https://www.amazon.com/SainSmart-101-70-102-8-Channel-Relay-Module/dp/B0057OC5WK
but on a Raspberry Pi, I'm running into the same issue: I don't see a way to set the gpio pins as a block command, only individually setting them in a for loop. I looked all morning and can see things like gpioctl, and mmio, but I can't put it all together to a simple proof of concept program on a testboard, any help would be appreciated.
I would really like a solution in C or scripting,
Thanks,
jleslie

IMU-Camera Time Synchronisation on Raspberry Pi

I'm using MPU6050 IMU with the raspberry pi. I want to get data at a required frequency, for example, 200 Hz that is I want data at every 0.005 seconds. How do I go on to accomplish this? I'm using i2c for serial communication. Feel free to suggest any other method by which I can get this done.

Anker Astro E4 to power Raspberry Pi

Looking for some help to be honest, This is not my area of knoladge atall.
Ive read around the question of powering my Pi with a battery, now I nabbed one of these guys for my phone
http://www.amazon.co.uk/13000mAh-Portable-External-Technology-Motorola-Black/dp/B00BQ5KHJW/ref=sr_1_cc_1?s=aps&ie=UTF8&qid=1420826597&sr=1-1-catcorr&keywords=anker+astro+e4
Incase the link dies in the future;
Item model number: AK-79AN13K2-BA
AnkerĀ® 2nd Gen Astro E4 13000mAh 2-Port (3A Output) Fast
Max 3A Out
5V Out
Now, from what i've read there have been mixed notes of, don't use batterys, only use this battery, don't do this, don't exeed this magical number ( which was differant each time ). so any help would be grately needed. If i was to power my pi via this thing. im I going to get a poof of smoke and need to replace the poor pi :(
A raspberry Pi is powered via USB, which means that it simply takes the 5V supplied via USB to run. As long as your current source is stable (ie. it doesn't change when you draw current from it), no device will care whether it is a battery or a switching power supply. Now, a bare raspberry Pi B uses less than 2W of power, 2W/5V = 0.4A = 400mA, so if that battery pack lives up to its specification, you are going to be fine. The device is spec'ed to provide 13000mAh, so at a constant current of 400mA, this would last you more than 32 hours.
Now, most people attach something to the raspberry, and that something will also draw power, but just add that power to the calculations above, to see if it's going to work out.

Tipping bucket rain gauge datalogger using Raspberry Pi

I have rain gauge that has a PCB that counts the number of tips. From that PCB there is a output wire. I want to connect my Pi to that wire and count the number of tips and store the values for every half an hour or so. The whole setup should run on a battery.
I am planning to use weewx python library to do counting and storing data. But I want to know which terminal I should be connecting the rain gauge wire.