when I was building my custom light 4 touch switch panel for my smartHomeDIY I discovered Arduino uno and nano has only 2 hardware interrupts,
luckly,after searching for a while, I found a blog that helped me to overcome this limitation.
The solution is: pin change interrupts which are supported by the Arduino uno and nano: .
Regular hardware interrupts can be registered for raising or falling or change interrupt, but the pin change interrupts, as their name suggests, are only capable to deliver interrupts when the pin senses a voltage change in any direction, if you need to know which pin was changed you will have to read all pin states (or relevant pins) to know the new state and compare it to the old state (which you have to save on you program.
a small workaround in my case was to register for 2 hardware interrupts and for the other 2 required interrupts I used the pin chagne mechanism, but there are good news, the pin change interrupts are grouped into group of pins
When writing code and delivering to customers you usually will find your self (or someone else ...) debugging your code throw log files and probably a lot of them.
I know I do :)
So I wrote my self a small helper tool based on Electron and vue.js + vuetifyjs. which makes it cross-platform.
And I made is open source just for you :)
You can just drag and drop you files on it and start 'finding' , setting colors for specific phrases or filtering in or out any phrase you like.
BTW I used this cool template code from github, to get started easily...
Just note that this is a work-in-progress, feel free to file in issue you find on github :)
If you like your realtime logs monitoring on terminal from anywhere while using your favourite searching and colouring tools like me, then you must read this.
Azure DC/OS is a great tool, but getting the logs from each microservice instance using the dashboard is slow and complected.
So for the rescue here comes dc/os CLI.
This command line utility will make you life much easier in just a couple of steps
Good luck and happy debugging ... :)
During my search to start and learn embedded system programming, I was not able to find a good reference to start with.
I was searching a reference that will easy me in into this topic.
Because this topic not only hard to learn it is also consists from several topics:
So after searching a lot and for a long time I came up with the following YouTube playlists and couple of links that will ease you into this very interesting field.
Random important topics
Today I wanted to talk about a video that inspired me by Joop Brokking
it’s a tutorial video about STM32F103C8T6 ARM STM32 Minimum System Development board known also as the Blue Pill and how to program it to use the MPU-6050 sensors board via I2C
In this video Joop tested the i2c communication from the MPU-6050 sensors board to the STM32F103C8T6 ARM-M3 Micro controller
He used a real hardware Oscilloscope to test the signal
and show the errors and how to fix them
These hardware Oscilloscopes are very useful
but could also be quite expensive, especially for a beginner
So I thought why not replicate the hardware setup and try the same experiment with my Hantek 6022BE PC USB Digital portable Oscilloscope
And see how the single looks like or if it’s even capable measuring these kind of signals
The Hantek 6022BE PC USB Digital portable Oscilloscope, is a PC USB Digital portable Oscilloscope that features 2 20MHz analog Channels at 48M, and single can be shown on the computer with a dedicated software that comes with it
I have tested the 100KHz and 400KHz with no problem
You can see the clock signal and the data signal
As can be seen here it works great and it only costs around 70$
There are multiple ways to investigate the signal
and the software has some nice measuring capabilities
But of course it has less features than the hardware ones
and probably will not work at the higher scales of Mhz signals
I have also tried the same experiment with my USB 24MHz 8 Channel Logic Analyzer and the results were also great and this one only costs around 10$, but cannot debug analog signals only digital ones (i2c, spi, UART , etc...)
To program the STM32 you will beed an FTDI programer connected to the STM32 B6 and B7
Check out the full tutorial about programming the STM32F103C8T6 here
As part of my SmartHomeDIY project (open source), I need as small and efficient server which could also talk to my Arduino stations that are using RF24 module, so for the rescue came my Raspberry PI and it's serial GPIO pins.
All of my Arduino stations are talking to each other with the RF24 module (connected via SPI) and I needed a fast lightweight server (and small in size) to talk to that network.
I wanted to use the PI to do that job and I knew I could use it's GPIOs as serial (usually used for console logging in Hardware development stages)
So I figured why not connect a serial device to the PI GPIOs and through this device I will talk to my network.
So I figured up the following setup
I connected the PI to a serial BT device called Bluetooth HC-05
This device can talk via serial and forward everything to the other side BT device which is connected to an Arduino which in turn checks the commands and forward these commands to the specified Arduino station via the RF24 module, we will talk about the protocol and the BT device configuration in a moment.
nodejs, pi and serial
To use the PI serial you will first need to disable PI console prints to serial, to do that go here
To know more about pi serial read here
If cannot disable serial for pi read more here
As a summary here is what you will have to do:
1. download a utility
2. disable serial
3. check status
You will need to connect the bluetooth module to the PI GPIOs as shown above - here is a closeup
BE SURE TO DOUBLE CHECK BECAUSE THE PI DOES NOT HAVE PROTECTION CIRCUITRY - YOU CAN BURN YOUR PI FOREVER!
Note that there are at least 2 types of revision for the PI board - so make sure which one you have - each one has a different GPIO layout
Configuring the BT modules to talk to each other
To config the 2 BT modules to talk to each other and act as an over the air UART we will need to enter the AT command configuration mode, to do that we will give power to HC-05 while key pin is connected to Arduino pin (9) and pin (9) is already HIGH (or other pin you wish to use or any HIGH level source).
After all these commands the BT modules should be binded and auto connect always.
For more AT Commands info look:
After all the configurations, if everything is fine, the BT modules will blink at a slower rate, which indicates that the modules are in sync and connected to each other. note that every time you will reset the modules they will blink fast until connected to each other and in sync, I am using that indication a lot, for example to see if the modules are in range when installed in my house walls.
talking to the serial from node
After everything is connected and configured all we have to do is to send the data (commands) in my case through the serial (UART) port to the dispatch station
To do that will we have to use node serial module
Install it as any node module.
And here is an code example how to use it
Every command that we will send from this serial site will go through BT module and received on the other BT module and the Arduino on the dispatch station side will received that data as any other serial data, from there that station can parse that and forward it via SPI to the other stations
Here is the code for the dispatch station.
Important parts of the code are highlighted here.