Android Things HX711 - raspberry-pi3

i want to read a load cell with the raspberry pi 3 and android things using a HX711 24-bit adc and i2c. After hours of searching i still havent found a solution on how to set up the hx711 using i2c and read data from it.
Is it even possible for now?

For I²C on Android Things: take a look at Official Documentation, than at example like this (especially at that file), this or that (MCP 4725 — I²C Communication Basics part).
But, seems as described in datasheet, HX711 has interface similar to I²C, but not exactly I²C. Please take a look at this project for details.

As pointed out previously, HX711 does no use i2c, but needs to be bit-banged from GPIO.
For Raspberry Pi, I have a threaded c++ solution for reading weights from an HX711, with a Python/C module wrapper so you can use it from Python.
More explanation and code at:
https://github.com/jamieboyd/AutoMouseWeight
https://github.com/jamieboyd/GPIO_Thread

Related

Does the Sparkfun ESP32 Thing is compatible with generic modules like DHT11 sensor?

First of all I am kind of a noob working with microcontrollers, by the way I am using Arduino IDE 1.8.13
I fallowed the hookup guide to set up Arduino IDE to work with Sparkfun ESP 32 Thing board, and actually I was able to run the Arduino examples "Blink" and "Wifi" with no problem.
But my problem is when I tried to use the DHT11 sensor, I did fallowed several tutorials like this one but for my bad fortune I did not succeed, instead I was getting NaN reading from the temperature and humidity sensor, at first I thought it might had something to do with the libraries version, which I installed and uninstalled several times, including the IDE, then using those same libraries I was able to do the exact same example on an Arduino Uno microcontroller.
Then I realized I did not find any example, tutorial or document using the Sparkfun ESP32 Thing with the DHT11 sensor, since most of the examples that I found are for the generic ESP32.
Which makes me wonder, how can I know if those two components are compatible at all?
Does any one has faced something similar using ESP32 Thing with DHT11 or any another sensor?, if yes, how did you make it work or what did you do instead?

SAMD21G (Cortex -M0+) Programming/Debugging Connection

