OK, so I have a 3 pin 315/433MHz rf reader module which I've connected to my raspberry pi 2. 2 pins are for Voltage and ground, and 3rd goes to a GPIO pin configured as input.
I've actually gotten all of this to work just fine. I can read data manually from the GPIO pin just fine, by accessing the file
/sys/class/gpio/gpio23/value
I can even place a car key next to the receiver press a button, and see the values change between 0 and 1.
The problem is that I cannot figure out how to read the clock, so I cannot figure out if there are supposed to be multiple ones or zeros in a row in the data its reading. There doesn't seem to be any time stamp that I can find to see when the last value was read.
How can I properly read the data the module is receiving?
There are two common protocols used for 315/434 MHz radio transmission by hobbyists (that I know of).
Keyfob type remote control devices tend to use Manchester Encoding.
General data transmission using the Virtual Wire protocol (as popular with Arduinos).
My pigpio library has a Python Virtual Wire implementation and C/Python keyfob Manchester Encoding example (for receive and transmit).
your RF reader should be outputting serial data at some known baud rate (check the manual?) assuming you haven't wired it up to the dedicated serial pins you could look at using the pigpio library, more specifically the bit banging serial commands here for python or here for C/C++ or here for pipes
This allows you to use any GPIO pin for reading serial data and the library has bindings for several methods of use as shown in the links above.
Related
I'm using a USB-6356 DAQ board to control an IC via SPI.
I'm using parts of the NI SPI Digital Waveform library to create the digital waveform, then a small wrapper VI to transmit the code.
My IC measures temperature on an RTD, and currently the controlling VI has a 'push for single measurement' style button.
When I push it, the temperature is returned by a series of other VIs running the SPI communication.
After some number of pushes (clicking the button very quickly makes this happen more quickly in time, but not necessarily in number of clicks), the VI generates an error -200361, which is nominally FIFO buffer overflow on the DAQ board.
It's unclear to me if that could actually be the cause of the problem, but I don't think so...
An NI guide describing this error for USB-600{0,8,9} devices looks promising, but following the suggestions didn't help me. I substituted 'DI.UsbXferReqCount' for the analog equivalent, since my read task is digital. Reading the default returned 4, so I changed the property to write and selected '1', but this made no difference.
I tried uninstalling the DAQ board using the Device Manager, unplugging and replugging, but this also didn't change anything.
My guess is that additional clock samples are generated after the end of the 'Finite Samples' part for the Read and Write tasks, and that these might be adding blank data that overflows, but the temperatures returned don't indicate strange data, and I'd have assumed that if this were the case, my VIs would be unable to interpret the data read in as the correct temperature.
I've attached an image of the block diagram for the Transmit VI I'm using, but actually getting it to run would require an entire library of VIs.
The controlling VI is attached to a nearly identical forum post at NI forums.
I think USB-6356 don't have output buffers used for Digital signal. You can try it by NI-MAX, if you select the digital output, you may find that there is no parameters for Samples. It's only output a bool-value(0 or 1) in one time.
You can also use DAQ Assistant in LabVIEW, when you config Digital output, if you select N-Samples or Continuous samples, then push OK button, here comes a Dialog that tell you there is no buffer for lines that you selected.
So I know that for a USB port type A there is 2 ouputs/inputs. I'm working on a simple electronic circuit and I would like to ouput datas on to my computer so a program could work with it. How (without it getting too complicated on the circuit side) can I just choose the output of the USB port and read the input just on the on/off level?
Thanks
What you want is the www.Nusbio.net device.
it is an USB device that give any .NET programming languages access to 8 gpios and also SPI and I2c bus.
USB is more complicated than what you are describing. It sounds like what you really want is a serial port, where you can use the TX and RX lines as your output and input to the PC, or manually control the modem control or GPIO pins. You can still do this with USB via a USB to UART Bridge device.
If you are simply looking to toggle an I/O pin, some of these devices also have general purpose I/O pins for this type of thing. You can set it to low/high from the PC if it is set to be an output and read the I/O value if it is an input.
You can talk to it as a serial device from your computer using normal serial communications such as POSIX method for Linux or OSX or the Commuincations API for Windows. In this case you can also set the flow control to manual and use the RTS/CTS pins as GPIOs.
You cannot directly control the USB inputs and outputs like you want to do. However, there are various solutions that involve connecting a USB device to your computer and sending commands to it that use its inputs and outputs. One such solution is called Firmata.
I am trying to create a space balloon. I need a way to track the balloon. I found a GPS Module with built-in antenna which is the GP-635T. However, after I set it up with the arduino, what is the code or what should I upload to the arduino so that it sends coordinates to the laptop without being connected via USB.
Here is the GPS Module:
https://www.sparkfun.com/products/11571
What you want to do doesn't involve merely programming the arduino. It will require you a radio or satellite transmitter to send out the coordinates to a matching receiver that can be connected to your PC to demodulate the radio signal and present the coordinate data through USB or serial interfaces. I'm sorry to say that, but unfortunately it seems to be a very expensive proposition and a bit hard for you to implement considering you seem not to know how to program the arduino yet or are aware of the additional hardware requirements and technical difficulties involved.
If you do happen to get a radio or satellite transmitter to go on the ballon and supply it with an adequate battery, the arduino part will be the easiest, just read the coordinate data from the serial port connected to your GPS module and relay it to the other serial port connected to your transmitter. Since you only have one hardware serial port on the arduino you'll have to use a software serial library for the other one.
A common hobbyist method to balloon tracking is to use the cellular phone system. Get a cellular module and have the Arduino text its location to your phone.
This obviously won't work in near-space but it's a cheap, long range system for balloon recovery once it gets closer to the ground. (Provided you are in an area with adequate cell phone service and not in the middle of a desert)
I am working on Xilinx Spartan 3E platform, using this development board:
http://www.xilinx.com/products/boards-and-kits/HW-SPAR3E-SK-US-G.htm
My program operates on certain data and then provides output. I wish to transfer the input signals externally. The input data is a stream of 8-bit signals.
So, how do I send the input signals from my laptop to the FPGA via USB? Does Xilinx support this or is there standard software to do this?
Thanks.
It sounds like you are describing a uart more than a native USB interface. You can get a USB to logic level serial adapter that will let you easily transfer data to and from a Pc at up to 921.6k baud. A uart/serial port is easy to implement in the Fpga and PCs are easy to use with serial ports.
Here is the cable:
http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
If you have a development card it is very possible this type of interface is present.
On the software side you can use your programming language of choice as if it was interfacing with a seal port or use a terminal program like hyper terminal or Download teraterm http://ttssh2.sourceforge.jp/
Updated response:
100Hz is not a hard interface to make. At that rate you should use the serial interface if at all possible. The board you referenced has 2 full RS-232 connections. At that point you only need a way to connect that to your computer. If you have a PC with RS-232 connectors you only need a cable if you have a newer computer without you need a RS-232 to USB translator cable (like this one: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=768-1014-ND or google rs232 usb). This will give you a virtual com port on the pc to interface with the previously mentioned terminal programs or your custom software.
Update 2:
on the resource tab of the development board page you linked to there are several UART based fpga designs that you should be able to use as a starting point.
i.e. the "PicoBlaze Processor SPI Flash Programmer".
That board doesn't provide easy access to the USB interface from the FPGA as far as I can tell. It's just for configuration and debug.
Some of the newer boards and tools do allow something called hardware-in-the-loop testing where the simulator can upload data to the FPGA, wait it to calculate the results and then pull the data back. This is relatively common when using Xilinx's System Generator product as the simulations can be really long.
But I think with that board you'd be better off using the on board RS232 port to get data to and from the board. You will have to build the infrastructure to do it yourself though.
This may also give you some ideas:
http://www.1pin-interface.com/
I'm looking to control a mains powered light from a simple relay switch connected via USB to the computer.
The relay switch isn't even a USB device, it's just a simple switch that requires the USB voltage to turn it on. When the voltage drops below a threshold, the switch will turn the light off.
My problem is that I can't control the power output of a USB port. I'm happy to do it using any language on Windows or Linux (but preferably Java because I'm used to it).
Unfortunately, in most cases you cannot control the power supply to the USB port. The power supply is usually hardwired through, and not switchable in software. You can send a reset to a USB device, but that won't work in your case.
There are a number of projects on instructables that do similar to what you describe, but unfortunately they seem to either be quite complicated or require expensive parts.
EDIT: There is actually a product currently in the news which would do want you want, but it doesn't appear to be shipping yet: http://www.pwrusb.com/
EDIT (again): Apparently you can do this with some usb hubs. This post sugggests the Linksys USB2HUB4 is one that works.
EDIT (and again): Apparently there are a number of similar questions, but there don't seem to be any more useful answers:
https://stackoverflow.com/questions/405269/custom-usb-device-that-disables-power-to-usb-devices-plugged-into-it
Power off an USB device in software on Windows
Is there software or code to alter USB power output
Can I write a program that swiches USB on/off
Most of the USB to Serial or USB to RS232 $10 converters support hardware handshaking. Use one of those as a single channel digital io.
Connect your transistor that will drive the relay to DTR on the converter board and command DTR ON/OFF with the converters driver.
A 2N7002 is a good transistor to use (FET actually) since it will work from 3V and doesnt need any resistors anywhere.
Here is a complete solution.
It uses an Arduino board, with a USB connection, (and Uno for example) to control the relay and combines this with pfod (Protocol for Operation Discovery) www.pfod.com.au which will let you control the board/relay from either the Arduino IDE SerialMonitor, or a terminal window (TeraTerm) or a Java program. The message protocol encloses commands in { }, think simplified html for micros, and provides numerous screens, menus, sliders, text and numeric inputs, etc. A detailed protocol spec is available
See Garage Door Remote for a detailed example, with full Arduino code and an example of controlling the relay from TeraTerm as well as the Arduino IDE SerialMonitor.
There is also an Android app, pfodApp, which will do general purpose control via bluetooth, or wifi/internet with 128 bit security. The pfodApp does all the Android stuff, you only need to code some simple strings in your Arduino code to get any menu system you want. See www.pfod.com.au for numerous examples.
You need a USB-GPIO microcontroller:
Adafruit FT232H (about $15)
Arduino Nano ATmega328 (about $7)
See this answer
I would suggest placing a separate Raspberry Pi unit with a wake-on-lan feature activated so you can ping it off and on.
You could do it by combining these two products from Pololu, for about $25:
Micro Maestro (assembled)
Basic SPDT Relay Carrier with 5VDC Relay (Assembled)
The Maestro is mainly a servo controller but you can set any of its channels to be simple digital outputs instead. The output can be controlled from the Maestro Control Center software or you can write your own software. A digital output from a Maestro is suitable to turn on the relay on the relay carrier. The relay could be powered from USB through the Maestro; I think it draws about 100 mA of current so that probably will not be a problem for most USB ports, though it would not be USB-compliant because the total current drawn by the Maestro and the relay would be over 100 mA. You could supply your own power source for the relay if you are worried about that.