Showing posts with label embedded system. Show all posts
Showing posts with label embedded system. Show all posts

Sunday, July 5, 2020

Refoss Smart Wi-Fi Garage Door Opener

I bought an "add-on" device that will enable my garage door opener accessible via WiFi, as well as other automated processes as part of my home automation project last year.  I bought it on Amazon: https://www.amazon.com/Refoss-Garage-Control-Compatible-Assistant/dp/B07PM59X4J/ref=cm_cr_arp_d_product_top?ie=UTF8&th=1

It had been working perfectly since I installed it last year, but since the last few days ago it has stopped.  I thought it must be something with the networking, so I followed the procedure instructed on the manual to configure it as a new device added to the eHomeLife on my iPhone, but with no luck.  The manual says, if the WiFi LED blinks rapidly, the device has been correctly set to access our home network.  But, I have not been able to connect my app to the device.

Curious to see what was going on, I logged on to my AP router and could see the device had been assigned a valid IP address (192.168.1.55) and I could even ping it.  That's all. I then did nmap to the device to see what ports were open.  I could only see the following:

nmap -O -sO 192.168.1.55
WARNING: Disabling OS Scan (-O) as it is incompatible with the IPProto Scan (-sO)
Starting Nmap 7.80 ( https://nmap.org ) at 2020-07-05 21:44 Pacific Daylight Time
Nmap scan report for 192.168.1.55
Host is up (0.021s latency).
Not shown: 252 closed protocols
PROTOCOL STATE         SERVICE
1        open          icmp
6        open          tcp
17       open          udp
41       open|filtered ipv6
MAC Address: 48:E1:E9:51:07:50 (Chengdu Meross Technology)

Actually, if I press the WiFi button for more than 5 seconds to make it goes to configuration mode and then use the SSID of the device (it becomes an "AP" device temporarily), then open a browser to access it (at IP address 10.10.10.1, because my phone's IP was assigned 10.10.10.2), I could see basic web interface to set WIFI as well as to upgrade firmware.

Googling for "Meross" or "Refoss" firmware couldn't give anything.  The company's website also doesn't give any link or information about any firmware upgrade.  Also, What's the difference between "Meross" and "Refoss"? Is Refoss is a knock-off of Meross?  Both are Chinese companies.

Honestly, I am now tempted to develop a similar by myself, probably using ESP32 (as using Raspberry-Pi for such thing is too much for such thing, not to consider more power-hungry).

Sunday, March 27, 2016

SBC IoT

Single Board Computer for Internet of Things now are getting more popular since Raspberry Pi.  Now we can see even 64-bit SBC with less than $40 price tag!

Following is the list of SBCs I can think of:


MakerModelCPUPriceWebsiteMisc.
Raspberry-PiRPI1 Model A+BCM2835$25https://www.raspberrypi.org
Raspberry-PiRPI1 B+$35https://www.raspberrypi.org
Raspberry-PiRPI2 Model BBCM2836$35https://www.raspberrypi.org
Raspberry-PiRPI 3 Model B$35https://www.raspberrypi.org
Raspberry-PiZero$5https://www.raspberrypi.org
CHIPAllWinner R8 (ARM)$9http://www.allwinnertech.com
Pine64Cortex-A53 AllWinner A64$15 - $29http://www.pine64.com
FriendlyARMNanoPi 2 (I/O ports compatible with RPi)Quadcore A9$24.99http://www.friendlyarm.com
Texas InstrumentsARM TIVA LaunchPADARM Cortex M4F$12.99Datasheet
STM MicroelectronicsNUCLEO-F103RBARM Cortex M3$10.33Product InfoDev. Board is compatible with Arduino


I personally like the FriendlyARM as it is more open system than Raspberry Pi. Broadcom is known for being paranoid to reveal the details of their products as we can see from their datasheets. FriendlyARM is more community-friendly and provides a lot of stuff already. With the damn-cheap price and the board is ready out of the box (unlike Rpi which still needs flash card), this kit is very exciting, even more interesting than Arduino.

Wednesday, June 19, 2013

SPI on Arduino Nano v3.0

IC Package: 32 pin MLF



Arduino
Pin #
ATMEL 328P
 (MLF) pin#
ATMEL 328P
(PDIP) pin#
Label Function
D10 14 16 PB2 SS*
D11 15 17 PB3 MOSI
D12 16 18 PB4 MISO
D13 17 19 PB5 SCK


The problem is, according to Arduino Nano schematic, pin 13 is connected to LED through 330 ohm resistor in series.
To be able to use SPI correctly, we need to disconnect the LED.

Tuesday, June 18, 2013

Arduino Nano v3.0 with avr-dude



My order of two Arduino Nano-compatible v3.0 from eBay (shipped from China) just arrived. Also bought the USBASP USBISP AVR Programmer from eBay (about $3.0, from China too, see the picture on the left).


The good thing about this USBISP AVR programmer, besides the unbelievable price, I was told that it is  also compatible with avrdude, even Atmel AVR Studio (never tried it, thought)

But when I tried to program it with avr-dude, it always failed with various errors, such as:






avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_getsync(): timeout communicating with programmer
or:
...
         Using Port                    : /dev/ttyUSB2
         Using Programmer              : avrisp
         Overriding Baud Rate          : 57600
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
...



I tried "-c arduino" without setting the baud-rate, I also tried different programmer type (stk500v2, etc.), nothing worked.  Turned out, the parameters combination I used was wrong.
In this case, the programmer should be "arduino" but the baudrate must be set to something (in this case, 57600).

The following is the correct one:


bash-4.2$ avrdude -c arduino -b 57600 -P /dev/ttyUSB2 -p atmega328p -vv -U flash:w:blink.hex

avrdude: Version 5.11, compiled on Sep  9 2011 at 16:00:41
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/mlutfi/.avrduderc"

         Using Port                    : /dev/ttyUSB2
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "blink.hex"
avrdude: input file blink.hex auto detected as Intel Hex
avrdude: writing flash (1468 bytes):

Writing | ################################################## | 100% 0.41s

avrdude: 1468 bytes of flash written
avrdude: verifying flash memory against blink.hex:
avrdude: load data flash data from input file blink.hex:
avrdude: input file blink.hex auto detected as Intel Hex
avrdude: input file blink.hex contains 1468 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.30s

avrdude: verifying ...
avrdude: 1468 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Monday, May 27, 2013

MSP430 or PIC?

After sometime using LaunchPad, I was ready to buid my own board utilizing some msp430g2211 on breakout boards laying around on my workbench.  I was going to use the JTAG pins available to program them, but bumped with the overpriced USB-based JTAG programmers/debuggers available in the market.  Yes, I could use the LaunchPad to program these separate microcontrollers, but it's not a good and decent way.

I got a  msp430 BSL usb-to-serial programmer from eBay.  After reading the datasheet for msp430g2211, I realized these type of low-cost microcontrollers don't support BSL, either.  So the only way (other than wiring LauchPad to my protoboard) to in-circuit program the chips is to use a JTAG programmer.  That's a lame, as with PIC microcontrollers, I still could used my PicKit2 to program 44-pin 18Fxx chips.  Even AVR from Atmel could do the similar way using cheap programmer available on eBay or even BusPirate.

Well, sorry msp430, for now I am back to PIC as it has so many features I need (wide availability of PDIP footprints, wide I/O voltage (2 - 5 volt) and cheap programmer).  I am aware there are some open-source efforts to build this kind of programmer for msp430 (GoodFet is one of them, the pre-assembled board is sold at https://www.adafruit.com/products/1279#Technical%20Details)

Thursday, March 28, 2013

Raspberry Pi Rev 2.0 Pin headers

Got my new Raspberry Pi mode-B rev 2.0 yesterday.  After looking around the info about some new unpopulated through holes on it, finally I got all the info.  Here's the summary:

Silkscreen label: P2
It is a 1x8-pin connection for JTAG to the main SoC (Broadcom MCU).
Silkscreen label: P3
It is 1x7 pins to be used for JTAG header connected to the USB hub + ethernet chip.
Silkscreen Label: P5
2x4 pins.  It's for extra connection
Pin 1 (square solder plate): +5 V output
Pin 2: +3.3v
Pin 3: GPIO28 (can be configured as I2C's SDA)
Pin 4: GPIO29 (can be configured as I2C's SCL)
Pin 5: GPIO30 
Pin 6: GPIO31 
Pin 7 and 8: Ground

Silkscreen label: P6
1x2 pins.  For MCU reset (short them will reset the MCU)

By the way, here is the info about the board (I have no idea my the Hardware below shows BCM2708, not BCM28xx):

pi@raspberrypi ~ $ cat /proc/cpuinfo
Processor    : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS    : 464.48
Features    : swp half thumb fastmult vfp edsp java tls
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part    : 0xb76
CPU revision    : 7

Hardware    : BCM2708
Revision    : 000e
Serial      : 00000000xxxxxxxx