I bought a SAMD21G18A (ARM Cortex M0+) from RobotDYN and trying to simply get setup to program it but I can not find much documentation on how these are connected/setup for programming and debugging.
On the website it states "One of its most important features is Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware..." so I assumed that the connections would be similar to some of the other MCU Development Boards like the Arduino, PI or Beaglebone meaning that there isn't any need for things like a JTAG Programmer but I don't know if that's the case or maybe I am just confused on how to set this up.
Can anyone point me in the right direction on how to upload the program and get my IDE setup? I can find all sorts of information on the Registers, the newlib library and stuff like that, but I can not find much on the actual connections or other needed components.
I would prefer Visual Studio +VisualGDB if anyone uses that combo but I will take any help so I can just get started. I also have tried Atmel Studio and the Arduino IDE also without success. Just to mention I am not looking for a step by step guide, just some direction and explanation of how I should proceed.
When I installed the Arduino IDE I was able to get the board to show up under COM11 as a Arduino-M0, so possibly I am simply missing some drivers?
Edit:
I have been searching the internet for possible ways of hooking this up and it seems like I need to have some sort of programmer/debugger. I also found there are a couple types of these boards out there, one of them is the XPlained series. I looked at the schematics and they have a ATMega in addition to the ATSAMD21. I have a variety of AVR's, BeagleBone Black and also a FTDI CDM USB cable. Does anyone know if its possible to use any of these to setup for programming/debugging?
Your SAMD21 board from RobotDYN doesn't have the Atmel EDBG interface, so you need an external SWD debugger like the Atmel-ICE you mentioned in your comment.
This debugger comes with the standard 10-pin Cortex Debug Connector, which is also present on the RobotDYN SAMD21 board (labeled "SWD(EDBG)", which is a bit unfortunate since it seems to suggest this is an EDBG interface, which it isn't). So the only connection needed is between these two connectors via the flat cable that is likely included in your Atmel-ICE kit. Pay attention to how you connect the cable to the RobotDYN SAMD21 board: the first pin of the 10-pin header (i.e. the one with a "1" label next to it on the PCB) must correspond to the first pin on the the Atmel-ICE connector, which is the pin at the bottom left. See also http://microchipdeveloper.com/atmelice:connecting-to-avr-and-sam-target-devices.

Raspberry Pi Embedded application

I am developing a computer vision system to control orientation of two mirrors to track stimuli in field of view.We are sending coordinates to motor over network and trying to track as smoothly as possible.
I have two questions regarding this :
1.Is Python suitable for this kind of project . I have already coded it in Python and find it very easy to use.
I am running Raspbian on raspberry Pi but found that it's not a real time os. We are sending command every 20 ms to the server built on raspberry Pi. Should I switch to arduino or patch the Linux kernel for this application.
Python, combined with OpenCV, is one of the best candidates for this task.
As mentioned in the comment above, the "real-time" issue is OS related. I personally recommend an Arduino-based solution, even though that puts more burden on the hardware design. You could also check the new IoT solutions from Intel, they have a wide range of boards.

How to create a virtual printer in Windows?

I want to create a virtual printer driver for Windows. How and where can I start properly? The WDK has some printing drivers examples that do not seems a good introductory. MSDN also doesn't seems to be very helpful for a novice.
There are a lot of virtual printers for Windows out there (mostly they generate PDFs), I wonder if someone could tell my how can I do the same?
Any links to the elaborating documentations are appreciated in advance.
Thanks.
When I did it (which about 12 years ago) I started with the postscript driver sample, replaced all the postscript-specific stuff (in my case, to write to a bitmap instead of generating postscript commands).
I also wrote a custom print monitor (the driver writes to the spooler, which write to a monitor): my monitor wrote to a file instead of e.g. to the parallel port.
However, printer driver architecture and/or the set of sample drivers may have changed since then.
You can look to the 'minidriver' development in the from Microsoft (Microsoft MDT), that might help depending on your exact needs. If the port you need to deal with (ie: you are going to take the data from an existing printer driver and want to process) you could look to the source code for RedMon. It doesn't support Vista/Win7 but might point you in the right direction.
This book maybe help you Developing Drivers with the Windows® Driver Foundation
A list of my links
http://www.codeproject.com/KB/system/driverdev.aspx
http://www.microsoft.com/whdc/ddk/winddk.mspx
http://jungo.com/wdusb.html
https://web.archive.org/web/20130717135254/https://msdn.microsoft.com/en-us/library/ff554651.aspx
http://channel9.msdn.com/posts/Rory/Driver-Development-and-Much-More-With-Mike-Calligaro/
One of the drivers you mention is open-source (GPL), maybe you could explore its source or adapt it: http://www.pdfforge.org/products/pdfcreator/download
Someone else already mentioned PDFCreator. Here's a more specific link to their code that's creating the printer, port and monitor. Despite being in VB, I can follow it as someone more used to C++, so I guess you can too. modPrinter.bas does the leg work. modMain.bas, from about line 28 onwards, calls into modPrinter.bas.
Create a Print Port Monitor, associate that port with a printer, and you'll get the data the printer driver sends to the port.
working example of how is it done in Cpp and java can be found here:
http://www.mms-computing.co.uk/uk/co/mmscomputing/device/printmonitor/index.php

Basic example of serial communication with Windows XP/win32

I am working with a peripheral device that needs to be communicated through serial. I can send it commands using HyperTerminal, but now I need to write programs that will let me do it without HyperTerminal. Can somebody point me to a website and/or show me a sample hello world program to get me started? I have searched through many sites which give me uncompilable/ancient VC6 code.
In order to interface with the serial port, you open a file with one of the special filenames "COM1" through "COM9". For serial ports with higher numbers, the special filename begins with \\?\, which in C/C++ code must be escaped as "\\\\?\\COM10", etc.
http://msdn.microsoft.com/en-us/library/ms810467.aspx has a really good tutorial on using the serial port. Note that you should use the Windows file I/O functions such as CreateFile(), ReadFile(), and WriteFile(). I'm not sure if it will work to use standard I/O functions such as fopen(), fread(), and fwrite().
Microsoft provides an article with sample code describing how to do this under Win32.
Boost:asio may be able to help as a serial device was added recently.
Fair warning though; the serial port documentation is light, presumably since it's quite new (it was added in asio 1.1.1 which was included in boost 1.36).
But working your way through asio is, IMHO, a better solution than using the raw Win32 API. Why? It'll be easier to read and maintain (it's a higher level API) and it'll be cross platform (except where you need to specify the OS-specific device name).
The Boost - Users and asio.user mailing lists are quite active and friendly and ought to be able to help you out if you get stuck.
If using .NET 2.0 see System.IO.Ports and this article should be helpful. If direct Win32, then Adam's answer is best.
I believe you will find plenty of sample code for C# as well if you find VC6 too ancient. I think there are also a bunch of "free" serial/COM port wrappers but I just wrote my own when I wrote an RS232 device controller piece of software.
google C# and serial port or rs232
I got these:
http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx
http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx
You should have no problem finding suitable code with a google search.

Resources