DHT11 + Arduino UNO + Raspberry pi3 + Windows Remote Arduino - c#

I need to read with C# UWP App, a DHT11/DHT22 sensor to get temperature and the arduino is conected to an Arduino UNO.
Can I use "digitalRead" at sensor PIN and converte the values using C# library
'sensors.dht'? Or I need to change the FirmataStandard sketch to include dht library and receive the values "cleaned"?
Thanks very much!

In theory, your plan is possible utilizing Windows Remote Arduino.
But currently, there is no official solution for your user case.
So you may need do some work by yourself. You need modify GPIO OneWire DHT11 library to fit your solution, such as, replace Windows::Devices::Gpio::GpioPin::Read() with Microsoft::Maker::RemoteWiring::RemoteDevice::digitalRead() and so on. Also note the time sequence due to DHT11/22 datasheet.
Finally, you may need sufficient test to ensure this solution works as expected.

Related

Renaming a selected Serial Port from COMX to COMY using C#

I can currently read and write to my serial ports on the machine, but I wish to be able to change from, for example, COM3 to COM4 within my program. I can't find a way to do this online - I've seen you can potentially use Windows Developer Kit but unsure as to whether that can be used with C#? Thanks.

SpiDevice read, write and transfer

Playing with Windows IoT on a raspberry pi 3 and I am trying to communicate to an Adafruit RFM69HCW.
I have connected to the device via SPI and not matter what I do I can't seem to get the pi to read anything from the device registers.
The one thing I wanted to know is what exactly does SpiDevice.Read(), Write(), TransferSequential() and TransferFullDuplex() do?
I know the obvious basics but I am after the steps it performs for each function.
Reason I ask is because in the spec of the RF module it says when communicating you have to set the CS pin to low, send the command and then set the CS pin back to High. Does, for example, SpiDevice.Read() do this already?
I have been converting both an Arduino library and a Python Raspberry Pi code so I know about doing the Hard Reset first.
Link to the spec if anyone interested.RFM69HCW-V1.1.pdf
Reason I ask is because in the spec of the RF module it says when
communicating you have to set the CS pin to low, send the command and
then set the CS pin back to High. Does, for example, SpiDevice.Read()
do this already?
Yes, you are right. I test the SPIAccelerometer sample and get the following sequence diagram. The yellow line is chip select and the other is clock line. As you can see, when writing and reading the CS is set to low.(The wave shape is ugly because my scope has low performance.)

Write file to a PNP device connected to a Windows PC

By plugging in a PNP device to a Windows PC I want to know if the device supports a feature of data transferring. I am majoraly interested in pushing some content to device.
So, for example when I am plugging in a Windows Phone I can see over windows managment query that 5 new devices are added
Name: Windows Phone
CompartibleId: USB\MS_COMP_MTP,
USB\Class_06&SubClass_01&Prot_01, USB\Class_06&SubClass_01,
USB\Class_06
Name: WinUsb Device
CompartibleId: USB\MS_COMP_WINUSB,
USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff,
USB\Class_ff
Name: WinUsb Device
CompartibleId: USB\MS_COMP_WINUSB,
USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff,
USB\Class_ff
Name: WinUsb Device
CompartibleId: USB\MS_COMP_WINUSB,
USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff,
USB\Class_ff
Name: USB Composite Device
CompartibleId:
USB\DevClass_00&SubClass_00&Prot_00, USB\DevClass_00&SubClass_00,
USB\DevClass_00, USB\COMPOSITE
How can I now get a glue that:
All the devices are parts of a single device
The device allows me to save a file on it
Find an indicator that certainly tells me about the suppoted file transfer protocol
In case if there are more than a sigle possiblility for file trasfer select the more fastest(or modern)
I will appreaciate any help even if you could just tell me a focused direction where I should continue my study/investigation.
I am looking at a generic way to work with devices. Desired implementation language is C#.
Firstly You can consult this codeproject it gives you details of Windows Device Drivers.
SharpUSBLib and HidLibrary are two widely used libraries you can even get a tutorial project with implementation here.
SharpUsbLib earlier version used to screw up systems.
Would prefer libusbdotnet.
If you have to work with an USB device (send requests, process responses), this library was the best solution I could find.
Pros:
Has all methods you need to work in synch or asynch mode.
Source code provided
Enough samples to start using it straight away.
Cons:
Poor documentation (it's common problem for open source projects). Basically, you can find just common description of methods in the CHM help file and that's it. But I still find provided samples and source code is enough for coding. Just sometimes I see a strange behaviour and want to know why it was implemented in this way and can't get even a hint...
Seems unsupported any more. Last version was issued in Oct 2010. And it's hard to get answers sometimes.

Intercept and modify USB packets

The project is as follows;
I would like to create an application that will be able to see packets going to a USB device. When a certain bit of data that is known is sent to the device, the returning data will be intercepted and modified before the application requesting it, gets it. I have used a USB sniffer to see the packets being sent and I know exactly what bits need to be changed. My two questions are;
Is this a possible software solution?
Will this have to be a hardware solution?
Additional Information –
The USB device uses a FTDI245R chip for communication. I know the VID and PID of the device.
I have experience programming in vb.net and C# but I have never done anything with USB
I would like the application to be able to have a number entered and changed to hex data and that is what would be sent to the device. The number being entered would be changed frequently.
Any input is appreciated.
It sounds to me like you want an upper filter driver to the FTDI driver. I don't know what class or type of device you are using or if it has a vendor specific driver or not, but here is a sample that shows how to create an upper filter to a vendor specific driver. This example uses the OSRUSBFX2 device and sample driver in the WDK, you'll want to change the code to work and interface with the FTDI driver instead.

Datalogic Barcode/Weight Scanner

Could anyone please give me any idea as to where to start my coding in order to get data from OPOS(Datalogic Magellan device) weighting and barcode scanning in C#?? For example, what library and what function I should be using for this case. I am clueless as I have already spent numerous of hours searching for an answer online. Not even came close online.
I don't know any api that I can use to get the weight and barcode for the usb device into my C# program.
I am currently using Datalogic scale. I tried the build-in windows reader but it didn't read in any data from the device.
First off, I used the Microsoft.PointOfService library which can directly create connection to most of the opos base machine. And make sure you have your Logical Device Name right! Very Very important. This is NOT any normal name you found in your regedit, it MUST be define manually by yourself inside the opos adk program that you installed along with the opos machine.
Then you can pass in the name as usual in your C# program.
For example: you set USB_Scale as your logical device name inside OPOS program
in C#
this.myDevice = explore.GetDevice("Scale", "USB_Scale");
Note: Make sure you set claim to 1000; It might not work if you didn't do so.
Also : this.myScale = ((Scale)explore.CreateInstance(myDevice)); <- this might help~
The rest is just straight forward.

Categories